/* ============================================================
   BOR Saha — Premium Tasarım Sistemi v2
   ============================================================ */

:root {
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-soft: #eef2ff;
    --accent-soft-2: #e0e7ff;
    --success: #059669;
    --success-soft: #ecfdf5;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --text: #111827;
    --text-2: #4b5563;
    --muted: #9ca3af;
    --border: #eef0f3;
    --border-strong: #e5e7eb;
    --bg: #f7f8fa;
    --card: #ffffff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16,24,40,.04);
    --shadow-md: 0 1px 3px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.05);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 40;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid var(--border);
}
.sidebar .brand .logo {
    width: 32px; height: 32px; border-radius: 9px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px;
    box-shadow: 0 4px 10px rgba(79,70,229,.28);
}
.sidebar .brand .name { font-size: 16.5px; font-weight: 700; letter-spacing: -.3px; }
.sidebar .brand .name b { color: var(--accent); }
.sidebar .brand .tag { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }

.sidebar nav { flex: 1; padding: 12px 12px; overflow-y: auto; }
.sidebar nav .group { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; padding: 12px 12px 6px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 11px;
    color: var(--text-2); text-decoration: none;
    padding: 8px 12px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 500;
    margin-bottom: 1px;
    transition: background .14s ease, color .14s ease;
}
.sidebar nav a svg { flex-shrink: 0; color: var(--muted); transition: color .14s ease; }
.sidebar nav a:hover { background: #f4f5f7; color: var(--text); }
.sidebar nav a:hover svg { color: var(--text-2); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar nav a.active svg { color: var(--accent); }

.sidebar .userbox {
    padding: 14px 16px; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
}
.sidebar .userbox .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.sidebar .userbox .info { flex: 1; min-width: 0; }
.sidebar .userbox .info .uname { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .userbox .info .role { font-size: 11px; color: var(--muted); }
.sidebar .userbox .logout { color: var(--muted); text-decoration: none; display: flex; }
.sidebar .userbox .logout:hover { color: var(--danger); }

.main { flex: 1; margin-left: 248px; display: flex; flex-direction: column; min-width: 0; }
.container { max-width: 1160px; width: 100%; margin: 0 auto; padding: 30px 32px 56px; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; margin: 0; }
h2 { font-size: 14.5px; font-weight: 700; margin: 30px 0 12px; letter-spacing: -.2px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- Cards ---------- */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.stat-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 18px 16px;
    box-shadow: var(--shadow);
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.stat-card .ic {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.stat-card .ic svg { width: 18px; height: 18px; }
.stat-card .ic.indigo { background: var(--accent-soft); color: var(--accent); }
.stat-card .ic.green  { background: var(--success-soft); color: var(--success); }
.stat-card .ic.amber  { background: var(--warning-soft); color: var(--warning); }
.stat-card .ic.red    { background: var(--danger-soft); color: var(--danger); }
.stat-card .num { font-size: 25px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat-card .lbl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- Tables ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden;
}
.table-wrap table { border: none; border-radius: 0; box-shadow: none; }
th, td { text-align: left; padding: 12px 16px; font-size: 13.5px; border-bottom: 1px solid var(--border); }
th {
    background: #fafbfc; color: var(--text-2); font-weight: 600;
    font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f9fafb; }
td a { color: var(--accent); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }
td.num { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.badge.gray { background: #f3f4f6; color: #6b7280; }
.badge.amber { background: var(--warning-soft); color: var(--warning); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--accent); color: #fff; border: none;
    padding: 9px 15px; border-radius: var(--radius-sm);
    cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 600;
    font-family: var(--font);
    transition: background .15s ease, box-shadow .15s ease;
    box-shadow: 0 1px 2px rgba(79,70,229,.25);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--accent-hover); }
.btn:active { box-shadow: none; }
.btn.ghost { background: var(--card); color: var(--text-2); border: 1px solid var(--border-strong); box-shadow: none; }
.btn.ghost:hover { background: #f4f5f7; }
.btn.danger { background: var(--danger); box-shadow: 0 1px 2px rgba(220,38,38,.25); }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 6px 11px; font-size: 12px; }

/* ---------- Forms ---------- */
.form {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
    max-width: 560px;
}
.form label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
.form label:first-child { margin-top: 0; }
.form input, .form select, .form textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 13.5px; font-family: var(--font); background: #fff; color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form .actions { margin-top: 18px; display: flex; gap: 8px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters input, .filters select {
    padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 13px; font-family: var(--font); background: #fff;
}

/* ---------- Alerts ---------- */
.alert { padding: 12px 15px; border-radius: var(--radius-sm); margin: 12px 0; font-size: 13.5px; border: 1px solid transparent; }
.alert.success { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.alert.error { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }

/* ---------- Auth ---------- */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(1100px 500px at 10% -10%, rgba(99,102,241,.35), transparent 55%),
        radial-gradient(900px 500px at 100% 110%, rgba(79,70,229,.25), transparent 55%),
        #0b1020;
    padding: 24px;
}
.auth-card {
    background: #fff; border-radius: 18px; padding: 38px 34px; width: 100%; max-width: 400px;
    box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.auth-card .logo {
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 20px; margin-bottom: 16px;
    box-shadow: 0 8px 20px rgba(79,70,229,.35);
}
.auth-card h1 { font-size: 22px; margin-bottom: 2px; }
.auth-card h1 b { color: var(--accent); }

/* ---------- Helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; margin-top: auto; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }

/* ---------- Animasyonlar ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate { animation: fadeUp .35s ease both; }
.cards > *, .stat-card, .table-wrap, table, .card, .form { animation: fadeUp .35s ease both; }
.cards > *:nth-child(2), .stat-card:nth-child(2) { animation-delay: .04s; }
.cards > *:nth-child(3), .stat-card:nth-child(3) { animation-delay: .08s; }
.cards > *:nth-child(4), .stat-card:nth-child(4) { animation-delay: .12s; }
.cards > *:nth-child(5), .stat-card:nth-child(5) { animation-delay: .16s; }
.cards > *:nth-child(6), .stat-card:nth-child(6) { animation-delay: .2s; }

/* ---------- Hamburger (mobil) ---------- */
.hamburger {
    display: none;
    position: fixed; top: 14px; left: 14px; z-index: 50;
    width: 42px; height: 42px; border-radius: 10px;
    background: var(--card); border: 1px solid var(--border-strong);
    cursor: pointer; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md);
}
.hamburger span { display: block; width: 18px; height: 2px; background: var(--text); margin: 2px 0; border-radius: 2px; }
.sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,.4);
    z-index: 35; opacity: 0; transition: opacity .2s ease;
}
.sidebar-backdrop.show { display: block; opacity: 1; }

/* ---------- Grafik ---------- */
.chart {
    display: flex; align-items: flex-end; gap: 6px;
    height: 180px; padding: 8px 4px 0;
}
.chart .bar {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    height: 100%; min-width: 0;
}
.chart .bar .fill {
    width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px;
    background: linear-gradient(180deg, #6366f1, var(--accent));
    transition: height .4s ease, opacity .2s ease;
    opacity: .85;
}
.chart .bar:hover .fill { opacity: 1; }
.chart .bar .val { font-size: 10px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.chart .bar .lab { font-size: 10px; color: var(--muted); margin-top: 6px; white-space: nowrap; }

/* ---------- Koyu tema ---------- */
[data-theme="dark"] {
    --bg: #0b1020;
    --card: #151b2e;
    --text: #e2e8f0;
    --text-2: #94a3b8;
    --muted: #64748b;
    --border: #1e2739;
    --border-strong: #2c3850;
    --accent-soft: rgba(99,102,241,.16);
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}
[data-theme="dark"] .sidebar { background: #111828; border-color: var(--border); }
[data-theme="dark"] .sidebar nav a:hover { background: #1a2337; }
[data-theme="dark"] th { background: #1a2236; color: var(--text-2); }
[data-theme="dark"] tbody tr:hover { background: #1a2236; }
[data-theme="dark"] td, [data-theme="dark"] th { border-color: var(--border); }
[data-theme="dark"] .form input, [data-theme="dark"] .form select, [data-theme="dark"] .form textarea,
[data-theme="dark"] .filters input, [data-theme="dark"] .filters select {
    background: #0f1626; border-color: var(--border-strong); color: var(--text);
}
[data-theme="dark"] .btn.ghost { background: var(--card); color: var(--text-2); }
[data-theme="dark"] .badge.gray { background: #1e2739; color: var(--text-2); }
[data-theme="dark"] .auth-card { background: var(--card); }
.theme-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: transparent; border: 1px solid var(--border-strong);
    color: var(--text-2); cursor: pointer;
}
.theme-toggle:hover { background: var(--border); }

/* ---------- Yardım balonu ---------- */
.help-btn {
    position: fixed; top: 16px; right: 16px; z-index: 60;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--card); border: 1px solid var(--border-strong);
    color: var(--text-2); cursor: pointer;
    font-weight: 700; font-size: 15px;
    box-shadow: var(--shadow-md);
    transition: all .15s ease;
}
.help-btn:hover { background: var(--accent-soft); color: var(--accent); }
.help-pop {
    position: fixed; top: 58px; right: 16px; z-index: 60;
    width: 320px; max-width: calc(100vw - 32px);
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 16px 18px;
    display: none;
    animation: fadeUp .2s ease both;
}
.help-pop.show { display: block; }
.help-pop strong { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 8px; }
.help-pop strong .q {
    display: inline-flex; width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent);
    align-items: center; justify-content: center; font-size: 12px;
}
.help-pop p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.6; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-md); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .grid-2 { grid-template-columns: 1fr; }
    .container { padding: 20px 16px; }
    .hamburger { display: flex; }
}

/* ---------- Print ---------- */
@media print {
    .sidebar, .footer, .no-print, .filters, nav, .page-head { display: none !important; }
    .main { margin-left: 0; }
    body { background: #fff; }
    .container { max-width: 100%; margin: 0; padding: 0; }
    .card, .table-wrap, .stat-card, table { box-shadow: none; border: 1px solid #ddd; }
}
