/* ==========================================================================
   Forex Clock — Tejarat Afarin theme (babypips-inspired layout)
   All colors/sizes live in CSS variables below — tweak these first if you
   want an exact match to your site palette, nothing else needs to change.
   ========================================================================== */

.tja-forex-clock {
    --tfx-bg: #0b1220;
    --tfx-card-bg: #111b2c;
    --tfx-card-bg-2: #16223578;
    --tfx-border: rgba(255, 255, 255, 0.08);
    --tfx-text: #eaeef5;
    --tfx-text-muted: #8792a3;

    --tfx-sydney: #a855f7;
    --tfx-tokyo: #38bdf8;
    --tfx-london: #22c55e;
    --tfx-ny: #f59e0b;

    --tfx-accent-gray: #3d4657;
    --tfx-accent-red: #ef4444;
    --tfx-accent-gold: #d4af37;

    --tfx-radius-lg: 18px;
    --tfx-radius-md: 12px;
    --tfx-radius-sm: 8px;
    --tfx-font: 'IRANSans', 'Vazirmatn', sans-serif;

    direction: rtl;
    font-family: var(--tfx-font);
    background: radial-gradient(120% 140% at 100% 0%, #16233a 0%, var(--tfx-bg) 55%);
    border: 1px solid var(--tfx-border);
    border-radius: var(--tfx-radius-lg);
    padding: 22px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    color: var(--tfx-text);
    max-width: 100%;
    box-sizing: border-box;
}

.tja-forex-clock * {
    box-sizing: border-box;
}

/* ---------- Header ---------- */

.tfx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.tfx-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 19px;
    font-weight: 700;
    color: var(--tfx-text);
}

.tfx-header-icon {
    font-size: 21px;
}

.tfx-header-clock-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tfx-header-clock {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--tfx-text);
    font-variant-numeric: tabular-nums;
    background: var(--tfx-card-bg-2);
    border: 1px solid var(--tfx-border);
    padding: 4px 14px;
    border-radius: 999px;
    direction: ltr;
}

.tfx-live-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--tfx-london);
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    padding: 4px 10px;
    border-radius: 999px;
}

.tfx-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--tfx-london);
    box-shadow: 0 0 6px var(--tfx-london);
    animation: tfx-pulse 1.6s ease-in-out infinite;
}

@keyframes tfx-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .4; transform: scale(.7); }
}

/* ---------- Session status cards ---------- */

.tfx-sessions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}

.tfx-session-card {
    position: relative;
    background: var(--tfx-card-bg);
    border: 1px solid var(--tfx-border);
    border-top: 3px solid var(--tfx-accent-gray);
    border-radius: var(--tfx-radius-md);
    padding: 12px 14px;
    transition: border-color .3s ease, box-shadow .3s ease, transform .2s ease;
}

.tfx-session-card.session-sydney { --tfx-c: var(--tfx-sydney); }
.tfx-session-card.session-tokyo  { --tfx-c: var(--tfx-tokyo); }
.tfx-session-card.session-london { --tfx-c: var(--tfx-london); }
.tfx-session-card.session-ny     { --tfx-c: var(--tfx-ny); }

.tfx-session-card:has(.tfx-status-pill.is-open) {
    border-top-color: var(--tfx-c);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--tfx-c) 35%, transparent), 0 8px 20px -8px var(--tfx-c);
}

.tfx-session-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tfx-session-flag {
    font-size: 18px;
    line-height: 1;
}

.tfx-session-card-name {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.tfx-session-card-name span {
    font-size: 14px;
    font-weight: 700;
}

.tfx-session-card-name small {
    font-size: 11px;
    color: var(--tfx-text-muted);
    font-weight: 400;
}

.tfx-session-card-time {
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    direction: ltr;
    text-align: right;
    color: var(--tfx-text);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tfx-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--tfx-text-muted);
    border: 1px solid var(--tfx-border);
}

.tfx-status-pill .tfx-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tfx-accent-gray);
}

.tfx-status-pill.is-open {
    background: color-mix(in srgb, var(--tfx-c) 16%, transparent);
    border-color: color-mix(in srgb, var(--tfx-c) 45%, transparent);
    color: var(--tfx-c);
}

.tfx-status-pill.is-open .tfx-status-dot {
    background: var(--tfx-c);
    box-shadow: 0 0 6px var(--tfx-c);
    animation: tfx-pulse 1.6s ease-in-out infinite;
}

