/* ==========================================================================
   Kaan Elektrik Otomasyon — yönetim paneli stilleri
   ========================================================================== */

:root {
    --a-navy: #0b1c30;
    --a-navy-soft: #16283f;
    --a-navy-line: #22384f;
    --a-amber: #1878e6;
    --a-amber-soft: #eef5fe;
    --a-bg: #f2f5f9;
    --a-surface: #ffffff;
    --a-line: #e3e9f0;
    --a-ink: #101a28;
    --a-muted: #64748b;
    --a-green: #16a34a;
    --a-red: #dc2626;
    --a-blue: #2563eb;
    --a-radius: 6px;
    --a-sidebar: 264px;
    --a-font: 'Manrope', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}

* { box-sizing: border-box; }

body.admin {
    margin: 0;
    font-family: var(--a-font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--a-ink);
    background: var(--a-bg);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0 0 .5em; color: var(--a-ink); font-weight: 800; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

/* ---------- kabuk ---------- */

.admin-shell { display: flex; min-height: 100vh; }

.admin-side {
    width: var(--a-sidebar);
    flex: none;
    background: var(--a-navy);
    color: #94a8c0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-brand {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    padding: 20px 22px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.admin-brand__logo { height: 44px; width: auto; margin-left: -6px; }
.admin-brand__sub {
    font-size: .66rem; text-transform: uppercase; letter-spacing: .16em;
    color: #7e93ad; font-weight: 800;
}

.admin-nav { padding: 18px 14px; display: grid; gap: 3px; align-content: start; flex: 1; }
.admin-nav__title {
    padding: 16px 12px 8px;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #5f7590;
    font-weight: 800;
}
.admin-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px;
    border-radius: 5px;
    color: #b3c4d7;
    font-size: .93rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}
.admin-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.admin-nav a.is-active { background: var(--a-amber); color: #fff; }
.admin-nav svg { width: 19px; height: 19px; flex: none; }
.admin-nav .badge { margin-left: auto; }

.admin-side__foot { padding: 16px 20px 22px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: .84rem; }
.admin-side__foot a { color: #b3c4d7; display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.admin-side__foot a:hover { color: var(--a-amber); text-decoration: none; }
.admin-side__foot svg { width: 17px; height: 17px; }

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

.admin-top {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    padding: 16px 32px;
    background: var(--a-surface);
    border-bottom: 1px solid var(--a-line);
    position: sticky; top: 0; z-index: 20;
}
.admin-top h1 { margin: 0; font-size: 1.22rem; }
.admin-top__meta { font-size: .84rem; color: var(--a-muted); }
.admin-top__actions { display: flex; align-items: center; gap: 12px; }

.admin-user { display: flex; align-items: center; gap: 10px; font-size: .88rem; font-weight: 700; }
.admin-user__avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--a-navy); color: #fff;
    display: grid; place-items: center; font-size: .82rem; font-weight: 800;
}

.admin-body { padding: 30px 32px 56px; flex: 1; }

.side-toggle { display: none; width: 42px; height: 42px; border: 0; border-radius: 5px; background: var(--a-bg); cursor: pointer; align-items: center; justify-content: center; }
.side-toggle svg { width: 22px; height: 22px; }

/* ---------- bileşenler ---------- */

.panel {
    background: var(--a-surface);
    border: 1px solid var(--a-line);
    border-radius: var(--a-radius);
    box-shadow: 0 1px 2px rgba(16, 26, 40, .04);
    margin-bottom: 24px;
}
.panel__head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 18px 24px;
    border-bottom: 1px solid var(--a-line);
}
.panel__head h2 { margin: 0; font-size: 1.05rem; }
.panel__body { padding: 24px; }
.panel__body--flush { padding: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }

.stat-card {
    display: flex; align-items: center; gap: 16px;
    padding: 22px;
    background: var(--a-surface);
    border: 1px solid var(--a-line);
    border-radius: var(--a-radius);
}
.stat-card__icon {
    width: 50px; height: 50px; flex: none;
    display: grid; place-items: center;
    border-radius: 6px;
    background: var(--a-navy);
    color: var(--a-amber);
}
.stat-card__icon svg { width: 24px; height: 24px; }
.stat-card b { display: block; font-size: 1.7rem; line-height: 1.1; letter-spacing: -.03em; }
.stat-card span { font-size: .85rem; color: var(--a-muted); font-weight: 600; }

/* butonlar */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-family: inherit; font-size: .89rem; font-weight: 700; line-height: 1.2;
    cursor: pointer;
    transition: filter .15s ease, background .15s ease, border-color .15s ease;
    text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(.96); }
