/* ============================================================
   ArenaPosta Live Traffic — V1 Statik UI Skeleton
   Tema: açık / modern / kurumsal
   ============================================================ */

:root {
    /* Temel renkler */
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-soft: #fafbfc;
    --border: #e5e8ec;
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-soft: #9ca3af;

    /* ArenaPosta kurumsal tonları */
    --brand: #e8590c;
    --brand-dark: #c2410c;
    --brand-soft: #fff1e7;

    /* Giden trafik — turuncu */
    --out-color: #e8590c;
    --out-soft: #fff1e7;
    --out-line: #f5b895;

    /* Gelen trafik — mavi */
    --in-color: #2563eb;
    --in-soft: #eaf1ff;
    --in-line: #8fb4f5;

    /* Durumlar */
    --ok: #16a34a;
    --ok-soft: #e8f7ee;
    --warn: #d97706;
    --warn-soft: #fef3e2;
    --idle-soft: #f1f3f5;

    /* Şekiller */
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
    --shadow-hover: 0 4px 12px rgba(16, 24, 40, .08), 0 12px 32px rgba(16, 24, 40, .09);

    /* Yazı tipi */
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Kör SVG sprite'ı gizle */
.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    stroke: currentColor;
}

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 36px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
}

.brand-mark {
    width: 30px;
    height: 30px;
    color: var(--brand);
}

.brand-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
}

.header-title {
    text-align: center;
    flex: 1;
}

.header-title h1 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text);
}

.header-title p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.system-status {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 220px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ok);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, .15);
}

/* ============================================================
   SAYFA DÜZENİ
   ============================================================ */

.page {
    max-width: 1920px;
    margin: 0 auto;
    padding: 28px 36px 48px;
}

/* ============================================================
   ANA TRAFİK SAHNESİ
   ============================================================ */

.traffic-stage {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.flow-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 20px 24px 18px;
    overflow: hidden;
}

.flow-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.flow-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flow-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--out-color);
    box-shadow: 0 0 0 4px var(--out-soft);
}

.flow-panel-in .flow-dot {
    background: var(--in-color);
    box-shadow: 0 0 0 4px var(--in-soft);
}

.flow-title h2 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .03em;
}

.flow-note {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: .02em;
}

/* ---- Trafik yolu + istasyonlar ---- */

.flow {
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
}

.flow-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* pasif/yardımcı hatlar — çok düşük opacity */
.track-aux {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    opacity: .12;
}

.track-aux.dash {
    stroke-dasharray: 4 10;
    opacity: .09;
}

.flow-panel-out .track-aux { color: var(--out-color); }
.flow-panel-in  .track-aux { color: var(--in-color); }

/* ana akış hatları */
.flow-path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    opacity: .42;
}

.flow-panel-out .flow-path { color: var(--out-color); }
.flow-panel-in  .flow-path { color: var(--in-color); }

/* yön okları */
.flow-arrow {
    fill: currentColor;
    opacity: .5;
}

.flow-panel-out .flow-arrow { color: var(--out-color); }
.flow-panel-in  .flow-arrow { color: var(--in-color); }

/* ---- İstasyon kartları ---- */

.station {
    position: absolute;
    left: var(--x);
    top: 50%;
    transform: translate(-50%, -50%);
    width: 158px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 10px 10px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    transition: box-shadow .2s ease, border-color .2s ease;
    z-index: 2;
}

.station:hover {
    box-shadow: var(--shadow-hover);
    border-color: #d1d5db;
}

.station-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    margin-bottom: 6px;
}

.station-icon .icon {
    width: 19px;
    height: 19px;
}

/* Giden — turuncu vurgu */
.flow-panel-out .station-icon {
    background: var(--out-soft);
    color: var(--out-color);
}

/* Gelen — mavi vurgu */
.flow-panel-in .station-icon {
    background: var(--in-soft);
    color: var(--in-color);
}

.station-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1px;
}

.station-meta {
    font-size: 11px;
    color: var(--text-soft);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.station-status {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--idle-soft);
    color: var(--text-muted);
    white-space: nowrap;
}

/* Tamamlanmış istasyon (demo giden akış) */
.station-done .station-status {
    background: var(--ok-soft);
    color: var(--ok);
}

