/* Universal Header Styles for Larson Tower Specialists */

/* Main header container */
.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 20px 50px;
    background-color: white;
    border-bottom: 1px solid #eaeaea;
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative; /* Important for absolute positioning of indicators */
}

/* Logo styling */
.logo {
    grid-column: 1;
    justify-self: start;
    font-size: 26px;
    font-weight: bold;
    color: #000;
    position: relative;
}

.logo span {
    background: linear-gradient(135deg, #0066cc, #0099ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* Center - welcome message */
.user-welcome {
    grid-column: 2;
    text-align: center;
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.user-welcome span {
    color: #0066cc;
    font-weight: 600;
}

/* Right side - navigation */
.nav-links {
    grid-column: 3;
    justify-self: end;
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: #555;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #0066cc;
}

/* Admin link styling */
.admin-link {
    color: #d9534f !important; /* Use important to override the default link color */
}

.admin-link:hover {
    color: #c9302c !important;
}

/* Header hide/show on scroll */
.header.hide {
    transform: translateY(-100%);
}

/* ----- OFFLINE MODE HEADER STYLES ----- */

/* Create a standalone offline indicator not influenced by logo styles */
.offline-indicator {
    position: absolute;
    top: 10px;
    right: 50px;
    background-color: #f44336;
    color: white;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
    animation: pulse 2s infinite;
    z-index: 1010;
    
    /* Very explicitly override any gradient styles that might be inherited */
    background-image: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: white !important;
    text-fill-color: white !important;
    background-clip: initial !important;
    font-weight: normal !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Make sure the icon has proper spacing */
.offline-indicator i {
    margin-right: 5px;
}

/* Ensure the offline indicator text is visible */
.offline-indicator span {
    background: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: white !important;
    text-fill-color: white !important;
    font-weight: normal !important;
}

/* Subtle "OFFLINE" badge when in offline mode */
body.offline-mode .header:after {
    content: "OFFLINE";
    position: absolute;
    top: 0;
    right: 10px;
    font-size: 0.6rem;
    background-color: #f44336;
    color: white;
    padding: 2px 6px;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1005;
}

/* Animation for the offline indicator */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Mobile responsiveness adjustments */
@media (max-width: 768px) {
    .header {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 15px;
        padding: 15px 20px;
    }
    
    .logo {
        grid-row: 1;
        grid-column: 1;
        justify-self: center;
    }
    
    .user-welcome {
        grid-row: 2;
        grid-column: 1;
        justify-self: center;
    }
    
    .nav-links {
        grid-row: 3;
        grid-column: 1;
        justify-self: center;
    }
    
    /* Adjust offline indicator position for mobile */
    .offline-indicator {
        position: fixed;
        top: auto;
        bottom: 10px;
        left: 10px;
        right: auto;
        font-size: 0.7rem;
        padding: 3px 8px;
        z-index: 1020; /* Higher z-index to ensure visibility */
    }
    
    /* Mobile offline badge */
    body.offline-mode .header:after {
        top: 0;
        right: 0;
        left: 0;
        text-align: center;
        border-radius: 0;
        font-size: 0.7rem;
        padding: 3px;
    }
}

/* Additional styles for ensuring no gradient inheritance on child elements */
.logo * {
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
}

/* Restore the gradient for the logo span specifically */
.logo span {
    background: linear-gradient(135deg, #0066cc, #0099ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* Additional styles to add to header.css for theme toggle */

/* Theme Toggle Integration */
.nav-links {
    display: flex;
    gap: 20px; /* Slightly reduced from 30px to accommodate new element */
    align-items: center; /* Ensure vertical alignment */
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
    position: relative;
}

.theme-toggle:hover {
    background-color: rgba(128, 128, 128, 0.1);
    transform: rotate(15deg);
}

.theme-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
}

/* For screen readers */
.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;
}

/* Adjustments for mobile */
@media (max-width: 768px) {
    .nav-links {
        gap: 15px;
    }
    
    .theme-toggle {
        font-size: 16px;
        width: 32px;
        height: 32px;
    }
    
    /* Special case for very small screens */
    @media (max-width: 370px) {
        .nav-links {
            gap: 10px;
        }
        
        .nav-links a, .theme-toggle {
            font-size: 14px;
        }
    }
}