/* Author : SiberMimar "Guray Avci" | Website: www.sibermimar.com.tr */
:root {
    --primary: #163b74;
    --accent: #f4c430;
    --surface: #f5f7fb;
    --text: #111827;
    --panel: #ffffff;
    --panel-soft: #eef3fb;
    --sidebar-bg: linear-gradient(180deg, #102c57 0%, #163b74 48%, #12294f 100%);
    --border: rgba(22, 59, 116, 0.12);
    --shadow: 0 18px 48px rgba(15, 23, 42, 0.09);
    --muted: #64748b;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(22, 59, 116, 0.08), transparent 26%),
        radial-gradient(circle at bottom left, rgba(244, 196, 48, 0.12), transparent 20%),
        var(--surface);
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
    background: #edf2ff;
    color: #0f172a;
    padding: 0.15rem 0.35rem;
    border-radius: 0.4rem;
}

.app-shell, .admin-layout { min-height: 100vh; }
.page-container, .admin-main {
    padding: 2rem;
    max-width: 1480px;
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 2rem;
    align-items: center;
    backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(22, 59, 116, 0.08);
}
.brand {
    font-weight: 900;
    letter-spacing: 0.02em;
    font-size: 1.2rem;
    color: var(--primary);
}
.subbrand, .muted, small { color: var(--muted); }
.topnav, .inline-actions, .cta-row, .chips, .stats-inline, .card-head-actions, .table-actions, .segmented-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.hero-grid, .dashboard-grid, .admin-grid-two, .results-grid, .info-grid, .stats-grid, .benchmark-grid, .metric-grid, .map-management-shell {
    display: grid;
    gap: 1.25rem;
}
.hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(320px, 460px); align-items: start; }
.dashboard-grid { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
.dashboard-grid .full-width { grid-column: 1 / -1; }
.admin-grid-two { grid-template-columns: minmax(340px, 460px) minmax(0, 1fr); }
.results-grid, .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.system-stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.benchmark-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.map-management-shell { grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px); align-items: start; }

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 1.3rem;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    color: var(--text);
}
.card h1, .card h2, .card h3, .card p, .card strong, .card span, .card td, .card th { color: inherit; }
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.sidebar {
    width: 300px;
    padding: 1.5rem;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: #fff;
}
.admin-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.admin-brand { font-size: 1.15rem; color: #fff; }
.sidebar-nav { display: grid; gap: 0.45rem; }
.sidebar-nav a, .topnav a, .link-button {
    color: inherit;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.sidebar-nav a:hover, .topnav a:hover, .link-button:hover {
    transform: translateX(2px);
    opacity: 0.85;
    text-decoration: none;
}
.sidebar-user {
    padding: 0.9rem 1rem;
    background: rgba(255,255,255,0.12);
    border-radius: 0.95rem;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
}

.stack-form, .single-column, .hero-copy, .admin-section, .list-stack { display: grid; gap: 1rem; }
.single-column { padding-top: 4rem; }
.narrow { max-width: 620px; margin: 0 auto; }
label { display: grid; gap: 0.45rem; font-weight: 700; color: var(--text); }
input, select, textarea, button { font: inherit; }
input, select, textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #fff;
    color: #111827;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}
input::placeholder, textarea::placeholder { color: #8b97aa; }
textarea { resize: vertical; min-height: 110px; }
input:focus, select:focus, textarea:focus {
    border-color: rgba(22, 59, 116, 0.45);
    box-shadow: 0 0 0 4px rgba(22, 59, 116, 0.12);
}
option {
    background: #fff;
    color: #111827;
}
input[type="color"] {
    min-height: 52px;
    padding: 0.35rem;
    background: #fff;
}
.btn, .link-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    padding: 0.88rem 1.15rem;
    border-radius: 1rem;
    border: 1px solid transparent;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent), #ffd84d);
    color: #111827;
    font-weight: 800;
    text-decoration: none;
}
.btn:hover, .link-button:hover { text-decoration: none; }
.btn-secondary {
    background: #fff;
    color: var(--primary);
    border-color: rgba(22, 59, 116, 0.16);
}
.btn-danger {
    background: #fff5f5;
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.18);
}
.btn-small {
    padding: 0.58rem 0.9rem;
    font-size: 0.92rem;
    border-radius: 0.85rem;
}
.full-width { width: 100%; }

.alert {
    padding: 0.95rem 1rem;
    margin-bottom: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}