.station-done .station-icon {
    background: var(--ok-soft);
    color: var(--ok);
}

/* ---- Demo sonuç şeridi ---- */

.demo-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    background: var(--ok-soft);
    border: 1px solid #cbe9d5;
    color: var(--ok);
}

.demo-result .icon-ok {
    width: 24px;
    height: 24px;
}

.demo-result strong {
    font-size: 14px;
    font-weight: 700;
}

.demo-result .demo-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    font-size: 12.5px;
    color: #15803d;
}

.demo-result .demo-time .icon {
    width: 15px;
    height: 15px;
}

/* ============================================================
   ALT İSTATİSTİK ALANI
   ============================================================ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 16px;
    text-align: center;
    box-shadow: var(--shadow-card);
    transition: box-shadow .2s ease, border-color .2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: #d1d5db;
}

.stat-value {
    display: block;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--text);
    margin-bottom: 4px;
}

.stat-card:nth-child(4) .stat-value { color: var(--warn); }
.stat-card:nth-child(5) .stat-value { color: #dc2626; }
.stat-card:nth-child(6) .stat-value { color: var(--ok); }

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .02em;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1440px) {
    .station { width: 146px; }
}

@media (max-width: 1180px) {
    .stats-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .page { padding: 20px 16px 32px; }
    .site-header { padding: 14px 16px; }
    .brand { min-width: auto; }
    .system-status { min-width: auto; }

    /* İstasyonlar dar ekranlarda dikey sıralanır,
       trafik yolu mobil için sonraki aşamada ayrıntılandırılacak */
    .flow { min-height: auto; flex-direction: column; gap: 10px; padding: 8px 0 4px; }
    .station { position: static; transform: none; width: 100%; max-width: 340px; }
    .flow-svg { display: none; }
    .flow-note { display: none; }
}

@media (max-width: 560px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .header-title h1 { font-size: 14px; letter-spacing: .04em; }
    .demo-result { flex-direction: column; text-align: center; gap: 6px; }
    .demo-result .demo-time { margin-left: 0; }
}

/* ============================================================
   V1.1 GİDEN E-POSTA YOLCULUĞU ANİMASYONU
   (Mevcut tasarım korunur; yalnızca eklemeler)
   ============================================================ */

/* ----- Demo sonuç şeridi: başlangıçta gizli ----- */

.demo-result.is-hidden {
    display: none;
}

.demo-result.is-revealed {
    animation: demo-reveal .4s ease-out both;
}

@keyframes demo-reveal {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ----- İdle durumda nötr istasyon görünümü -----
   (Mevcut .flow-panel-out .station-icon turuncu kuralını dengeler) */

.station-idle .station-icon {
    background: var(--idle-soft);
    color: var(--text-muted);
}

.station-idle .station-status {
    background: var(--idle-soft);
    color: var(--text-muted);
}

/* ----- Mail paketi ----- */

.packet {
    position: absolute;
    left: 5%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--out-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(232, 89, 12, .35), 0 0 0 0 rgba(232, 89, 12, .25);
    opacity: 0;
    z-index: 5;
    pointer-events: none;
    will-change: left, top, opacity;
}

.packet .icon {
    width: 18px;
    height: 18px;
}

.packet.is-visible {
    opacity: 1;
}

.packet.is-arriving {
    animation: packet-arrive .35s ease-out;
}

.packet.is-departing {
    animation: packet-depart .3s ease-in;
}

.packet.is-spawning {
    animation: packet-spawn .45s ease-out both;
}

.packet.is-vanishing {
    animation: packet-vanish .45s ease-in both;
}

.packet.is-fast {
    box-shadow: 0 2px 12px rgba(232, 89, 12, .5), 0 0 16px 2px rgba(232, 89, 12, .2);
}

@keyframes packet-spawn {
    0% {
        transform: translate(-50%, -50%) scale(.3);
        opacity: 0;
    }
    60% {
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes packet-arrive {
    0% {
        transform: translate(-50%, -50%) scale(1.25);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes packet-depart {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1.08);
    }
}

@keyframes packet-vanish {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(.5);
        opacity: 0;
    }
}

/* Hafif trail efekti — paketin arkasında kısa süreli parıltı */
.packet::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(232, 89, 12, .35);
    opacity: 0;
    z-index: -1;
}

.packet.is-traveling::after {
    animation: packet-trail .55s ease-out infinite;
}

@keyframes packet-trail {
    0% {
        transform: scale(1.1);
        opacity: .55;
    }
    100% {
        transform: scale(1.9);
        opacity: 0;
    }
}

/* ----- Path highlight (aktif segment) ----- */

.flow-path {
    transition: opacity .25s ease, stroke-width .25s ease, filter .25s ease;
}

.flow-path--active {
    opacity: .92;
    stroke-width: 3.5;
    filter: drop-shadow(0 0 5px rgba(232, 89, 12, .35));
}

.flow-path--passed {
    opacity: .65;
    stroke-width: 2.75;
}

/* ----- İstasyon durumları ----- */

.station {
    transition: border-color .3s ease, box-shadow .3s ease, transform .3s ease;
}

.station-icon {
    transition: background-color .3s ease, color .3s ease, transform .3s ease;
}

.station-status {
    transition: background-color .3s ease, color .3s ease;
}

/* Aktif: paket istasyonda işleniyor */
.station-active {
    border-color: var(--out-color);
    box-shadow: 0 0 0 3px rgba(232, 89, 12, .12), var(--shadow-card);
    transform: translate(-50%, -50%) translateY(-2px);
}

.station-active .station-icon {
    background: var(--out-soft);
    color: var(--out-color);
    transform: scale(1.08);
}

/* İşleniyor: mikro animasyon */
.station-processing .station-icon {
    animation: station-pulse 1s ease-in-out infinite;
}

.station-processing .station-status {
    background: var(--out-soft);
    color: var(--out-color);
}

@keyframes station-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.14);
    }
}