/* ---------- Main timeline box ---------- */

.rectangle-box {
    position: relative;
    width: 100%;
    height: 240px;
    background: var(--tfx-bg);
    border: 1px solid var(--tfx-border);
    border-radius: var(--tfx-radius-sm);
    overflow: visible;
    direction: ltr; /* timeline always flows 0h -> 24h left to right */
}

.rectangle-box .section {
    height: 20%;
    position: relative;
    border-bottom: 1px solid var(--tfx-border);
}

.rectangle-box .section:last-child {
    border-bottom: none;
}

.rectangle-box .section:nth-child(odd) {
    background: rgba(255, 255, 255, 0.015);
}

/* ---------- Session bars (color-coded like babypips) ---------- */

.rectangle-box .section .gray-bar {
    position: absolute;
    top: 24%;
    height: 52%;
    border-radius: 6px;
    background: var(--tfx-accent-gray);
    transition: left .4s ease, width .4s ease, background .3s ease, box-shadow .3s ease;
}

.session-bar.session-sydney.is-active { background: linear-gradient(180deg, var(--tfx-sydney), #7e22ce); box-shadow: 0 0 14px rgba(168, 85, 247, .55); }
.session-bar.session-tokyo.is-active  { background: linear-gradient(180deg, var(--tfx-tokyo), #0284c7); box-shadow: 0 0 14px rgba(56, 189, 248, .55); }
.session-bar.session-london.is-active { background: linear-gradient(180deg, var(--tfx-london), #16a34a); box-shadow: 0 0 14px rgba(34, 197, 94, .55); }
.session-bar.session-ny.is-active     { background: linear-gradient(180deg, var(--tfx-ny), #d97706); box-shadow: 0 0 14px rgba(245, 158, 11, .55); }

/* Small row tag (flag + short name) pinned to a corner of each row */

.tfx-row-tag {
    position: absolute;
    top: 6px;
    right: 8px;
    z-index: 10;
    direction: rtl;
    font-size: 11px;
    font-weight: 600;
    color: var(--tfx-text-muted);
    background: rgba(10, 15, 25, 0.55);
    backdrop-filter: blur(2px);
    padding: 2px 8px;
    border-radius: 999px;
    pointer-events: none;
    white-space: nowrap;
}

.tfx-row-tag-vol {
    color: var(--tfx-accent-gold);
}

/* ---------- Now (red) line ---------- */

.rectangle-box .red-line {
    position: absolute;
    top: -6px;
    left: 0;
    width: 2px;
    height: calc(100% + 6px);
    background: linear-gradient(180deg, var(--tfx-accent-red), rgba(239, 68, 68, 0.1));
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
    z-index: 20;
    transition: left 0.3s linear;
}

.rectangle-box .red-line::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tfx-accent-red);
    box-shadow: 0 0 8px var(--tfx-accent-red);
}

.rectangle-box .red-line .time-label {
    position: absolute;
    top: -30px;
    left: 50% !important;
    transform: translateX(-50%);
    background: var(--tfx-accent-red);
    color: #fff;
    padding: 3px 10px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.rectangle-box .red-line .time-label::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--tfx-accent-red);
}

/* ---------- Bottom hour ruler ---------- */

.time-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    margin-top: 10px;
    direction: ltr;
    font-size: 11px;
    color: var(--tfx-text-muted);
    font-variant-numeric: tabular-nums;
}

.time-labels span {
    flex: 1;
    text-align: center;
    position: relative;
}

.time-labels span::before {
    content: '';
    display: block;
    width: 1px;
    height: 6px;
    background: var(--tfx-border);
    margin: 0 auto 4px;
}

/* ---------- Volatility curve ---------- */

.curvy-line {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    opacity: 0.55;
}

.curvy-line-path {
    stroke: var(--tfx-accent-gold);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: transparent;
}

/* ---------- Responsive ---------- */

@media (max-width: 1200px) {
    .time-labels .even {
        display: none;
    }
}

@media (max-width: 860px) {
    .tfx-sessions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .tja-forex-clock {
        padding: 14px;
    }

    .tfx-header-clock {
        font-size: 16px;
    }

    .rectangle-box {
        height: 280px;
    }

    .tfx-row-tag {
        font-size: 10px;
        padding: 2px 6px;
    }

    .tfx-sessions-grid {
        grid-template-columns: 1fr;
    }
}
