/* =====================================================================
   Alçın Tekstil · Veri Yönetimi — Arayüz stilleri
   ===================================================================== */
:root {
    --bg:        #f4f6fa;
    --panel:     #ffffff;
    --sidebar:   #121826;
    --sidebar-2: #1b2436;
    --ink:       #1a2233;
    --muted:     #6b7688;
    --line:      #e3e8f0;
    --brand:     #2563eb;
    --brand-2:   #1d4ed8;
    --ok:        #16a34a;
    --warn:      #d97706;
    --err:       #dc2626;
    --radius:    12px;
    --shadow:    0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px -12px rgba(16, 24, 40, .18);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: 12.5px; }

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

.sidebar {
    width: 268px;
    flex: 0 0 268px;
    background: var(--sidebar);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex; gap: 10px; align-items: center;
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand-mark {
    width: 38px; height: 38px; border-radius: 10px; flex: 0 0 38px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff; font-weight: 700; letter-spacing: .5px;
}
.brand strong { display: block; color: #fff; font-size: 13.5px; line-height: 1.3; }
.brand small { color: #8695ad; font-size: 11.5px; }

.nav { padding: 12px 10px; flex: 1; }
.nav-title {
    margin: 16px 8px 6px;
    font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
    color: #74819a; display: flex; justify-content: space-between;
}
.nav-title span { background: rgba(255, 255, 255, .08); border-radius: 20px; padding: 0 7px; }

.nav-item {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px; border-radius: 9px;
    color: #c7d2e2; font-size: 13px; margin-bottom: 2px;
    white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.nav-item.is-active { background: var(--brand); color: #fff; }
.nav-item .ico { opacity: .85; font-size: 12px; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }

.sidebar-foot {
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    font-size: 12px; display: flex; flex-direction: column; gap: 8px;
}
.dbinfo { display: flex; align-items: center; gap: 7px; color: #93a1b8; overflow: hidden; }
.dbinfo .dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex: 0 0 7px; }
.dbinfo span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout { color: #fca5a5; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.topbar .titles { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.2px; }
.crumbs { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-btn {
    display: none; background: none; border: 1px solid var(--line);
    border-radius: 8px; font-size: 16px; padding: 4px 9px; cursor: pointer;
}

.content { padding: 22px 24px 40px; flex: 1; }

.foot {
    display: flex; justify-content: space-between;
    padding: 14px 24px; color: var(--muted); font-size: 12px;
    border-top: 1px solid var(--line); background: var(--panel);
}

/* ---------------- Kart / panel ---------------- */
.card {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 18px; overflow: hidden;
}
.card-head {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 16px; border-bottom: 1px solid var(--line);
    font-weight: 600; font-size: 14px;
}
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.tile {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px 16px; box-shadow: var(--shadow); display: block; color: inherit;
    transition: transform .12s ease, border-color .12s ease;
}
.tile:hover { transform: translateY(-2px); border-color: #c7d3ea; text-decoration: none; }
.tile .t-name { font-weight: 640; font-size: 14.5px; }
.tile .t-table { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.tile .t-meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; }
.tile .t-rows { font-size: 20px; font-weight: 680; letter-spacing: -.4px; }
.tile .t-rows small { font-size: 11px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.tile .t-size { font-size: 11.5px; color: var(--muted); }

/* ---------------- Tablo ---------------- */
.table-wrap { overflow: auto; max-height: calc(100vh - 300px); border-radius: 0; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data thead th {
    position: sticky; top: 0; z-index: 3;
    background: #f7f9fc; border-bottom: 1px solid var(--line);
    font-size: 11.5px; letter-spacing: .02em; text-transform: uppercase; color: #536075;
    white-space: nowrap;
}
table.data thead th a { color: inherit; display: inline-flex; gap: 5px; align-items: center; }
table.data tbody tr:hover { background: #f8fbff; }
table.data td { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
table.data td.wide { max-width: 520px; }
table.data .num { text-align: right; }
table.data .actions { white-space: nowrap; text-align: right; }
table.data tr.is-pk td { background: #fffdf3; }

.filter-row th { position: sticky; top: 33px; z-index: 2; background: #fff; padding: 5px 6px; }
.filter-row input {
    width: 100%; min-width: 74px; padding: 4px 7px; font-size: 12px;
    border: 1px solid var(--line); border-radius: 7px; background: #fbfcfe;
}
.filter-row input:focus { outline: 2px solid #bfdbfe; border-color: #93c5fd; background: #fff; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-on  { background: #dcfce7; color: #15803d; }
.badge-off { background: #f1f5f9; color: #64748b; }
.badge-pk  { background: #fef3c7; color: #92400e; font-size: 10.5px; padding: 1px 6px; margin-left: 5px; }
.null { color: #a9b3c4; font-style: italic; font-size: 12px; }
.rel { font-size: 11.5px; background: #eef4ff; border-radius: 5px; padding: 0 5px; margin-left: 4px; }

/* ---------------- Form / düğme ---------------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px; border-radius: 9px; border: 1px solid var(--line);
    background: #fff; color: var(--ink); font-size: 13px; font-weight: 550;
    cursor: pointer; line-height: 1.3;
}
.btn:hover { background: #f7f9fc; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--err); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn-link { border: none; background: none; color: var(--brand); padding: 2px 4px; }

input[type=text], input[type=number], input[type=date], input[type=datetime-local],
input[type=search], input[type=password], select, textarea {
    font: inherit; padding: 7px 10px; border: 1px solid var(--line);
    border-radius: 9px; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: #93c5fd; }
textarea { min-height: 90px; resize: vertical; }

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.field.is-wide { grid-column: 1 / -1; }
.type-pill { background: #f1f5f9; border-radius: 5px; padding: 0 5px; font-family: ui-monospace, monospace; font-size: 11px; }
.req { color: var(--err); }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=search], .inline-form input[type=text] { width: 260px; }

/* ---------------- Sayfalama / bilgi şeridi ---------------- */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager .info { color: var(--muted); font-size: 12.5px; margin-right: auto; }
.pager a, .pager span.cur {
    min-width: 32px; text-align: center; padding: 4px 9px; border-radius: 8px;
    border: 1px solid var(--line); background: #fff; font-size: 12.5px;
}
.pager span.cur { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager a.disabled { opacity: .45; pointer-events: none; }

.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px; border: 1px solid; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.alert-warn    { background: #fffbeb; border-color: #fde68a; color: #b45309; }

.empty { padding: 40px; text-align: center; color: var(--muted); }
.kv { display: grid; grid-template-columns: 210px 1fr; }
.kv > div { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv > div:nth-child(odd) { color: var(--muted); background: #fafbfe; font-weight: 550; }
.chip { display: inline-block; background: #f1f5f9; border-radius: 6px; padding: 1px 7px; font-size: 11.5px; margin: 0 4px 4px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
h2.sect { font-size: 15px; margin: 22px 0 10px; }
pre.sqlout { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 10px; overflow: auto; font-size: 12.5px; }
.stat-row { display: flex; gap: 22px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 18px; }
.stat span { color: var(--muted); font-size: 11.5px; }

/* ---------------- Giriş ekranı ---------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 20%, #1e293b, #0b1120 60%); }
.login-card { width: 360px; background: #fff; border-radius: 16px; padding: 26px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6); }
.login-card h1 { margin: 0 0 4px; font-size: 19px; }
.login-card p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.login-card .field { margin-bottom: 12px; }

/* ---------------- Duyarlı ---------------- */
@media (max-width: 900px) {
    .sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 40;
        transform: translateX(-100%); transition: transform .18s ease;
    }
    body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
    .menu-btn { display: block; }
    .content { padding: 16px 14px 32px; }
    .table-wrap { max-height: none; }
}
