/* ============================================================
   DPA — Dijital Ürün Otomasyonu | Ana Stil Dosyası
   Framework kullanılmaz. CSS değişkenleri ile açık/koyu tema.
   ============================================================ */

:root {
    --bg: #f1f4f9;
    --bg-card: #ffffff;
    --bg-sidebar: #101828;
    --bg-topbar: #ffffff;
    --bg-hover: #f5f7fb;
    --bg-input: #ffffff;
    --text: #1c2536;
    --text-muted: #6b7487;
    --text-sidebar: #cbd3e1;
    --border: #dde3ee;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warning: #d97706;
    --info: #0891b2;
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
    --radius: 8px;
    --chart-primary: #2563eb;
    --chart-secondary: #16a34a;
    --chart-axis: #9aa4b8;
    --chart-grid: rgba(154, 164, 184, 0.25);
    --chart-text: #6b7487;
}

html[data-theme="dark"] {
    --bg: #0d1220;
    --bg-card: #161d2e;
    --bg-sidebar: #0a0f1c;
    --bg-topbar: #161d2e;
    --bg-hover: #1d2740;
    --bg-input: #101828;
    --text: #e4e9f2;
    --text-muted: #8b95ab;
    --text-sidebar: #aab4c8;
    --border: #263049;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --chart-primary: #3b82f6;
    --chart-secondary: #34d399;
    --chart-axis: #55607a;
    --chart-grid: rgba(85, 96, 122, 0.35);
    --chart-text: #8b95ab;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a.link { font-weight: 600; }

hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
h4 { margin: 0.75rem 0 0.5rem; font-size: 0.95rem; }
small { font-weight: 400; }

.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.85em; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.mt-2 { margin-top: 0.75rem; }
.text-center { text-align: center; }
.mt-3 { margin-top: 1.25rem; }

/* ---------- Yerleşim ---------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.1rem 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.brand-text { color: #fff; font-weight: 600; font-size: 0.95rem; }

.sidebar-nav { flex: 1; padding: 0.75rem 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 1.2rem;
    color: var(--text-sidebar);
    font-size: 0.92rem;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.06); text-decoration: none; color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { width: 1.3rem; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 1rem 1.2rem; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.user-info { font-size: 0.85rem; margin-bottom: 0.6rem; }
.user-info strong { color: #fff; display: block; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title { font-size: 1.15rem; font-weight: 700; }
.topbar-actions { display: flex; gap: 0.5rem; align-items: center; }

.content { padding: 1.4rem; display: flex; flex-direction: column; gap: 1.2rem; }

/* ---------- Kart & Grid ---------- */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-header h2 { font-size: 1rem; font-weight: 700; }
.card-body { padding: 1.2rem; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-card.stat-warning { border-left: 4px solid var(--warning); }
.stat-card.stat-danger { border-left: 4px solid var(--danger); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-size: 1.5rem; font-weight: 800; }

/* ---------- Tablo ---------- */

.table-responsive { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 0.55rem 0.7rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.table tbody tr:hover { background: var(--bg-hover); }
.table .actions { white-space: nowrap; display: flex; gap: 0.35rem; }

.cell-truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-wrap { max-width: 500px; word-break: break-word; }

.detail-table th { width: 180px; color: var(--text-muted); font-weight: 600; }

/* ---------- Rozet ---------- */

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    margin: 1px;
}

.badge-success { background: rgba(22, 163, 74, 0.14); color: var(--success); }
.badge-danger { background: rgba(220, 38, 38, 0.14); color: var(--danger); }
.badge-warning { background: rgba(217, 119, 6, 0.14); color: var(--warning); }
.badge-info { background: rgba(8, 145, 178, 0.14); color: var(--info); }
.badge-muted { background: rgba(107, 116, 135, 0.15); color: var(--text-muted); }

/* ---------- Buton ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text);
    white-space: nowrap;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-outline { border-color: var(--border); background: var(--bg-card); }
.btn-outline:hover:not(:disabled) { background: var(--bg-hover); }

.btn-sm { padding: 0.28rem 0.6rem; font-size: 0.78rem; }
.btn-block { width: 100%; }

.btn-icon {
    padding: 0.35rem 0.55rem;
    border-color: var(--border);
    background: var(--bg-card);
    font-size: 1rem;
    line-height: 1;
}
.btn-icon:hover:not(:disabled) { background: var(--bg-hover); }

.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Form ---------- */

.form-group { margin-bottom: 0.9rem; display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-size: 0.85rem; font-weight: 600; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }

input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="file"], select, textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 0.5rem 0.7rem;
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input[readonly] { background: var(--bg-hover); color: var(--text-muted); }
textarea { resize: vertical; }

.input-group { display: flex; gap: 0.5rem; }
.input-group input { flex: 1; }

.filter-form { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.filter-form input, .filter-form select { width: auto; min-width: 140px; flex: 0 1 auto; }

.checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; }
.checkbox-item { display: flex; align-items: center; gap: 0.45rem; font-size: 0.88rem; cursor: pointer; }
.checkbox-item input { width: auto; }

/* ---------- Sekmeler ---------- */

.tabs { display: flex; gap: 0.4rem; border-bottom: 1px solid var(--border); }
.tab {
    padding: 0.55rem 1rem;
    border-radius: var(--radius) var(--radius) 0 0;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
    border-bottom: none;
}
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active { background: var(--bg-card); border-color: var(--border); color: var(--primary); }

/* ---------- Sayfalama ---------- */

.pagination { display: flex; gap: 0.3rem; flex-wrap: wrap; padding: 0.9rem 1.2rem; }
.page-link {
    min-width: 2rem;
    text-align: center;
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text);
    background: var(--bg-card);
}
.page-link:hover { background: var(--bg-hover); text-decoration: none; }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Modal ---------- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 28, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1rem;
    z-index: 200;
    overflow-y: auto;
}

.modal[hidden] { display: none; }
body.modal-open { overflow: hidden; }

.modal-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-dialog.modal-lg { max-width: 820px; }

.modal-header {
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 1rem; }
.modal-body { padding: 1.2rem; max-height: 75vh; overflow-y: auto; }

/* ---------- Toast ---------- */

.toast-container {
    position: fixed;
    bottom: 1.2rem;
    right: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 300;
    max-width: 360px;
}

.toast {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 4px solid var(--info);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }

/* ---------- Uyarı & Kod bloğu ---------- */

.alert {
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    margin-bottom: 0.9rem;
    border: 1px solid transparent;
}

.alert-danger {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
    color: var(--danger);
}

.alert-success {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.3);
    color: var(--success);
}

.code-block {
    background: var(--bg-sidebar);
    color: #d3dceb;
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.78rem;
    overflow-x: auto;
    white-space: pre;
}

/* ---------- Giriş sayfası ---------- */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--bg);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(16, 24, 40, 0.12);
    width: 100%;
    max-width: 380px;
    padding: 2rem;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 1.05rem;
}

/* ---------- Hata sayfaları ---------- */

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 0.8rem;
    text-align: center;
    padding: 1rem;
}

.error-code { font-size: 4rem; font-weight: 900; color: var(--primary); }

/* ---------- Duyarlılık ---------- */

@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar.open { transform: translateX(0); }

    .form-row { grid-template-columns: 1fr; }
    .checkbox-grid { grid-template-columns: 1fr; }
    .content { padding: 1rem; }
    .filter-form input, .filter-form select { min-width: 110px; }
}
