/**
 * KARIA — AYRINTI PANELİ STİLLERİ
 *
 * Depo kartları (2D tank, seviye anahtarı işaretleri), ozmoz üniteleri (pompa
 * bloğu, basınç göstergesi, filtre, elle komut) ve sayfa içi bildirim.
 * panel.js'in çizdiği işaretleme için; hem Detay sayfası hem ana ekran yükler.
 * JS'in yazdığı sınıf adları (tile-running, pill ok, tank-fill dolu …) sabittir.
 */

/* Tarayıcı boşluklarını sıfırla — :where ile özgüllük 0, sınıf kuralları hep kazanır */
:where(#panelDetay, #panelDetay *) { margin: 0; padding: 0; }
/* ============================================================
 * BÖLÜM BAŞLIKLARI
 * ========================================================== */
h2.section-title {
    margin: clamp(56px, 8vw, 96px) 0 24px;
    font-size: clamp(1.9rem, 3.6vw, 2.75rem);
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -0.035em;
    color: var(--metin);
}
h2.section-title:first-of-type { margin-top: 8px; }

/* ============================================================
 * DEPO PANELİ
 * ========================================================== */
.depo-scope-card {
    border-radius: var(--r-buyuk);
    padding: clamp(20px, 3vw, 32px);
}
.depo-scope-head {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-bottom: 14px;
}
.depo-teshis { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.depo-teshis:not(:has(> :not([style*="display:none"]):not([style*="display: none"]))) { display: none; }

.sensor-uyari {
    margin: 0 0 14px; padding: 12px 16px; border-radius: 14px;
    background: rgba(255, 69, 58, 0.12);
    color: #ff9f99;
    font-size: 0.86rem; font-weight: 500; line-height: 1.5;
}

.depot-status-chip-wrap {
    padding: 7px 14px 7px 12px; border-radius: 980px;
    background: var(--yuzey-2);
}
.status-dot {
    width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; flex: 0 0 auto;
    background-color: var(--kirmizi); display: inline-block;
}
.status-row { display: flex; align-items: center; font-weight: 500; font-size: 0.8rem; color: var(--metin-2); }
.status-row.status-online .status-dot { background-color: var(--yesil); box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.5); animation: pulse 2.4s infinite; }
.status-row.status-online .status-text { color: var(--metin); }
.status-row.status-offline .status-text { color: #ff9f99; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.45); }
    70% { box-shadow: 0 0 0 7px rgba(48, 209, 88, 0); }
    100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0); }
}

.grid-container {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px;
    margin-top: 6px;
}

/* --- Tek depo kartı --- */
.depo-mini-card {
    border-radius: 22px;
    padding: 18px 18px 20px;
    background: var(--yuzey-2);
    display: flex; flex-direction: column; align-items: center;
    position: relative;
    scroll-margin-top: calc(var(--nav-h) + 24px);
}
/* Sahnedeki etikete dokununca gelinen kart kısa bir an belirsin */
.depo-mini-card.vurgu { animation: vurgu 1.8s var(--yumusak); }
/* Ana ekrandaki ünite satırından gelinince aynı vurgu */
.ozmoz-tile { scroll-margin-top: calc(var(--nav-h) + 24px); }
.ozmoz-tile.vurgu { animation: vurgu 1.8s var(--yumusak); }
@keyframes vurgu {
    0%, 30% { box-shadow: 0 0 0 2px var(--su), 0 0 40px rgba(76, 195, 245, 0.25); }
    100% { box-shadow: 0 0 0 2px transparent, 0 0 40px transparent; }
}

