/* =========================================================
   WABA Panel — Shared Design System
   Tek aksan (marka yeşili/teal), nötr palet, token tabanlı
   radius/gölge/tipografi. Tüm sayfalar bu dosyayı paylaşır.
   ========================================================= */

:root {
    /* Brand accent — THE only accent color in the product */
    --brand: #16a34a;
    --brand-deep: #0f766e;
    --brand-grad: linear-gradient(135deg, #16a34a, #0f766e);
    --brand-soft-bg: #ecfdf3;
    --brand-soft-border: #bcefd0;
    --brand-ring: rgba(22, 163, 74, 0.14);

    /* Neutrals — canonicalized from the inbox palette */
    --ink: #172033;
    --muted: #64748b;
    --faint: #94a3b8;
    --line: #e8edf3;
    --line-soft: #edf1f5;
    --bg: #f7f9fb;
    --surface: #ffffff;

    /* Status — soft, single-tone tints (no solid color blocks) */
    --ok: #16a34a;
    --ok-bg: #ecfdf3;
    --ok-border: #bcefd0;
    --warn: #d97706;
    --warn-bg: #fffbeb;
    --warn-border: #fde9c0;
    --bad: #dc2626;
    --bad-bg: #fef2f2;
    --bad-border: #fecaca;
    --info: #0f766e;
    --info-bg: #ecfdf6;
    --info-border: #bfe8e0;

    /* Radius scale — pick from these three only */
    --r1: 12px;
    --r2: 16px;
    --r3: 22px;

    /* Shadows — tinted to background hue, never neon */
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
    --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.06);

    /* Typography */
    --font-sans: 'Geist', 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* =====================================================
   Base
   ===================================================== */
body {
    background-color: var(--bg);
    font-family: var(--font-sans);
    color: var(--ink);
}

code, .mono { font-family: var(--font-mono); }

a { color: var(--brand-deep); }
a:hover { color: var(--brand); }

/* =====================================================
   Surface — the single card primitive
   ===================================================== */
.surface {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r1);
    box-shadow: var(--shadow-sm);
}

.surface-lg {
    border-radius: var(--r2);
    box-shadow: var(--shadow);
}

/* =====================================================
   Buttons — single brand accent + tactile feedback
   ===================================================== */
.btn-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: var(--r1);
    padding: 10px 20px;
    font-weight: 700;
    color: #fff;
    background: var(--brand-grad);
    box-shadow: 0 10px 22px rgba(22, 163, 74, 0.22);
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn-brand:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 14px 28px rgba(22, 163, 74, 0.28); }
.btn-brand:active { transform: translateY(1px) scale(0.98); box-shadow: 0 6px 14px rgba(22, 163, 74, 0.22); }
.btn-brand:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--r1);
    padding: 9px 18px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface);
    transition: color .15s ease, background .15s ease, border-color .15s ease, transform .15s ease;
}
.btn-ghost:hover { color: var(--brand-deep); background: var(--brand-soft-bg); border-color: var(--brand-soft-border); }
.btn-ghost:active { transform: translateY(1px) scale(0.98); }

.btn-danger-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--r1);
    padding: 9px 18px;
    font-weight: 700;
    color: var(--bad);
    background: var(--surface);
    transition: color .15s ease, background .15s ease, border-color .15s ease, transform .15s ease;
}
.btn-danger-ghost:hover { background: var(--bad-bg); border-color: var(--bad-border); }
.btn-danger-ghost:active { transform: translateY(1px) scale(0.98); }

/* =====================================================
   Badges — single soft palette for all status pills
   ===================================================== */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 5px 12px;
    font-weight: 700;
    font-size: .78rem;
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge-soft.is-ok      { background: var(--ok-bg);   color: #0f6b4b; border-color: var(--ok-border); }
.badge-soft.is-warn    { background: var(--warn-bg); color: #92400e; border-color: var(--warn-border); }
.badge-soft.is-bad     { background: var(--bad-bg);  color: #991b1b; border-color: var(--bad-border); }
.badge-soft.is-info    { background: var(--info-bg); color: #0f6b63; border-color: var(--info-border); }
.badge-soft.is-neutral { background: #f1f5f9;        color: var(--muted); border-color: var(--line); }

/* =====================================================
   Metric — replaces generic equal-width stat cards with
   rounded-circle icons. Tinted square icon + breathing type.
   ===================================================== */
.metric-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r2);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.metric {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 24px;
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
}
.metric-row .metric:nth-last-child(-n+999) { border-bottom: 0; }
.metric:last-child,
.metric:nth-child(4n) { border-right: 0; }

.metric-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--r1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    background: var(--brand-soft-bg);
    color: var(--brand-deep);
}
.metric-icon.is-bad  { background: var(--bad-bg);  color: var(--bad); }
.metric-icon.is-warn { background: var(--warn-bg); color: var(--warn); }
.metric-icon.is-info { background: var(--info-bg); color: var(--info); }

.metric-label { color: var(--muted); font-size: .82rem; font-weight: 600; margin: 0 0 2px; }
.metric-value { color: var(--ink); font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }

@media (max-width: 768px) {
    .metric-row { grid-template-columns: 1fr; }
    .metric { border-right: 0; }
}

/* =====================================================
   Data table — quiet rows, no zebra blue headers
   ===================================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table thead th {
    text-align: left;
    font-size: .74rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: transparent;
}
.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #fbfcfe; }

/* =====================================================
   Field — label above input, helper/error slots, brand focus ring
   ===================================================== */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label {
    font-size: .82rem;
    font-weight: 700;
    color: var(--ink);
}
.field .field-input,
.field input,
.field select,
.field textarea {
    height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--r1);
    padding: 0 14px;
    background: var(--surface);
    color: var(--ink);
    font-size: .92rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-ring);
}
.field .field-help { font-size: .78rem; color: var(--muted); }
.field .field-error { font-size: .78rem; color: var(--bad); font-weight: 600; }

/* =====================================================
   Form controls — brand-consistent inputs/selects everywhere
   (kills Bootstrap's default blue focus ring + dropdown highlight)
   ===================================================== */
.form-control,
.form-select,
select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
textarea {
    accent-color: var(--brand);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-ring);
}
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
    accent-color: var(--brand);
}