.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: rgba(22, 163, 74, 0.18);
}
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.18);
}

.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 0.9rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    vertical-align: top;
    color: var(--text);
}
th { color: var(--primary); font-size: 0.92rem; }
tr:hover td { background: rgba(22, 59, 116, 0.03); }

.chip {
    padding: 0.5rem 0.78rem;
    background: #fff;
    border-radius: 999px;
    border: 1px solid rgba(22, 59, 116, 0.12);
    color: var(--primary);
    font-weight: 700;
}
.eyebrow {
    display: inline-block;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 900;
}
.map-canvas {
    width: 100%;
    min-height: 470px;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid rgba(22, 59, 116, 0.1);
    background: #dbe7f6;
}
.list-item, .mini-card, .live-address-card, .metric-kpi {
    display: grid;
    gap: 0.32rem;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    background: #fff;
    border: 1px solid rgba(22, 59, 116, 0.1);
    color: var(--text);
}
.list-item strong, .mini-card strong, .live-address-card strong, .metric-kpi strong { color: var(--primary); }
.bordered { border-style: dashed; }
.color-palette { display: flex; gap: 0.4rem; margin: 0.5rem 0; }
.color-box { width: 1.25rem; height: 1.25rem; border-radius: 999px; border: 1px solid rgba(0,0,0,0.12); }
.status-bar {
    padding: 0.88rem 1rem;
    border-radius: 1rem;
    background: #fff9db;
    border: 1px solid rgba(244, 196, 48, 0.28);
    color: #7c5c00;
}
.stat-card {
    display: grid;
    gap: 0.35rem;
    justify-items: start;
}
.stat-card strong { font-size: 2rem; color: var(--primary); }
.inline-form { display: inline; }
.link-button {
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
}
.split-fields { display: grid; gap: 0.85rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compact-form { margin-top: 0.75rem; }
.feature-list { display: grid; gap: 0.5rem; padding-left: 1.2rem; }

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 0.4rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}
.status-pass { background: #ecfdf5; color: #166534; }
.status-warn { background: #fff7ed; color: #9a3412; }
.status-fail { background: #fef2f2; color: #991b1b; }

.metric-kpi strong { font-size: 1.35rem; }
.metric-kpi span { color: var(--muted); }
.live-address-card { background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%); }
.map-hint { background: #f8fbff; }
.segments-placeholder { display:none; }
.segmented-tabs {
    padding: 0.35rem;
    border-radius: 999px;
    background: #edf3fb;
    border: 1px solid rgba(22, 59, 116, 0.1);
}
.segmented-tab {
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 0.7rem 1rem;
    border-radius: 999px;
    font-weight: 800;
    cursor: pointer;
}
.segmented-tab.is-active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 6px 18px rgba(22, 59, 116, 0.08);
}
.tab-panel { display: none; }
.tab-panel.is-active { display: grid; gap: 1rem; }
.map-management-main, .map-management-side { display: grid; gap: 1rem; }
.station-popup .popup-action {
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #fff;
    color: #111827;
    border-radius: 0.7rem;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    margin-right: 0.35rem;
}
.station-popup .popup-action.delete {
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.18);
}

.topbar .link-button, .topnav a { color: var(--primary); font-weight: 700; }
.sidebar .btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.16);
}
.sidebar .sidebar-nav a, .sidebar .brand { color: #fff; }
.sidebar .sidebar-nav a { opacity: 0.9; }
.sidebar .sidebar-nav a:hover { opacity: 1; }

.leaflet-container {
    font: inherit;
    color: #111827;
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: #fff;
    color: #111827;
}
.leaflet-control-container .leaflet-control a {
    color: #111827;
}

.hero-copy h1, .admin-section h1, .admin-section h2, .admin-section h3 { margin: 0; color: var(--primary); }
.hero-copy p, .admin-section p { margin: 0; }

@media (max-width: 1180px) {
    .hero-grid,
    .dashboard-grid,
    .admin-grid-two,
    .results-grid,
    .info-grid,
    .admin-layout,
    .benchmark-grid,
    .metric-grid,
    .map-management-shell,
    .stats-grid,
    .system-stats-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
    }
}

@media (max-width: 720px) {
    .page-container, .admin-main { padding: 1rem; }
    .topbar {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }
    .split-fields, .metric-grid { grid-template-columns: 1fr; }
    .card-head {
        flex-direction: column;
        align-items: stretch;
    }
    .map-canvas { min-height: 360px; }
}