/* Başarılı (success) — mevcut .station-done görünümüne eşlenir */
.station-success {
    border-color: #cbe9d5;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .1), var(--shadow-card);
}

.station-success .station-status {
    background: var(--ok-soft);
    color: var(--ok);
}

.station-success .station-icon {
    background: var(--ok-soft);
    color: var(--ok);
}

/* ----- Gönderen istasyonu hazırlık efekti ----- */

.station-sending {
    border-color: var(--out-color);
    box-shadow: 0 0 0 3px rgba(232, 89, 12, .15), var(--shadow-card);
}

.station-sending .station-icon {
    background: var(--out-soft);
    color: var(--out-color);
    animation: station-send 1.1s ease-in-out infinite;
}

@keyframes station-send {
    0%, 100% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.12);
    }
    70% {
        transform: scale(.98);
    }
}

/* ============================================================
   V1.2 GELEN E-POSTA YOLCULUĞU ANİMASYONU
   (Aynı TrafficEngine kullanılır; yalnızca mavi varyantlar)
   ============================================================ */

/* ----- Gelen paket: mavi ----- */

.flow-panel-in .packet {
    background: var(--in-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .35), 0 0 0 0 rgba(37, 99, 235, .25);
}

.flow-panel-in .packet.is-fast {
    box-shadow: 0 2px 12px rgba(37, 99, 235, .5), 0 0 16px 2px rgba(37, 99, 235, .2);
}

.flow-panel-in .packet::after {
    background: rgba(37, 99, 235, .35);
}

/* ----- Gelen path highlight: mavi ----- */

.flow-panel-in .flow-path--active {
    filter: drop-shadow(0 0 5px rgba(37, 99, 235, .35));
}

/* ----- Gelen aktif istasyon: mavi ----- */

.flow-panel-in .station-active {
    border-color: var(--in-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12), var(--shadow-card);
}

.flow-panel-in .station-active .station-icon {
    background: var(--in-soft);
    color: var(--in-color);
}

/* ----- Gelen işleniyor: mavi ----- */

.flow-panel-in .station-processing .station-icon {
    background: var(--in-soft);
    color: var(--in-color);
}

.flow-panel-in .station-processing .station-status {
    background: var(--in-soft);
    color: var(--in-color);
}

/* ----- Gelen gönderen hazırlık efekti: mavi ----- */

.flow-panel-in .station-sending {
    border-color: var(--in-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15), var(--shadow-card);
}

.flow-panel-in .station-sending .station-icon {
    background: var(--in-soft);
    color: var(--in-color);
}
