/* ========================================
   SITE HEADER STYLES
   TradeSmart.live - Top Fixed Header
   ======================================== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: #000000;
    border-bottom: 1px solid var(--primary);
    display: flex;
    align-items: center;
    z-index: 101;
}

.site-header-content {
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-logo {
    width: 80px;
    height: 45px;
    object-fit: cover;
    object-position: center calc(50% - 1px);
    border-radius: 50%;
    border: 2px solid var(--primary);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.site-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

.title-dot {
    color: var(--white);
}

.title-live {
    color: #ef4444;
    animation: pulseLive 1.5s ease-in-out infinite;
}

@keyframes pulseLive {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Trading Sessions - Analog Clocks */
.trading-sessions {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.session-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    transition: all 0.3s ease;
    min-width: 85px;
}

.session-clock.closed {
    opacity: 0.6;
}

.clock-container {
    position: relative;
    width: 61px;
    height: 61px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.session-clock.open .clock-container {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Flag background layer */
.clock-flag-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    opacity: 0.5;
}

/* Australia - Blue with Southern Cross stars */
.clock-flag-sydney {
    background:
        radial-gradient(circle at 65% 65%, #fff 3px, transparent 3px),
        radial-gradient(circle at 75% 45%, #fff 2px, transparent 2px),
        radial-gradient(circle at 55% 75%, #fff 2px, transparent 2px),
        radial-gradient(circle at 80% 70%, #fff 2px, transparent 2px),
        radial-gradient(circle at 70% 55%, #fff 1.5px, transparent 1.5px),
        #012169;
}

/* Japan - White with red sun */
.clock-flag-tokyo {
    background: radial-gradient(circle at 50% 50%, #bc002d 28%, #fff 28%);
}

/* UK - Union Jack */
.clock-flag-london {
    background:
        linear-gradient(0deg, transparent 44%, #C8102E 44%, #C8102E 56%, transparent 56%),
        linear-gradient(90deg, transparent 44%, #C8102E 44%, #C8102E 56%, transparent 56%),
        linear-gradient(0deg, transparent 38%, #fff 38%, #fff 42%, transparent 42%, transparent 58%, #fff 58%, #fff 62%, transparent 62%),
        linear-gradient(90deg, transparent 38%, #fff 38%, #fff 42%, transparent 42%, transparent 58%, #fff 58%, #fff 62%, transparent 62%),
        linear-gradient(45deg, #012169 30%, transparent 30%, transparent 44%, #fff 44%, #fff 48%, #C8102E 48%, #C8102E 52%, #fff 52%, #fff 56%, transparent 56%, transparent 70%, #012169 70%),
        linear-gradient(-45deg, #012169 30%, transparent 30%, transparent 44%, #fff 44%, #fff 48%, #C8102E 48%, #C8102E 52%, #fff 52%, #fff 56%, transparent 56%, transparent 70%, #012169 70%),
        #012169;
}

/* USA - Stars and Stripes */
.clock-flag-newyork {
    background:
        radial-gradient(circle at 12% 15%, #fff 1px, transparent 1px),
        radial-gradient(circle at 22% 15%, #fff 1px, transparent 1px),
        radial-gradient(circle at 32% 15%, #fff 1px, transparent 1px),
        radial-gradient(circle at 17% 25%, #fff 1px, transparent 1px),
        radial-gradient(circle at 27% 25%, #fff 1px, transparent 1px),
        radial-gradient(circle at 12% 35%, #fff 1px, transparent 1px),
        radial-gradient(circle at 22% 35%, #fff 1px, transparent 1px),
        radial-gradient(circle at 32% 35%, #fff 1px, transparent 1px),
        linear-gradient(90deg, #3C3B6E 0%, #3C3B6E 38%, transparent 38%),
        repeating-linear-gradient(
            180deg,
            #B22234 0px,
            #B22234 6px,
            #fff 6px,
            #fff 12px
        );
    background-size: 100% 45%, 100% 45%, 100% 45%, 100% 45%, 100% 45%, 100% 45%, 100% 45%, 100% 45%, 100% 45%, 100% 100%;
    background-position: top left;
    background-repeat: no-repeat;
}

.clock-svg {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

.clock-bg {
    fill: rgba(0, 0, 0, 0.5);
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 1;
}

.clock-arc {
    fill: rgba(16, 185, 129, 0);
    stroke: none;
    transition: fill 0.3s ease;
}

.session-clock.open .clock-arc {
    fill: rgba(16, 185, 129, 0.55);
}

.session-clock.soon .clock-arc {
    fill: rgba(16, 185, 129, 0.25);
}

.clock-label {
    font-size: 7px;
    font-weight: 700;
    fill: #fff;
    text-anchor: middle;
    letter-spacing: 0.5px;
}

.clock-local-time {
    font-size: 10px;
    font-weight: 700;
    fill: #fff;
    text-anchor: middle;
}

.session-clock.open .clock-local-time {
    fill: #22c55e;
}

.clock-tick {
    stroke: rgba(255, 255, 255, 0.6);
    stroke-width: 1.5;
}

.clock-center {
    fill: #fff;
}

.session-clock.open .clock-center {
    fill: var(--primary);
}

.clock-hand {
    stroke-linecap: round;
    transform-origin: 30px 30px;
}

/* Hour hand - thick and short */
.clock-hand-hour {
    stroke: #fff;
    stroke-width: 2.5;
    transition: transform 0.3s ease;
}

/* Minute hand - medium thickness */
.clock-hand-minute {
    stroke: #fff;
    stroke-width: 1.5;
    transition: transform 0.3s ease;
}

/* Second hand - thin and red */
.clock-hand-second {
    stroke: #ef4444;
    stroke-width: 0.8;
    transition: none;
}

.session-clock.open .clock-hand-hour,
.session-clock.open .clock-hand-minute {
    stroke: #22c55e;
    filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.8));
}

.session-clock.open .clock-hand-second {
    stroke: #22c55e;
    filter: drop-shadow(0 0 3px rgba(34, 197, 94, 0.6));
}

.clock-time {
    font-size: 8px;
    color: #9ca3af;
    white-space: nowrap;
    font-weight: 500;
    min-width: 85px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.session-clock.open .clock-time {
    color: #22c55e;
}

/* Site Header Right - Language Selector */
.site-header {
    justify-content: space-between;
}

.site-header-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding-right: 20px;
    min-width: 80px;
}

/* UTC Clock in Header */
.header-utc-clock {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(75, 85, 99, 0.4);
    border-radius: 6px;
    padding: 4px 10px;
    font-variant-numeric: tabular-nums;
}

.header-utc-clock .utc-label {
    font-size: 9px;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 0.5px;
}

.header-utc-clock .utc-time {
    font-size: 12px;
    font-weight: 600;
    color: #10b981;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Header Logout Button (Mobile only) */
.header-logout-btn {
    display: none; /* Hidden by default on desktop */
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 8px;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.header-logout-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #f87171;
}

/* Language Selector */
.lang-selector {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--white);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 500;
}

.lang-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--primary);
}

.lang-flag {
    font-size: 16px;
    line-height: 1;
}

.lang-code {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.lang-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.lang-selector.open .lang-arrow {
    transform: rotate(180deg);
}

/* Language Dropdown */
.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #111111;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    padding: 6px;
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.lang-selector.open .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: #9ca3af;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
    font-size: 13px;
}

.lang-option:hover {
    background: rgba(16, 185, 129, 0.15);
    color: var(--white);
}

.lang-option.active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--primary);
}

.lang-option .lang-flag {
    font-size: 18px;
}

.lang-option .lang-name {
    font-weight: 500;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
    .site-header {
        height: 60px;
    }

    .header-logo {
        width: 65px;
        height: 37px;
    }

    .site-title {
        font-size: 16px;
    }

    .site-header-right {
        padding-right: 12px;
    }

    .lang-btn {
        padding: 5px 8px;
    }

    .lang-code {
        display: none;
    }

    /* Trading Sessions - Tablet */
    .trading-sessions {
        gap: 6px;
    }

    .clock-container {
        width: 48px;
        height: 48px;
    }

    .clock-label {
        font-size: 5px;
    }

    .clock-time {
        font-size: 8px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .site-header {
        height: 50px;
    }

    .site-header-content {
        padding: 0 12px;
        gap: 3px;
    }

    .header-logo {
        width: 50px;
        height: 28px;
    }

    .site-title {
        font-size: 14px;
    }

    .site-header-right {
        padding-right: 8px;
    }

    /* Hide trading sessions on mobile */
    .trading-sessions {
        display: none;
    }

    /* Show logout button on mobile */
    .header-logout-btn {
        display: flex;
        width: 32px;
        height: 32px;
    }

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

    .lang-btn {
        padding: 4px 6px;
        gap: 4px;
    }

    .lang-flag {
        font-size: 14px;
    }

    .lang-arrow {
        width: 12px;
        height: 12px;
    }

    .lang-dropdown {
        min-width: 120px;
        padding: 4px;
    }

    .lang-option {
        padding: 6px 10px;
        font-size: 12px;
    }

    .lang-option .lang-flag {
        font-size: 16px;
    }
}

/* Small Mobile Responsive */
@media (max-width: 480px) {
    .site-header {
        height: 45px;
    }

    .site-header-content {
        padding: 0 8px;
    }

    .header-logo {
        width: 45px;
        height: 25px;
        border-width: 1px;
    }

    .site-title {
        font-size: 13px;
        letter-spacing: 0;
    }

    .site-header-right {
        padding-right: 6px;
        gap: 8px;
    }

    /* Smaller logout button on small mobile */
    .header-logout-btn {
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }

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

    .lang-btn {
        padding: 3px 5px;
        border-radius: 4px;
    }

    .lang-flag {
        font-size: 13px;
    }

    .lang-arrow {
        width: 10px;
        height: 10px;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .site-header {
        height: 40px;
    }

    .header-logo {
        width: 40px;
        height: 22px;
    }

    .site-title {
        font-size: 12px;
    }

    /* Show logout button in landscape mobile */
    .header-logout-btn {
        display: flex;
        width: 26px;
        height: 26px;
        border-radius: 5px;
    }

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

    .lang-btn {
        padding: 3px 5px;
    }

    .lang-flag {
        font-size: 12px;
    }

    .lang-arrow {
        width: 10px;
        height: 10px;
    }
}
