/* ============================================================================
   Header Styles
   - Main header container
   - Status indicators and dots
   - Back button
   - Updated indicators
   ============================================================================ */

.header {
    background: var(--bg-secondary);
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 20px 60px var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
    transition: background 0.3s;
}

.header h1 {
    font-size: 1.75em;
    margin: 0;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: var(--text-secondary);
    margin: 5px 0 0 0;
    font-size: 0.9em;
}

.back-button {
    background: rgba(102, 126, 234, 0.2);
    color: #8b9fea;
    border: 1px solid rgba(102, 126, 234, 0.3);
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    min-width: 44px;
    line-height: 1;
}

.back-button:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.5);
    color: #667eea;
    transform: translateX(-2px);
}

/* On larger screens, remove the left margin */
@media (min-width: 769px) {
    .back-button {
        margin-left: 0;
    }
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #48bb78;
    color: white;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #48bb78;
    cursor: help;
    position: relative;
}

/* Status dot tooltip (same as updated-dot) */
.status-dot::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(15, 23, 34, 0.95);
    color: #f1f5f9;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    border: 1px solid rgba(102, 126, 234, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    line-height: 1.4;
}

.status-dot::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-2px);
    border: 5px solid transparent;
    border-top-color: rgba(15, 23, 34, 0.95);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10000;
}

.status-dot:hover::before,
.status-dot:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

.status-dot:hover::after {
    transform: translateX(-50%) translateY(1px);
}

.status-connected {
    color: #064e3b !important;
    font-weight: 600;
}

.status-dot-glow {
    box-shadow: 0 0 5px rgba(72, 187, 120, 0.5),
                0 0 10px rgba(72, 187, 120, 0.3);
    animation: dotGlow 2s ease-in-out infinite;
}

.updated-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.updated-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #48bb78;
    animation: dotGlow 2s ease-in-out infinite;
    cursor: help;
    position: relative;
}

.updated-dot.inactive {
    background: #ef4444;
    animation: dotGlowRed 2s ease-in-out infinite;
}

.updated-dot.markets-closed {
    background: #fbbf24;
    animation: dotGlowYellow 2s ease-in-out infinite;
}

/* Status dot tooltip - left aligned */
.updated-dot::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 0;
    transform: translateY(-8px);
    background: rgba(15, 23, 34, 0.95);
    color: #f1f5f9;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    border: 1px solid rgba(102, 126, 234, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    line-height: 1.4;
}

.updated-dot::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 6px;
    transform: translateY(-2px);
    border: 5px solid transparent;
    border-top-color: rgba(15, 23, 34, 0.95);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10000;
}

.updated-dot:hover::before {
    opacity: 1;
    transform: translateY(-4px);
}

.updated-dot:hover::after {
    opacity: 1;
    transform: translateY(1px);
}

/* Light theme header background */
body.light-theme .header {
    background: rgba(255, 255, 255, 0.8);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: row;     /* Keep horizontal layout */
        justify-content: space-between;
        align-items: center;
        text-align: left;        /* Left align text */
        padding: 15px 20px;
    }

    .header h1 {
        font-size: 1.1em;        /* Reduced from 1.3em */
        margin-bottom: 2px;
    }

    .header p {
        font-size: 0.75em;       /* Reduced from 0.8em */
    }

    /* Logo smaller on mobile */
    .header img {
        width: 32px !important;
        height: 32px !important;
    }

    /* Show toggle on mobile - allow switching between cards and table */
    .header > div:has(#toggleCards) {
        width: 100%;
        justify-content: center;
    }

    /* Last refresh time - compact on mobile */
    #lastRefreshTime span {
        font-size: 0.75em !important;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
