/* STN Finans — kurumsal gri tema (Bootstrap 5 üzerine).
   Python theme.py'deki grafit/monokrom palet buraya uyarlandı. */

:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --border: #e4e7ec;
    --text: #191c22;
    --muted: #667085;
    --ink: #14171c;
    --ink-hover: #2c313b;
    --pos: #16794c;
    --neg: #b4321e;
    --warn: #b7791f;
    --info: #3b6fb0;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --sidebar-w: 248px;
}

* {
    font-variant-numeric: tabular-nums;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

.num {
    font-feature-settings: "tnum" 1;
}

/* ===== Yerleşim ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.app-main {
    flex: 1;
    min-width: 0;
    padding: 1.5rem 2rem 3rem;
    max-width: 1400px;
}

.app-brand {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.05rem;
}

.app-brand small {
    display: block;
    font-weight: 500;
    color: var(--muted);
    font-size: .72rem;
    letter-spacing: .02em;
    text-transform: uppercase;
}

/* ===== Sidebar navigasyon ===== */
.nav-section {
    padding: .9rem 1.25rem .3rem;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav-link-stn {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: .875rem;
    border-left: 3px solid transparent;
}

.nav-link-stn i {
    width: 18px;
    text-align: center;
    color: var(--muted);
}

.nav-link-stn:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.nav-link-stn.active {
    background: var(--surface-2);
    border-left-color: var(--ink);
    color: var(--ink);
    font-weight: 600;
}

.nav-link-stn.active i {
    color: var(--ink);
}

.sidebar-widget {
    margin: auto 0 0;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: .8rem;
}

.sidebar-widget .rate-row {
    display: flex;
    justify-content: space-between;
    padding: .15rem 0;
    color: var(--muted);
}

.sidebar-widget .rate-row b {
    color: var(--text);
}

/* ===== Kartlar ===== */
.stn-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--ink);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    height: 100%;
}

.metric-title {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
}

.metric-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.metric-change {
    font-size: 12.5px;
    margin-top: 3px;
    color: var(--muted);
}

.metric-change.positive { color: var(--pos); }
.metric-change.negative { color: var(--neg); }
.text-pos { color: var(--pos) !important; }
.text-neg { color: var(--neg) !important; }
.text-warn { color: var(--warn) !important; }

/* ===== Başlık ===== */
.page-head h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.page-head .subtitle {
    color: var(--muted);
    font-size: .85rem;
}

/* ===== Butonlar (Bootstrap üstüne grafit birincil) ===== */
.btn-ink {
    background: var(--ink);
    color: #fff;
    border: 1px solid var(--ink);
}

.btn-ink:hover {
    background: var(--ink-hover);
    color: #fff;
    border-color: var(--ink-hover);
}

/* ===== Tablolar ===== */
.stn-table {
    width: 100%;
    font-size: .85rem;
}

.stn-table thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    padding: .5rem .6rem;
}

.stn-table tbody td {
    padding: .5rem .6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.stn-table tbody tr:hover {
    background: var(--surface-2);
}

/* Durum rozetleri */
.badge-soft {
    font-weight: 600;
    font-size: .72rem;
    padding: .25em .6em;
    border-radius: 6px;
}
.badge-pos { background: rgba(22, 121, 76, .12); color: var(--pos); }
.badge-neg { background: rgba(180, 50, 30, .12); color: var(--neg); }
.badge-warn { background: rgba(183, 121, 31, .14); color: var(--warn); }
.badge-muted { background: rgba(102, 112, 133, .12); color: var(--muted); }

/* ===== Mobil üst bar (yalnızca dar ekranlarda görünür) ===== */
.mobile-topbar { display: none; }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, .45);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.sidebar-backdrop.open {
    opacity: 1;
    visibility: visible;
}

/* Sidebar'daki kapatma düğmesi: yalnızca mobil çekmecede görünür */
.sidebar-close {
    display: none;
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1;
    padding: .25rem .4rem;
    cursor: pointer;
}

/* ===== Duyarlılık ===== */
@media (max-width: 900px) {
    /* Üst bar */
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: .75rem;
        position: sticky;
        top: 0;
        z-index: 1030;
        margin: -1rem -1rem 1rem;
        padding: .55rem .85rem;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
    }

    .mobile-topbar .menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface);
        color: var(--text);
        font-size: 1.15rem;
        cursor: pointer;
    }

    .mobile-topbar .menu-btn:active { background: var(--surface-2); }

    .mobile-topbar .mt-brand {
        font-weight: 700;
        letter-spacing: -0.02em;
        font-size: 1rem;
    }

    .mobile-topbar .mt-brand small {
        display: block;
        font-weight: 500;
        color: var(--muted);
        font-size: .62rem;
        letter-spacing: .04em;
        text-transform: uppercase;
    }

    /* Sidebar: dıştan içe kayan çekmece */
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        width: 82vw;
        max-width: 320px;
        min-width: 0;
        z-index: 1045;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 0 0 40px rgba(16, 24, 40, .25);
    }

    .app-sidebar.open { transform: translateX(0); }

    .sidebar-close { display: block; }

    .app-brand {
        display: flex;
        align-items: center;
    }

    .app-main {
        padding: 1rem;
        max-width: 100%;
    }

    /* Sayfa başlıkları taşmasın */
    .page-head {
        flex-wrap: wrap;
        gap: .5rem;
    }

    .page-head h1 { font-size: 1.25rem; }

    /* Tablolar: yatay kaydırma (sütun hizası korunur) */
    .stn-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .stn-table thead,
    .stn-table tbody { white-space: nowrap; }

    /* Livewire ile elle kurulan modal'lar taşmasın */
    .modal.d-block .modal-dialog {
        margin: .5rem;
    }

    .modal.d-block .modal-content {
        max-height: calc(100dvh - 1rem);
        overflow-y: auto;
    }
}
