/* ===== PALANG Connect Theme - Dark Red ===== */
:root {
    --primary: #8B1A1A;
    --primary-dark: #6B0F0F;
    --primary-light: #A52A2A;
    --primary-rgb: 139, 26, 26;
    --secondary: #D4A373;
    --bg-light: #F8F5F0;
    --bg-sidebar: #2C1810;
    --text-dark: #1A1A1A;
    --text-muted: #6C757D;
    --border-color: #E0D5C8;
}

body {
    background-color: var(--bg-light);
    font-family: 'Sarabun', 'Segoe UI', sans-serif;
    color: var(--text-dark);
}

/* ===== Auth Pages ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 480px;
    width: 100%;
    padding: 2.5rem;
}

.auth-card .logo {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: #fff;
    font-size: 2rem;
    font-weight: bold;
}

.auth-card h2 {
    color: var(--primary);
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* ===== Buttons ===== */
.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}

.btn-outline-primary {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-outline-primary:hover {
    background-color: var(--primary) !important;
    color: #fff !important;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-sidebar);
    color: #fff;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand h4 {
    color: #fff;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.sidebar-brand small {
    color: var(--secondary);
    font-size: 0.8rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-section {
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.5rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--primary);
    border-right: 3px solid var(--secondary);
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

.sidebar-nav .nav-link .badge {
    font-size: 0.7rem;
    padding: 0.25em 0.5em;
    font-weight: 500;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.content-wrapper {
    padding: 1.5rem;
}

/* ===== Cards ===== */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .card-body {
    padding: 1.25rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Tables ===== */
.table-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.table-card .card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.table thead th {
    background: var(--bg-light);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== E-Card ===== */
.ecard {
    max-width: 400px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
}

.ecard-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ecard-body {
    padding: 1.5rem;
    background: #fff;
    color: var(--text-dark);
}

.ecard-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid #fff;
    object-fit: cover;
    margin: 0 auto;
    display: block;
}

.ecard-qr {
    text-align: center;
    padding: 1rem;
    background: #fff;
    border-radius: 0 0 16px 16px;
}

/* ===== Tier Badges ===== */
.tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.tier-gold {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #5D4037;
}

.tier-silver {
    background: linear-gradient(135deg, #C0C0C0, #9E9E9E);
    color: #37474F;
}

.tier-bronze {
    background: linear-gradient(135deg, #CD7F32, #A0522D);
    color: #fff;
}

/* ===== Alert & Flash ===== */
.alert {
    border: none;
    border-radius: 10px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* ===== Forms ===== */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-dark);
}

/* ===== Pagination ===== */
.page-link {
    color: var(--primary);
}

.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ===== Loading ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}

/* ===== Activity Status Badges ===== */
.badge-upcoming { background: #17a2b8; }
.badge-ongoing { background: #28a745; }
.badge-completed { background: #6c757d; }
.badge-cancelled { background: #dc3545; }

/* ===== Vote Card ===== */
.candidate-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.candidate-card:hover,
.candidate-card.selected {
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.2);
}

.candidate-card.selected {
    background: rgba(var(--primary-rgb), 0.05);
}

.candidate-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}

/* ===== Print ===== */
@media print {
    .sidebar,
    .topbar,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }
}