.inlet-pipe-flow {
    align-self: stretch;
    height: 26px;
    border-radius: 980px;
    margin-bottom: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 500;
    color: var(--metin-3);
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden; position: relative;
    transition: color 0.4s, background-color 0.4s;
}
.depo-mini-card.active-filling .inlet-pipe-flow {
    color: #aee6ff;
    background: rgba(76, 195, 245, 0.12);
}
.depo-mini-card.active-filling .inlet-pipe-flow::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(76, 195, 245, 0.28), transparent);
    background-size: 200% 100%;
    animation: waterFlowing 1.6s linear infinite;
}
@keyframes waterFlowing { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.depo-mini-card h3 {
    font-size: 1.02rem; font-weight: 600; letter-spacing: -0.02em;
    margin-bottom: 14px; text-align: center;
}

/* Cam tank (2D): ince alüminyum ağız, cam gövde, içte su */
.tank-silo { position: relative; width: 112px; height: 184px; margin-bottom: 12px; }
.tank-cap {
    position: absolute; top: 0; left: -2px; right: -2px; height: 8px; z-index: 5;
    border-radius: 50%;
    background: linear-gradient(180deg, #e6e6ea, #7c7c82);
}
.tank-body {
    position: absolute; top: 4px; left: 0; width: 100%; height: 178px;
    border-radius: 0 0 18px 18px;
    border: 1px solid rgba(255, 255, 255, 0.16); border-top: none;
    background: linear-gradient(90deg,
        rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.015) 22%,
        rgba(255,255,255,0.02) 70%, rgba(255,255,255,0.09) 100%);
    overflow: hidden;
}
.tank-fill {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 0%;
    transition: height 1.2s var(--yay);
}
/* Seviye yüksekliği zaten söylüyor; renk yalnız düşük seviyeyi işaretler */
.tank-fill.dolu, .tank-fill.yari-dolu {
    background: linear-gradient(0deg, #0b3f8c 0%, #1f7fd6 55%, #5fd0ff 100%);
}
.tank-fill.yari-dolu { filter: saturate(0.85); }
.tank-fill.bos { background: linear-gradient(0deg, #6b1410 0%, #c9302a 60%, #ff6b61 100%); }
.tank-fill::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: rgba(255, 255, 255, 0.55);
}

/* ===== Tank üzerinde seviye anahtarı işaretleri ===== */
/* Etiket HER ZAMAN koyu zeminde: ıslakta yazı/çerçeve yeşil yanar, zemin koyu kalır */
.anahtar-katman { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.anahtar-isaret {
    position: absolute; left: 0; width: 100%; height: 0;
    border-top: 1.5px dashed rgba(255, 255, 255, 0.4);
    filter: drop-shadow(0 1px 0 rgba(0,0,0,0.65));
    transition: border-color .4s ease;
}
.anahtar-isaret .anahtar-etiket {
    position: absolute; left: 4px; top: -9px;
    font-size: 0.56rem; font-weight: 600;
    padding: 1px 6px; border-radius: 8px; white-space: nowrap;
    background: rgba(0, 0, 0, 0.85);
    color: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    transition: color .4s ease, border-color .4s ease, box-shadow .4s ease;
}
.anahtar-isaret.ust .anahtar-etiket { top: 3px; }
.anahtar-isaret.islak { border-top-color: var(--yesil); border-top-style: solid; }
.anahtar-isaret.islak .anahtar-etiket { color: #7ee89a; border-color: var(--yesil); box-shadow: 0 0 8px rgba(48, 209, 88, 0.45); }
.anahtar-isaret.kuru { border-top-color: rgba(255,255,255,0.3); }
.anahtar-isaret.bayat { border-top-color: rgba(110,110,115,0.35); opacity: .45; }

.hedef-anahtar {
    display: inline-block; margin-left: 3px; padding: 0 6px;
    font-size: 0.64rem; font-weight: 600;
    border-radius: 7px; border: 1px solid transparent; vertical-align: 1px;
}
.hedef-anahtar.islak { color: #7ee89a; border-color: rgba(48, 209, 88, 0.6); background: rgba(48, 209, 88, 0.12); }
.hedef-anahtar.kuru { color: rgba(255,255,255,0.6); border-color: rgba(255,255,255,0.22); }
.hedef-anahtar.bayat { color: var(--metin-3); border-color: rgba(110,110,115,0.3); }

.tank-gloss {
    position: absolute; top: 0; left: 12px; width: 10px; height: 100%; z-index: 3; pointer-events: none;
    background: linear-gradient(90deg, rgba(255,255,255,0.22), transparent);
    border-radius: 6px;
}
.tank-scale {
    position: absolute; right: 9px; top: 12px; height: 86%; width: 4px; z-index: 2;
    background: repeating-linear-gradient(180deg, rgba(255,255,255,0.22) 0 1px, transparent 1px 10%);
}
.level-text {
    position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%); z-index: 4;
    font-size: 1.55rem; font-weight: 700; letter-spacing: -0.03em; color: #fff;
    text-shadow: 0 2px 14px rgba(0,0,0,0.75);
}
.depo-caption { font-size: 0.84rem; font-weight: 500; color: var(--metin-2); margin-top: 2px; }

/* Telefonda depolar iki sütun: dört kart alt alta bir ekrandan uzun sürüyordu */
@media (max-width: 560px) {
    .depo-scope-card { padding: 16px; }
    .grid-container { grid-template-columns: 1fr 1fr; gap: 10px; }
    .depo-mini-card { padding: 12px 10px 14px; border-radius: 18px; }
    .inlet-pipe-flow { font-size: 0.64rem; height: 22px; margin-bottom: 12px; padding: 0 6px; text-align: center; line-height: 1.1; }
    .depo-mini-card h3 { font-size: 0.9rem; margin-bottom: 10px; }
    .tank-silo { width: 84px; height: 144px; }
    .tank-body { height: 138px; border-radius: 0 0 14px 14px; }
    .level-text { font-size: 1.2rem; }
    .depo-caption { font-size: 0.76rem; }
}

/* ============================================================
 * OZMOZ ÜNİTELERİ
 * Durum, kartın tepesinden yayılan renkli bir ışıkla ve hap ile okunur.
 * Nabız yalnız dikkat isteyen hallerde (alarm, siren) var.
 * ========================================================== */
.ozmoz-dashboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.ozmoz-tile {
    --durum: transparent;
    position: relative;
    border-radius: var(--r-buyuk);
    padding: 24px;
    background:
        radial-gradient(120% 55% at 50% -8%, var(--durum), transparent 62%),
        var(--yuzey);
    border: 1px solid var(--cizgi);
    display: flex; flex-direction: column; gap: 14px;
    overflow: hidden;
    transition: border-color 0.4s var(--yumusak);
}

.ozmoz-tile.offline-tile { --durum: transparent; }
.ozmoz-tile.offline-tile .ozmoz-tile-header strong { color: var(--metin-2); }
.ozmoz-tile.online-tile { --durum: rgba(48, 209, 88, 0.10); }
.ozmoz-tile.tile-running { --durum: rgba(76, 195, 245, 0.22); border-color: rgba(76, 195, 245, 0.28); }
.ozmoz-tile.tile-manuel-active { --durum: rgba(255, 159, 10, 0.2); border-color: rgba(255, 159, 10, 0.3); }
.ozmoz-tile.tile-warn { --durum: rgba(255, 159, 10, 0.14); border-color: rgba(255, 159, 10, 0.25); }
.ozmoz-tile.tile-updating { --durum: rgba(47, 143, 255, 0.16); }
.ozmoz-tile.tile-alarm { --durum: rgba(255, 69, 58, 0.24); border-color: rgba(255, 69, 58, 0.45); animation: alarmPulse 2.6s infinite alternate; }
/* Kalkış uyarısı sireni — hızlı ritim, "birazdan kalkıyor" demek */
.ozmoz-tile.tile-siren { --durum: rgba(255, 69, 58, 0.3); border-color: rgba(255, 69, 58, 0.6); animation: sirenPulse 0.9s infinite alternate; }

@keyframes alarmPulse { 0% { box-shadow: 0 0 0 0 transparent; } 100% { box-shadow: 0 0 36px -6px rgba(255, 69, 58, 0.35); border-color: rgba(255, 69, 58, 0.7); } }
@keyframes sirenPulse { 0% { box-shadow: 0 0 0 0 transparent; border-color: rgba(255, 69, 58, 0.35); } 100% { box-shadow: 0 0 40px -4px rgba(255, 69, 58, 0.45); border-color: rgba(255, 69, 58, 0.95); } }
@media (prefers-reduced-motion: reduce) { .ozmoz-tile.tile-siren, .ozmoz-tile.tile-alarm { animation: none; border-color: rgba(255, 69, 58, 0.9); } }

.ozmoz-tile-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ozmoz-tile-header strong { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.035em; display: block; line-height: 1.1; margin-bottom: 8px; }
.ozmoz-target-depot, .ozmoz-source-depot {
    display: inline-block; margin-top: 4px;
    font-size: 0.76rem; font-weight: 500; line-height: 1.45;
    padding: 3px 10px; border-radius: 9px;
}
.ozmoz-target-depot { color: #aee6ff; background: rgba(76, 195, 245, 0.1); }
.ozmoz-source-depot { color: #9ef0b2; background: rgba(48, 209, 88, 0.1); }
.ozmoz-source-depot.kaynak-dusuk { color: #ff9f99; background: rgba(255, 69, 58, 0.14); }

.pill {
    flex: 0 0 auto;
    font-size: 0.74rem; font-weight: 600; letter-spacing: -0.005em;
    padding: 5px 11px; border-radius: 980px; white-space: nowrap;
}
.pill.ok { background: rgba(48, 209, 88, 0.14); color: #5fe07f; }
.pill.running { background: rgba(76, 195, 245, 0.16); color: #7fd6fa; }
.pill.manuel-mode { background: rgba(255, 159, 10, 0.16); color: #ffb340; }
.pill.no { background: rgba(255, 69, 58, 0.16); color: #ff7b72; }

.ozmoz-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: var(--yuzey-2); padding: 12px; border-radius: 14px; }
.ozmoz-row .kv span { display: block; font-size: 0.72rem; font-weight: 500; color: var(--metin-2); margin-bottom: 2px; }
.ozmoz-row .kv strong { font-size: 0.86rem; color: var(--metin); }

/**
 * POMPA BLOĞU — tek sütun. Kartın komutu ile sahanın cevabı başlıkla
 * ayrılıyor; asıl bilgi ikisinin uyuşup uyuşmadığında.
 */
.pompa-blok {
    background: var(--yuzey-2);
    border-radius: 16px; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 6px;
}
.pompa-grup-baslik {
    font-size: 0.72rem; font-weight: 600;
    color: var(--metin-3);
    display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.pompa-grup-baslik::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--cizgi); }
.pompa-grup-baslik:not(:first-child) { margin-top: 6px; }

.pompa-sat { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pompa-sat .ad { font-size: 0.82rem; color: var(--metin-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pompa-sat .deg { margin-left: auto; font-size: 0.82rem; font-weight: 600; color: var(--metin); white-space: nowrap; padding-left: 8px; }

/** Lamba: dolu = çalışıyor, halka = duruyor, gri = bilinmiyor */
.pompa-lamba { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; border: 1.5px solid rgba(255,255,255,0.28); background: transparent; }
.pompa-lamba.acik { background: var(--yesil); border-color: var(--yesil); box-shadow: 0 0 8px rgba(48, 209, 88, 0.6); }
.pompa-lamba.manuel { background: var(--turuncu); border-color: var(--turuncu); box-shadow: 0 0 8px rgba(255, 159, 10, 0.6); }
.pompa-lamba.bilinmiyor { border-color: rgba(110,110,115,0.45); }

.pompa-uyum { font-size: 0.76rem; font-weight: 500; line-height: 1.45; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--cizgi); }
.pompa-uyum.tamam  { color: #5fe07f; }
.pompa-uyum.uyari  { color: #ffb340; }
.pompa-uyum.hata   { color: #ff7b72; }
.pompa-uyum.sessiz { color: var(--metin-3); }

.status-active-text { color: #7fd6fa !important; }
.status-manuel-text { color: #ffb340 !important; }

.ozmoz-mode {
    display: inline-block;
    font-size: 0.86rem; font-weight: 600; color: var(--metin);
    padding: 6px 12px; border-radius: 10px;
    background: rgba(255,255,255,0.06);
}
.tile-running .ozmoz-mode { background: rgba(76, 195, 245, 0.12); color: #bfeaff; }
.tile-manuel-active .ozmoz-mode, .tile-warn .ozmoz-mode { background: rgba(255, 159, 10, 0.12); color: #ffd08a; }
.tile-alarm .ozmoz-mode, .tile-siren .ozmoz-mode { background: rgba(255, 69, 58, 0.16); color: #ffb3ad; }
.tile-updating .ozmoz-mode { background: rgba(47, 143, 255, 0.14); color: #b3d4ff; }

.ozmoz-sub { position: relative; font-size: 0.8rem; color: var(--metin-2); line-height: 1.45; padding-left: 14px; }
/* Boş satır (ör. fiziksel limit tanımlı değil) sahipsiz bir nokta bırakmasın */
.ozmoz-sub:empty { display: none; }
.ozmoz-sub::before {
    content: ""; position: absolute; left: 2px; top: 0.6em;
    width: 5px; height: 5px; border-radius: 50%; background: var(--metin-3);
}
.tile-running .ozmoz-sub::before { background: var(--su); }
.tile-manuel-active .ozmoz-sub::before { background: var(--turuncu); }
.ozmoz-sub.ota-hata { color: #ffb340; }
.ozmoz-sub.ota-hata::before { background: var(--turuncu); }
.ozmoz-sub.ota-tamam { color: #5fe07f; }
.ozmoz-sub.ota-tamam::before { background: var(--yesil); }

/* Elle pompa komutu — yalnız panel yetkisi olana ve otomasyon kapalıyken */
.ozmoz-komut { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; padding-top: 14px; border-top: 1px solid var(--cizgi); }
.oz-cmd-btn {
    flex: 1 1 0; min-width: 100px; padding: 11px 16px;
    border: none; border-radius: 980px;
    font-family: inherit; font-size: 0.88rem; font-weight: 600; letter-spacing: -0.01em;
    cursor: pointer;
    transition: background-color .2s var(--yumusak), transform .2s var(--yumusak), opacity .2s;
}
.oz-cmd-btn:active:not(:disabled) { transform: scale(0.97); }
.oz-cmd-btn:disabled { opacity: .3; cursor: not-allowed; }
.oz-cmd-btn:focus-visible { outline: 2px solid var(--mavi); outline-offset: 2px; }
.oz-cmd-calistir { background: rgba(48, 209, 88, 0.16); color: #5fe07f; }
.oz-cmd-calistir:hover:not(:disabled) { background: rgba(48, 209, 88, 0.26); }
.oz-cmd-durdur { background: rgba(255, 69, 58, 0.16); color: #ff7b72; }
.oz-cmd-durdur:hover:not(:disabled) { background: rgba(255, 69, 58, 0.26); }
.ozmoz-komut-not { flex: 1 1 100%; font-size: 0.74rem; line-height: 1.4; color: var(--metin-3); }

/* Basınç göstergesi */
.vu-container { background: var(--yuzey-2); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.vu-header { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.76rem; font-weight: 500; color: var(--metin-2); }
.vu-header .vu-val { color: var(--metin); font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }
.vu-meter-wrapper { position: relative; height: 10px; display: flex; gap: 3px; }
.vu-bar-segment { flex: 1; height: 100%; background: rgba(255, 255, 255, 0.07); border-radius: 3px; transition: background 0.3s ease; }
.vu-bar-segment.active { background: linear-gradient(180deg, #7fd6fa, #2f8fff); box-shadow: 0 0 6px rgba(76, 195, 245, 0.35); }
.vu-bar-segment.manuel-active { background: linear-gradient(180deg, #ffc56b, #ff9f0a); box-shadow: 0 0 6px rgba(255, 159, 10, 0.35); }
.vu-limit-line { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 2px; background: var(--kirmizi); box-shadow: 0 0 8px var(--kirmizi); z-index: 5; transition: left 0.5s ease; display: none; }
.vu-footer-text { font-size: 0.74rem; color: var(--metin-3); font-weight: 500; }

/* Filtre durumu — basıncın referansa göre nerede olduğu */
.filtre-kutu { background: var(--yuzey-2); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.filtre-ust { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.76rem; font-weight: 500; color: var(--metin-2); }
.filtre-ust .filtre-etiket { font-weight: 600; }
.filtre-cubuk { position: relative; height: 8px; background: rgba(255, 255, 255, 0.07); border-radius: 4px; overflow: hidden; }
.filtre-dolgu { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; transition: width .5s ease, background .5s ease; }
.filtre-alt { font-size: 0.74rem; color: var(--metin-3); font-weight: 500; }
.filtre-iyi     { color: #5fe07f; }
.filtre-normal  { color: #b4e35f; }
.filtre-zayif   { color: #ffd60a; }
.filtre-kotu    { color: #ffb340; }
.filtre-kritik  { color: #ff7b72; }
.filtre-bilinmiyor { color: var(--metin-3); }

/* Bildirim: altta ortada, buzlu cam hap */
.notification-status {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
    max-width: min(92vw, 560px);
    padding: 14px 22px; border-radius: 18px;
    font-size: 0.88rem; font-weight: 500; line-height: 1.45; color: var(--metin);
    display: none; z-index: 1000;
    background: rgba(40, 40, 44, 0.82);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--cizgi);
}
