/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

:root {
    --bg-color: #f4f6f8;
    --sidebar-bg: #0a1b3f;
    /* Dark Blue */
    --sidebar-text: #ffffff;
    --sidebar-active-bg: #ffffff;
    --sidebar-active-text: #0a1b3f;
    --card-bg: #ffffff;
    --primary-blue: #164082;
    --primary-green: #0d8a56;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --border-radius: 12px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 30px 40px;
    margin-left: 260px;
    /* Sidebar width */
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-logo {
    padding: 20px 20px;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo img {
    height: 32px;
    width: 32px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.nav-menu {
    list-style: none;
    padding: 0 15px;
    flex: 1;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.nav-link i {
    font-size: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.language-selector {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.08);
    padding: 12px 15px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.language-selector:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lang-dropdown {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    display: none;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.language-selector.active .lang-dropdown {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 13px;
    transition: 0.2s;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.lang-option.active {
    color: var(--primary-accent);
    background: rgba(59, 130, 246, 0.1);
}

.lang-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    font-weight: 500;
}

/* Cards & Layout */
.top-header-card {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1e40af 100%);
    border-radius: var(--border-radius);
    padding: 30px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    box-shadow: 0 10px 25px -5px rgba(22, 64, 130, 0.3);
    gap: 30px;
    position: relative;
    overflow: hidden;
}

.profile-main, .profile-stats {
    position: relative;
    z-index: 1;
}

/* Logo Watermark Removed */

/* Prevent any stray images in the card from being huge */
.top-header-card img {
    max-width: 100%;
    height: auto;
}

.profile-main {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-avatar-wrapper {
    width: 85px;
    height: 85px;
    border-radius: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-wrapper span {
    font-size: 32px;
    color: white;
    font-weight: 800;
}

.profile-info h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-badges {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.edit-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: 0.3s;
}

.edit-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.status-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.help-icon {
    opacity: 0.6;
    font-size: 18px;
    cursor: pointer;
    transition: 0.3s;
}

.help-icon:hover {
    opacity: 1;
}

.profile-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.stat-box {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    padding: 15px 20px;
    border-radius: 14px;
    min-width: 170px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.stat-box.rating-box {
    background: rgba(255, 193, 7, 0.05);
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.stat-box label {
    font-size: 10px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.rating-box label {
    color: #ffc107;
}

.stat-box .val {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.rating-box .val {
    color: #ffc107;
}

.copy-icon {
    cursor: pointer;
    opacity: 0.6;
    font-size: 16px;
    transition: 0.3s;
}

.copy-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Alert Card */
.alert-card {
    background-color: var(--primary-green);
    color: white;
    border-radius: var(--border-radius);
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(13, 138, 86, 0.2);
}

.alert-card h2 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 5px;
}

.alert-card h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
}

.alert-card p {
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-white {
    background: white;
    color: var(--primary-green);
    padding: 12px 24px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Info Grids */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.info-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.info-card h3 i {
    color: var(--primary-blue);
    background: #f1f5f9;
    padding: 8px;
    border-radius: 8px;
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.info-item i {
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 8px;
    border-radius: 8px;
    font-size: 18px;
}

.info-content label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.info-content span {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

/* UI details for olympiads */
.page-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.tabs-container {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.tab-btn.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.olympiad-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.empty-state i {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 15px;
    background: #f8fafc;
    padding: 20px;
    border-radius: 50%;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Mobile Header & Sidebar Overlay */
.mobile-header {
    display: none;
    background: var(--sidebar-bg);
    color: white;
    padding: 15px 20px;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.mobile-logo {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-logo img {
    height: 32px;
    width: 32px;
    object-fit: cover;
    border-radius: 6px;
}

.mobile-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 26px;
    cursor: pointer;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Tables Wrapper for Responsive X-scroll */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Responsive Grid and Layout Updates */
@media (max-width: 992px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* Regulation Banner on Index */
.regulation-banner {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    border-radius: var(--border-radius);
    padding: 20px 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.2);
    animation: fadeIn 0.8s ease;
}

.reg-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.reg-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.reg-text h4 {
    font-size: 18px;
    margin-bottom: 5px;
    font-weight: 700;
}

.reg-text p {
    font-size: 14px;
    opacity: 0.9;
}

.reg-btn {
    background: white;
    color: #1e40af;
    padding: 12px 25px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.reg-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: #f8fafc;
}

@media (max-width: 768px) {
    .regulation-banner {
        flex-direction: column;
        text-align: center;
        gap: 20px;
        padding: 25px 20px;
    }
    .reg-content {
        flex-direction: column;
        gap: 15px;
    }
    .reg-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .sidebar {
        left: -260px;
        z-index: 101;
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 80px 15px 20px 15px; /* Added top padding to prevent mobile header overlap */
    }

    .mobile-header {
        display: flex;
    }

    .top-header-card {
        flex-direction: column;
        align-items: stretch;
        gap: 25px;
        padding: 20px;
    }

    .profile-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }

    .profile-avatar-wrapper {
        width: 75px;
        height: 75px;
        border-radius: 20px;
    }

    .profile-info h1 {
        font-size: 20px;
        flex-direction: column;
        gap: 8px;
    }

    .profile-badges {
        justify-content: center;
    }

    .profile-stats {
        width: 100%;
        gap: 10px;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .stat-box {
        min-width: unset;
        padding: 12px 15px;
    }

    .stat-box .val {
        font-size: 15px;
    }

    .alert-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 20px;
    }
    
    .tabs-container {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        text-align: center;
        padding: 8px 10px;
        font-size: 13px;
    }
}