/*
 * Yönetim paneli tasarım sistemi. Bootstrap ızgara ve form davranışları için kalıyor; renkler, yazı ve bileşen
 * görünümleri burada uygulamanın marka diline (lacivert + turuncu) göre yeniden tanımlanır.
 */

:root {
    --brand-orange: #f07c1b;
    --brand-orange-hover: #f3913f;
    --brand-orange-active: #d9690f;
    /* Açık zeminde turuncu yazı; beyaz üzerinde 4.5:1 kontrastı sağlar. */
    --brand-orange-text: #b4520a;
    --brand-orange-soft: #fff3e8;
    --brand-navy: #0b1622;
    --brand-navy-2: #11202f;
    --brand-navy-3: #1a2d41;

    --ink: #101828;
    --ink-2: #344054;
    --muted: #667085;
    --line: #e4e7ec;
    --line-strong: #d0d5dd;
    --page-bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f9fafb;

    --green: #067647;
    --green-soft: #ecfdf3;
    --red: #c8322f;
    --red-soft: #fef1f1;
    --teal: #1f6e8c;
    --teal-soft: #eaf4f8;
    --gray-soft: #f2f4f7;

    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --focus-ring: 0 0 0 4px rgba(240, 124, 27, 0.18);

    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

    --bs-body-font-family: var(--font);
    --bs-body-font-size: 0.9375rem;
    --bs-body-color: var(--ink);
    /* Bootstrap bunu form alanlarının zemini için de kullanır; sayfa zemini aşağıda ayrıca verilir. */
    --bs-body-bg: var(--surface);
    --bs-border-color: var(--line);
    --bs-secondary-color: var(--muted);
    --bs-border-radius: var(--radius);
    --bs-link-color: var(--brand-orange-text);
    --bs-link-color-rgb: 180, 82, 10;
    --bs-link-hover-color: #8f3f06;
    --bs-link-hover-color-rgb: 143, 63, 6;
    --bs-emphasis-color: var(--ink);
    --bs-heading-color: var(--ink);
}

html, body {
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    background: var(--page-bg);
}

h1, h2, h3, .h1, .h2, .h3, .h4, .h5, .h6 {
    letter-spacing: -0.01em;
}

h1:focus {
    outline: none;
}

a {
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

.text-secondary {
    color: var(--muted) !important;
}

code {
    padding: 0.0625rem 0.3125rem;
    font-size: 0.85em;
    color: var(--ink-2);
    background: var(--gray-soft);
    border-radius: 4px;
}

/* ---------- Simgeler ---------- */

.icon {
    flex-shrink: 0;
    vertical-align: -0.2em;
}

/* ---------- Sayfa başlığı ---------- */

.page-header {
    margin-bottom: 1.5rem;
}

.page-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
}

    .page-back:hover {
        color: var(--ink);
        text-decoration: none;
    }

.page-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.625rem;
    font-weight: 700;
}

.page-description {
    max-width: 68ch;
    margin: 0.375rem 0 0;
    color: var(--muted);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ---------- Kartlar ---------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.panel + .panel {
    margin-top: 1.25rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

    .panel-header h2 {
        margin: 0;
        font-size: 1rem;
        font-weight: 650;
    }

    .panel-header p {
        margin: 0.125rem 0 0;
        font-size: 0.8125rem;
        color: var(--muted);
    }

.panel-body {
    padding: 1.25rem;
}

.panel-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Geniş ekranda yan form kartı kaydırırken görünür kalır. */
@media (min-width: 992px) {
    .sticky-panel {
        position: sticky;
        top: 1.5rem;
    }
}

/* ---------- Tablolar ---------- */

.data-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

    .data-table th {
        padding: 0.625rem 1.25rem;
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--muted);
        background: var(--surface-2);
        border-bottom: 1px solid var(--line);
        white-space: nowrap;
    }

        .data-table th:first-child {
            border-top-left-radius: var(--radius-lg);
        }

        .data-table th:last-child {
            border-top-right-radius: var(--radius-lg);
        }

    .data-table td {
        padding: 0.875rem 1.25rem;
        vertical-align: middle;
        border-bottom: 1px solid var(--line);
    }

    .data-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .data-table tbody tr:hover td {
        background: var(--surface-2);
    }

    /* Düzenlenmekte olan satır. */
    .data-table tr.is-editing td {
        background: var(--brand-orange-soft);
    }

        .data-table tr.is-editing td:first-child {
            box-shadow: inset 3px 0 0 var(--brand-orange);
        }

.cell-title {
    font-weight: 600;
    color: var(--ink);
}

.cell-sub {
    margin-top: 0.125rem;
    font-size: 0.8125rem;
    color: var(--muted);
}

.cell-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.num {
    font-variant-numeric: tabular-nums;
}

/* ---------- Simge düğmeleri ve satır içi onay ---------- */

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    transition: background-color 0.12s, color 0.12s;
}

    .icon-btn:hover {
        color: var(--ink);
        background: var(--gray-soft);
        text-decoration: none;
    }

    .icon-btn.danger:hover {
        color: var(--red);
        background: var(--red-soft);
    }

    .icon-btn:focus-visible {
        outline: none;
        box-shadow: var(--focus-ring);
    }

