/**
 * ============================================================
 * SISTEM UNDIAN JKKK - Custom Styles
 * ============================================================
 * Mobile-first, mesra warga emas
 * ============================================================
 */

/* ============================================================
 * ROOT VARIABLES
 * ============================================================ */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    
    --font-size-base: 18px;
    --font-size-large: 22px;
    --font-size-xlarge: 28px;
    
    --border-radius: 0.5rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* ============================================================
 * GENERAL STYLES
 * ============================================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ============================================================
 * TYPOGRAPHY - Mesra Warga Emas
 * ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.1rem; }

p {
    margin-bottom: 1rem;
}

/* Font besar untuk warga emas */
.elderly-friendly {
    font-size: var(--font-size-large) !important;
}

/* ============================================================
 * BUTTONS - Saiz besar dan jelas
 * ============================================================ */
.btn {
    font-size: var(--font-size-base);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn-lg {
    font-size: var(--font-size-large);
    padding: 1rem 2rem;
    min-height: 60px;
}

.btn-xl {
    font-size: var(--font-size-xlarge);
    padding: 1.25rem 2.5rem;
    min-height: 70px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

/* Button with icon spacing */
.btn i {
    margin-right: 0.5rem;
}

/* ============================================================
 * CARDS
 * ============================================================ */
.card {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.125);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: var(--font-size-large);
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* ============================================================
 * FORMS - Saiz input besar
 * ============================================================ */
.form-label {
    font-weight: 600;
    font-size: var(--font-size-base);
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.form-control,
.form-select {
    font-size: var(--font-size-base);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: 2px solid #dee2e6;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    min-height: 50px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.form-control.is-valid {
    border-color: var(--success-color);
}

.invalid-feedback,
.valid-feedback {
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* Input group */
.input-group-text {
    font-size: var(--font-size-base);
    padding: 0.75rem 1rem;
    background-color: #e9ecef;
    border: 2px solid #dee2e6;
}

/* ============================================================
 * HERO SECTION
 * ============================================================ */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0a58ca 100%);
    color: white;
    border-radius: 0 0 2rem 2rem;
    margin-bottom: 2rem;
}

.hero-section h1 {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================================
 * CANDIDATE CARD - Card calon untuk pengundian
 * ============================================================ */
.candidate-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    position: relative;
}

.candidate-card:hover {
    border-color: var(--primary-color);
    transform: scale(1.02);
    box-shadow: 0 0.5rem 1rem rgba(13, 110, 253, 0.3);
}

.candidate-card.selected {
    border-color: var(--success-color);
    background-color: #d1e7dd;
}

.candidate-card.selected::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--success-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.candidate-photo {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.candidate-name {
    font-size: var(--font-size-large);
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.candidate-info {
    font-size: 1rem;
    color: var(--secondary-color);
}

/* ============================================================
 * ALERTS - Mesej pemberitahuan
 * ============================================================ */
.alert {
    font-size: var(--font-size-base);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    border-left: 5px solid;
}

.alert i {
    margin-right: 0.5rem;
    font-size: 1.25rem;
}

/* ============================================================
 * BADGES
 * ============================================================ */
.badge {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
}

/* ============================================================
 * TABLES - Admin tables
 * ============================================================ */
.table {
    font-size: 1rem;
}

.table thead th {
    background-color: var(--light-color);
    font-weight: 600;
    border-bottom: 2px solid var(--secondary-color);
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* ============================================================
 * PAGINATION
 * ============================================================ */
.pagination {
    font-size: 1rem;
}

.page-link {
    padding: 0.75rem 1rem;
    color: var(--primary-color);
    border: 2px solid #dee2e6;
    margin: 0 0.25rem;
    border-radius: var(--border-radius);
}

.page-link:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================================
 * LOADING SPINNER
 * ============================================================ */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* ============================================================
 * NAVBAR
 * ============================================================ */
.navbar {
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-link {
    font-size: 1rem;
    padding: 0.5rem 1rem !important;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* ============================================================
 * FOOTER
 * ============================================================ */
footer {
    margin-top: auto;
}

footer a:hover {
    color: white !important;
}

/* ============================================================
 * CHART CONTAINER
 * ============================================================ */
.chart-container {
    position: relative;
    height: 400px;
    margin: 2rem 0;
}

/* ============================================================
 * MOBILE RESPONSIVENESS
 * ============================================================ */
@media (max-width: 768px) {
    :root {
        --font-size-base: 16px;
        --font-size-large: 20px;
        --font-size-xlarge: 24px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    .candidate-photo {
        height: 200px;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .btn-lg {
        min-height: 50px;
        padding: 0.875rem 1.5rem;
    }
}

/* ============================================================
 * PRINT STYLES
 * ============================================================ */
@media print {
    .navbar,
    .btn,
    footer,
    .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    body {
        background-color: white;
    }
}

/* ============================================================
 * UTILITY CLASSES
 * ============================================================ */
.text-oversized {
    font-size: var(--font-size-xlarge) !important;
}

.min-height-100 {
    min-height: 100vh;
}

.shadow-hover:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.cursor-pointer {
    cursor: pointer;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0a58ca 100%);
}

/* ============================================================
 * ACCESSIBILITY
 * ============================================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================================
 * ANIMATIONS
 * ============================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}