/* =====================================================
   States — empty / loading / error, used everywhere
   ===================================================== */
.state-empty, .state-loading, .state-error {
    text-align: center;
    color: var(--muted);
    padding: 36px 16px;
}
.state-empty .state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: var(--r2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: var(--brand-soft-bg);
    color: var(--brand-deep);
}
.state-empty h3 { font-weight: 800; color: var(--ink); margin-bottom: 6px; font-size: 1.05rem; }
.state-empty p { margin: 0; color: var(--muted); }
.state-error { color: var(--bad); }
.state-loading i { color: var(--brand-deep); }

/* =====================================================
   Status pill (connection / online indicators)
   ===================================================== */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}
.status-pill.is-ok  { color: #0f6b4b; background: var(--ok-bg); }
.status-pill.is-bad { color: #991b1b; background: var(--bad-bg); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.status-dot.is-bad { background: var(--bad); box-shadow: 0 0 0 4px rgba(220,38,38,0.14); }

/* =====================================================
   Custom themed dropdown (replaces native <select> open list,
   whose highlight color is OS-rendered and cannot be styled
   via CSS/accent-color). Native <select> stays in the DOM
   (hidden) so forms + existing JS .value reads keep working;
   this is a layer drawn on top of it. See ui.js.
   ===================================================== */
.tt-wrap { position: relative; }
.tt-wrap > select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}
.tt-select {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--r1);
    padding: 0 14px;
    background: var(--surface);
    color: var(--ink);
    font-size: .92rem;
    font-family: var(--font-sans);
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
    min-height: 44px;
}
.tt-select .tt-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tt-select .tt-chevron {
    flex-shrink: 0;
    color: var(--faint);
    font-size: .8rem;
    transition: transform .15s ease, color .15s ease;
}
.tt-select:hover { border-color: var(--brand-soft-border); }
.tt-select.is-open,
.tt-select:focus-visible {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-ring);
    outline: none;
}
.tt-select.is-open .tt-chevron { transform: rotate(180deg); color: var(--brand-deep); }

.tt-menu {
    position: absolute;
    z-index: 1060;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r1);
    box-shadow: var(--shadow);
    padding: 6px;
    display: none;
}
.tt-menu.is-open { display: block; }
.tt-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: calc(var(--r1) - 4px);
    color: var(--ink);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 40px;
}
.tt-option:hover,
.tt-option.is-active {
    background: var(--brand-soft-bg);
    color: var(--brand-deep);
}
.tt-option.is-selected {
    font-weight: 700;
    color: var(--brand-deep);
}
.tt-option .tt-check {
    flex-shrink: 0;
    color: var(--brand);
    opacity: 0;
    font-size: .8rem;
}
.tt-option.is-selected .tt-check { opacity: 1; }
.tt-option[aria-disabled="true"] {
    opacity: .5;
    cursor: not-allowed;
}

/* =====================================================
   Bootstrap alert overrides — many pages toggle .alert-success /
   .alert-danger via JS. Recolor to the single soft palette so the
   whole product reads as one system instead of Bootstrap defaults.
   ===================================================== */
.alert {
    border-radius: var(--r1);
    border: 1px solid transparent;
    font-size: .88rem;
    font-weight: 600;
}
.alert-success { background: var(--ok-bg); color: #0f6b4b; border-color: var(--ok-border); }
.alert-danger  { background: var(--bad-bg); color: #991b1b; border-color: var(--bad-border); }
.alert-warning { background: var(--warn-bg); color: #92400e; border-color: var(--warn-border); }
.alert-info    { background: var(--info-bg); color: #0f6b63; border-color: var(--info-border); }

/* =====================================================
   Section heading row — replaces the bootstrap border-bottom h2 row
   ===================================================== */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 0 20px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--line);
}
.page-head h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0;
}
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
