/* Common navigation styles */
header {
    background-color: #2c3e50;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

/* Desktop header layout */
.desktop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Mobile header layout - hidden by default */
.mobile-header {
    display: none;
    flex-direction: column;
    width: 100%;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-links a.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: bold;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-weight: bold;
}

#current-time {
    font-size: 0.9rem;
}

#ws-status {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
}

#ws-status.connected {
    background-color: #2ecc71;
}

#ws-status.disconnected {
    background-color: #e74c3c;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        height: 60px; /* Two-line header for mobile */
        padding: 4px 8px; /* Compact padding */
        min-height: 60px;
        position: relative;
    }
    
    /* Hide desktop header on mobile */
    .desktop-header {
        display: none;
    }
    
    /* Show mobile header on mobile */
    .mobile-header {
        display: flex;
    }
    
    /* First line: Logo + Title + User info */
    .header-top-line {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 28px;
        width: 100%;
    }
    
    .header-left {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .header-logo {
        width: 16px; /* Compact logo */
        height: 16px;
    }
    
    header h1 {
        font-size: 0.85rem; /* Compact title */
        margin: 0;
        font-weight: 600;
    }
    
    .user-info {
        font-size: 0.65rem; /* Compact user info */
        display: flex;
        align-items: center;
        gap: 4px;
        margin: 0;
        white-space: nowrap;
    }
    
    .user-info span {
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    #current-time {
        display: none; /* Hide time on mobile to save space */
    }
    
    .logout-btn {
        padding: 3px;
        font-size: 0.6rem;
        min-width: 20px;
        height: 20px;
        border-radius: 3px;
    }
    
    .logout-btn svg {
        width: 10px;
        height: 10px;
    }
    
    /* Second line: Navigation switches */
    .header-bottom-line {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 28px;
        width: 100%;
        border-top: 1px solid rgba(255,255,255,0.2);
        padding-top: 2px;
    }
    
    .mobile-nav-switches {
        display: flex;
        width: 100%;
        justify-content: space-between;
        align-items: center;
    }
    
    .mobile-nav-switch {
        background: rgba(255,255,255,0.1);
        color: white;
        border: 1px solid rgba(255,255,255,0.3);
        padding: 3px 10px;
        border-radius: 4px;
        text-decoration: none;
        font-size: 0.7rem;
        font-weight: 500;
        transition: all 0.3s ease;
        min-width: 50px;
        text-align: center;
        line-height: 1;
    }
    
    .mobile-nav-switch:hover {
        background: rgba(255,255,255,0.2);
        color: white;
        text-decoration: none;
    }
    
    .mobile-nav-switch.active {
        background: rgba(255,255,255,0.3);
        border-color: rgba(255,255,255,0.5);
        color: white;
    }
    
    /* Hide desktop navigation */
    .nav-links {
        display: none;
    }
}

/* Ensure content starts below the fixed header */
body {
    padding-top: 60px;
}

/* Adjust body padding for mobile */
@media (max-width: 768px) {
    body {
        padding-top: 60px; /* Match two-line mobile header */
    }
}
/* Update the loading overlay CSS */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important; /* Add this to ensure it's hidden */
}
/* Update the loading overlay CSS */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important; /* Add this to ensure it's hidden */
}

.loading-spinner {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #2c3e50;
    animation: spin 2s linear infinite;
}

.loading-timer {
    width: 100px;
    height: 100px;
    position: relative;
    margin-bottom: 20px;
}

.loading-timer-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(#2c3e50 0%, transparent 0%);
    position: absolute;
    transition: background 0.1s;
}

.loading-timer-inner {
    position: absolute;
    width: 80%;
    height: 80%;
    background-color: white;
    border-radius: 50%;
    top: 10%;
    left: 10%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
}

.loading-message {
    margin-top: 20px;
    font-size: 18px;
    color: #2c3e50;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Add styles for logout button */
.logout-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.logout-btn svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    .logout-btn {
        padding: 3px;
        margin-left: 5px;
    }
    
    .logout-btn svg {
        width: 14px;
        height: 14px;
    }
}