.confirm-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--red);
}

/* ---------- Rozetler ---------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    color: var(--ink-2);
    background: var(--gray-soft);
    border-radius: 999px;
}

    .pill.dot::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

.pill-success {
    color: var(--green);
    background: var(--green-soft);
}

.pill-accent {
    color: var(--brand-orange-text);
    background: var(--brand-orange-soft);
}

.pill-info {
    color: var(--teal);
    background: var(--teal-soft);
}

.pill-danger {
    color: var(--red);
    background: var(--red-soft);
}

/* ---------- Düğmeler ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius);
}

.btn-sm {
    padding: 0.3125rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 8px;
}

.btn-lg {
    padding: 0.6875rem 1.25rem;
    font-size: 1rem;
}

/* Turuncu üzerinde beyaz yazının kontrastı yetersiz; yazı lacivert. */
.btn-primary {
    --bs-btn-color: var(--brand-navy);
    --bs-btn-bg: var(--brand-orange);
    --bs-btn-border-color: var(--brand-orange);
    --bs-btn-hover-color: var(--brand-navy);
    --bs-btn-hover-bg: var(--brand-orange-hover);
    --bs-btn-hover-border-color: var(--brand-orange-hover);
    --bs-btn-active-color: var(--brand-navy);
    --bs-btn-active-bg: var(--brand-orange-active);
    --bs-btn-active-border-color: var(--brand-orange-active);
    --bs-btn-disabled-color: var(--brand-navy);
    --bs-btn-disabled-bg: var(--brand-orange);
    --bs-btn-disabled-border-color: var(--brand-orange);
    box-shadow: var(--shadow-sm);
}

.btn-outline-secondary {
    --bs-btn-color: var(--ink-2);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-bg: var(--surface-2);
    --bs-btn-hover-border-color: var(--line-strong);
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-bg: var(--gray-soft);
    --bs-btn-active-border-color: var(--line-strong);
    --bs-btn-disabled-color: var(--muted);
    --bs-btn-disabled-bg: var(--surface);
    --bs-btn-disabled-border-color: var(--line);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    --bs-btn-bg: var(--red);
    --bs-btn-border-color: var(--red);
    --bs-btn-hover-bg: #a92825;
    --bs-btn-hover-border-color: #a92825;
}

.btn-link {
    --bs-btn-color: var(--muted);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-active-color: var(--ink);
    text-decoration: none;
}

    .btn-link:hover {
        text-decoration: none;
    }

.btn:focus-visible, .btn:active:focus-visible {
    box-shadow: var(--focus-ring);
}

/* ---------- Formlar ---------- */

.form-label {
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-2);
}

    .form-label .optional {
        font-weight: 400;
        color: var(--muted);
    }

.form-control, .form-select {
    padding: 0.5625rem 0.8125rem;
    font-size: 0.9375rem;
    color: var(--ink);
    border-color: var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.form-select {
    padding-right: 2.25rem;
}

    .form-control:focus, .form-select:focus {
        border-color: var(--brand-orange);
        box-shadow: var(--focus-ring);
    }

.form-control::placeholder {
    color: #98a2b3;
}

.form-control:disabled, .form-select:disabled {
    color: var(--muted);
    background-color: var(--gray-soft);
}

.form-text {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: var(--muted);
}

.form-check-input:focus {
    border-color: var(--brand-orange);
    box-shadow: var(--focus-ring);
}

.form-check-input:checked {
    background-color: var(--brand-orange);
    border-color: var(--brand-orange);
}

.form-switch .form-check-input {
    width: 2.25em;
    height: 1.25em;
    margin-top: 0.125em;
    cursor: pointer;
}

.form-switch .form-check-input:focus:not(:checked) {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23f3913f'/%3e%3c/svg%3e");
}

/* Açıklamalı anahtar satırı: solda başlık ve açıklama, sağda anahtar. */
.switch-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
}

    .switch-row + .switch-row {
        border-top: 1px solid var(--line);
    }

    .switch-row .form-check {
        margin: 0;
        padding: 0;
    }

        .switch-row .form-check .form-check-input {
            margin: 0.125rem 0 0;
            float: none;
        }

.switch-row-title {
    font-weight: 600;
    font-size: 0.9375rem;
}

.switch-row-text {
    font-size: 0.8125rem;
    color: var(--muted);
}

.valid.modified:not([type=checkbox]) {
    border-color: #6ce9a6;
}

.invalid {
    border-color: var(--red) !important;
}