.btn svg { width: 17px; height: 17px; }
.btn--primary { background: var(--a-amber); color: #fff; }
.btn--dark { background: var(--a-navy); color: #fff; }
.btn--light { background: var(--a-bg); color: var(--a-ink); border-color: var(--a-line); }
.btn--danger { background: #fee2e2; color: var(--a-red); border-color: #fecaca; }
.btn--sm { padding: 7px 13px; font-size: .82rem; border-radius: 4px; }
.btn--icon { padding: 8px; width: 34px; height: 34px; }
.btn--icon svg { width: 16px; height: 16px; }
.btn--block { width: 100%; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* rozetler */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: .74rem; font-weight: 800;
    letter-spacing: .02em;
}
.badge--on { background: #dcfce7; color: #15803d; }
.badge--off { background: #f1f5f9; color: #64748b; }
.badge--new { background: var(--a-amber); color: #fff; }
.badge--info { background: #dbeafe; color: #1d4ed8; }

/* tablolar */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .91rem; }
table.data th, table.data td { padding: 13px 24px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--a-line); }
table.data th { background: #f8fafc; font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--a-muted); font-weight: 800; white-space: nowrap; }
table.data tbody tr:hover { background: #fafcff; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data td.actions .btn-row { flex-wrap: nowrap; gap: 6px; }
table.data td.actions .btn { white-space: nowrap; }
table.data .thumb { width: 62px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--a-line); background: var(--a-bg); }
table.data .row-title { font-weight: 700; color: var(--a-ink); }
table.data .row-sub { font-size: .82rem; color: var(--a-muted); }
tr.is-unread td { background: #f4f9ff; }
tr.is-unread:hover td { background: #e9f3ff; }

/* formlar */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.form-row { display: flex; flex-direction: column; }
.form-row--full { grid-column: 1 / -1; }

label { font-size: .84rem; font-weight: 700; margin-bottom: 6px; color: var(--a-ink); }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=date], input[type=url], input[type=file], select, textarea {
    width: 100%;
    padding: 10px 13px;
    font-family: inherit; font-size: .92rem;
    color: var(--a-ink);
    background: #fff;
    border: 1px solid #cfd8e3;
    border-radius: 5px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
textarea.tall { min-height: 320px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--a-navy); box-shadow: 0 0 0 3px rgba(14, 28, 47, .1); }
input[type=file] { padding: 8px; background: var(--a-bg); }

.hint { font-size: .8rem; color: var(--a-muted); margin-top: 5px; }

.switch-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--a-amber); }
.switch-row label { margin: 0; }

.field-validation-error { display: block; margin-top: 5px; font-size: .8rem; color: var(--a-red); font-weight: 600; }
.input-validation-error { border-color: var(--a-red) !important; }
.validation-summary-errors { margin-bottom: 18px; }

/* görsel önizleme */
.img-preview {
    display: flex; align-items: center; gap: 14px;
    padding: 12px;
    background: var(--a-bg);
    border: 1px solid var(--a-line);
    border-radius: 5px;
    margin-bottom: 10px;
}
.img-preview img { width: 96px; height: 66px; object-fit: cover; border-radius: 6px; background: #fff; }
.img-preview span { font-size: .82rem; color: var(--a-muted); word-break: break-all; }

/* uyarılar */
.alert {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 18px;
    border-radius: 5px;
    font-size: .9rem; font-weight: 600;
    margin-bottom: 22px;
}
.alert svg { width: 19px; height: 19px; flex: none; margin-top: 2px; }
.alert--success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert--error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert--info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* boş durum */
.empty {
    padding: 60px 24px;
    text-align: center;
    color: var(--a-muted);
}
.empty svg { width: 42px; height: 42px; margin-bottom: 12px; opacity: .55; }

/* sekmeler */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--a-line); padding: 0 24px; }
.tabs a {
    padding: 13px 16px;
    font-size: .89rem; font-weight: 700;
    color: var(--a-muted);
    border-bottom: 2px solid transparent;
    text-decoration: none;
}
.tabs a:hover { color: var(--a-ink); text-decoration: none; }
.tabs a.is-active { color: var(--a-ink); border-bottom-color: var(--a-amber); }

/* mesaj detayı */
.message-view { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0; }
.message-view__meta { padding: 24px; border-right: 1px solid var(--a-line); background: #fafbfd; }
.message-view__meta dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--a-muted); font-weight: 800; margin-top: 16px; }
.message-view__meta dt:first-child { margin-top: 0; }
.message-view__meta dd { margin: 4px 0 0; font-weight: 700; font-size: .92rem; word-break: break-word; }
.message-view__body { padding: 24px; }
.message-view__body p { white-space: pre-wrap; margin: 0; font-size: .97rem; }

/* giriş ekranı */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px;
    background: linear-gradient(130deg, #0a1524 0%, #142a45 55%, #1d3d61 100%);
    position: relative;
}
.login-page::before {
    content: "";
    position: absolute; inset: 0;
    background-image: url("/img/circuit.svg");
    background-size: 500px;
    opacity: .25;
}
.login-card {
    position: relative; z-index: 2;
    width: 100%; max-width: 420px;
    background: #fff;
    border-radius: 8px;
    padding: 40px 38px;
    box-shadow: 0 30px 70px rgba(3, 10, 20, .45);
}
.login-card__brand {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    margin-bottom: 26px; padding-bottom: 22px;
    border-bottom: 1px solid var(--a-line);
}
.login-card__brand img { height: 52px; width: auto; margin-left: -6px; }
.login-card__brand span { font-size: .68rem; text-transform: uppercase; letter-spacing: .16em; color: var(--a-muted); font-weight: 800; }
.login-card h1 { font-size: 1.35rem; margin-bottom: 6px; }
.login-card > p { color: var(--a-muted); font-size: .9rem; margin-bottom: 26px; }
.login-foot { text-align: center; margin-top: 22px; font-size: .84rem; color: var(--a-muted); }

/* ---------- duyarlı ---------- */

@media (max-width: 1120px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .admin-side {
        position: fixed;
        left: 0; top: 0;
        z-index: 60;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, .4);
    }
    .admin-side.is-open { transform: translateX(0); }
    .side-toggle { display: inline-flex; }
    .admin-top, .admin-body { padding-left: 18px; padding-right: 18px; }
    .form-grid { grid-template-columns: 1fr; }
    .message-view { grid-template-columns: 1fr; }
    .message-view__meta { border-right: 0; border-bottom: 1px solid var(--a-line); }
}

@media (max-width: 560px) {
    .stat-grid { grid-template-columns: 1fr; }
    .admin-top { flex-wrap: wrap; }
    .admin-user span { display: none; }
    table.data th, table.data td { padding: 11px 14px; }
}