.validation-message {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: var(--red);
}

.settings-form {
    max-width: 52rem;
}

.title-input {
    font-weight: 600;
}

.body-input {
    line-height: 1.65;
}

/* Gizli dosya seçicisini saran düğme; klavyeyle odaklanınca halka görünsün. */
.file-button {
    cursor: pointer;
}

    .file-button:has(input:focus-visible) {
        box-shadow: var(--focus-ring);
    }

.field-short {
    max-width: 14rem;
}

/* Uzun formların altında kaydırırken görünür kalan kaydet çubuğu. */
.form-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding: 0.875rem 0;
    background: linear-gradient(to bottom, rgba(245, 246, 248, 0), var(--page-bg) 30%);
}

.save-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--green);
}

/* ---------- Segmentli seçici (gün ve kategori sekmeleri) ---------- */

.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px;
    background: #eaecf0;
    border-radius: 12px;
}

    .segmented button {
        display: inline-flex;
        align-items: center;
        gap: 0.375rem;
        padding: 0.375rem 0.875rem;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--ink-2);
        background: transparent;
        border: 0;
        border-radius: 9px;
        transition: background-color 0.12s, color 0.12s;
    }

        .segmented button:hover {
            color: var(--ink);
        }

        .segmented button.active {
            color: var(--ink);
            background: var(--surface);
            box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
        }

        .segmented button:focus-visible {
            outline: none;
            box-shadow: var(--focus-ring);
        }

    .segmented .count {
        min-width: 1.25rem;
        padding: 0 0.375rem;
        font-size: 0.75rem;
        color: var(--muted);
        background: rgba(16, 24, 40, 0.06);
        border-radius: 999px;
    }

    .segmented button.active .count {
        color: var(--brand-orange-text);
        background: var(--brand-orange-soft);
    }

/* Çoklu seçim için işaretlenebilir çipler. */
.chip-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem 0.375rem 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
}

    .chip-check input {
        width: 1rem;
        height: 1rem;
        accent-color: var(--brand-orange);
    }

    .chip-check:has(input:checked) {
        color: var(--brand-orange-text);
        background: var(--brand-orange-soft);
        border-color: #f9c69a;
    }

    .chip-check:has(input:focus-visible) {
        box-shadow: var(--focus-ring);
    }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.search-input {
    position: relative;
    min-width: 16rem;
}

    .search-input .icon {
        position: absolute;
        top: 50%;
        left: 0.75rem;
        color: var(--muted);
        transform: translateY(-50%);
        pointer-events: none;
    }

    .search-input .form-control {
        padding-left: 2.25rem;
    }

/* ---------- Boş ve yükleniyor durumları ---------- */

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 0.875rem;
    color: var(--brand-orange-text);
    background: var(--brand-orange-soft);
    border-radius: 12px;
}

.empty-state h2, .empty-state h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 650;
}

.empty-state p {
    max-width: 42ch;
    margin: 0 auto;
    font-size: 0.875rem;
    color: var(--muted);
}

.empty-state .btn {
    margin-top: 1rem;
}

.loading {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 2rem 1.25rem;
    color: var(--muted);
}

    .loading .spinner-border {
        width: 1.125rem;
        height: 1.125rem;
        border-width: 2px;
        color: var(--brand-orange);
    }

/* ---------- Uyarı kutuları ---------- */

.alert {
    display: flex;
    gap: 0.625rem;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--radius);
}

.alert-warning {
    --bs-alert-color: #93370d;
    --bs-alert-bg: #fffaeb;
    --bs-alert-border-color: #fedf89;
}

.alert-danger {
    --bs-alert-color: #912018;
    --bs-alert-bg: var(--red-soft);
    --bs-alert-border-color: #fecdca;
}

/* ---------- Haber görselleri ---------- */

.news-cell {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.news-cell-text {
    min-width: 0;
    max-width: 34rem;
}

    .news-cell-text a.cell-title {
        color: var(--ink);
    }

        .news-cell-text a.cell-title:hover {
            color: var(--brand-orange-text);
            text-decoration: none;
        }

.thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 64px;
    height: 44px;
    overflow: hidden;
    color: var(--muted);
    background: var(--gray-soft);
    border-radius: 8px;
}

    .thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.cover-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    color: var(--muted);
    text-align: center;
    background: var(--surface-2);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
}

    .cover-drop img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .cover-drop small {
        font-size: 0.8125rem;
    }

/* ---------- Blazor hata alanları ---------- */

.blazor-error-boundary {
    padding: 1rem 1rem 1rem 1.25rem;
    color: #912018;
    background: var(--red-soft);
    border: 1px solid #fecdca;
    border-radius: var(--radius);
}

    .blazor-error-boundary::after {
        content: "Bu bölüm yüklenirken bir hata oluştu. Sayfayı yenileyin.";
    }
