:root {
    --bg: #ffffff;
    --fg: #111111;
    --muted: #555555;
    --faint: #888888;
    --line: #e5e5e5;
    --soft: #fafafa;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --danger-border: #fca5a5;
    --success: #166534;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;
}

[data-theme="dark"] {
    --bg: #0f1117;
    --fg: #e8eaf0;
    --muted: #9ba3b4;
    --faint: #5e6679;
    --line: #272c38;
    --soft: #161b27;
    --accent: #4f8ef7;
    --accent-hover: #6ba3ff;
    --danger: #f87171;
    --danger-bg: #2d1515;
    --danger-border: #7f2020;
    --success: #4ade80;
    --success-bg: #0d2318;
    --success-border: #1a5c35;
}

/* TEMA TOGGLE BUTONU */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 5px 8px;
    cursor: pointer;
    color: var(--muted);
    font-size: 15px;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: var(--soft);
    border-color: var(--muted);
    color: var(--fg);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    word-break: break-word;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

code, pre, .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    word-break: break-all;
    overflow-wrap: anywhere;
}

img {
    max-width: 100%;
    height: auto;
}

/* 10 KASIM ANMA SATIRI */
.memorial-bar {
    border-bottom: 1px solid var(--line);
    padding: 6px 16px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    background: var(--soft);
}

.memorial-bar strong {
    color: var(--fg);
    margin: 0 6px;
}

/* HEADER & NAVBAR */
.header-nav {
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    order: 1;
}

.brand-link {
    color: var(--fg);
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.sidebar-open-btn {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.sidebar-open-btn:hover {
    background: var(--soft);
    border-color: var(--muted);
}

.nav-toggle-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--fg);
    border-radius: 1px;
}

/* ==========================================================================
   SOL AÇILIR KAPANIR MENÜ (OFF-CANVAS SIDEBAR DRAWER)
   ========================================================================== */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

body.sidebar-no-scroll {
    overflow: hidden;
}

.sidebar-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 290px;
    max-width: 85vw;
    height: 100vh;
    background: var(--bg);
    border-right: 1px solid var(--line);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
}

.sidebar-drawer.is-open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--soft);
}

.sidebar-brand {
    font-size: 15px;
    font-weight: 600;
    color: var(--fg);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.sidebar-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
}

.sidebar-close-btn:hover {
    color: var(--fg);
}

.sidebar-body {
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.sidebar-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--faint);
    font-weight: 600;
    margin: 16px 0 8px 0;
}

.sidebar-section-title:first-child {
    margin-top: 0;
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--fg);
    text-decoration: none;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
    background: var(--soft);
    color: var(--accent);
}

.sidebar-danger-link {
    color: var(--danger) !important;
    font-weight: 500;
}

.sidebar-danger-link:hover {
    background: var(--danger-bg) !important;
}

.sidebar-level-box {
    display: flex;
    border: 1px solid var(--line);
    border-radius: 3px;
    overflow: hidden;
}

.sidebar-level-box a {
    flex: 1;
    text-align: center;
    padding: 6px 0;
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
    border-right: 1px solid var(--line);
    transition: background 0.15s, color 0.15s;
}

.sidebar-level-box a:last-child {
    border-right: none;
}

.sidebar-level-box a.active {
    background: var(--fg);
    color: var(--bg);
    font-weight: 600;
}

.sidebar-user-card {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 13px;
}

.sidebar-user-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    background: var(--soft);
    border: 1px solid var(--line);
    color: var(--muted);
}

.badge-accent {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

/* Masaüstünde menü ikinci satıra alınır: 12 bağlantı tek satıra sığmadığı
   için sarma yerine bilinçli iki satırlık başlık kullanılır. */
.nav-menu {
    display: flex;
    flex: 1 0 100%;
    order: 3;
    align-items: center;
    gap: 12px;
    list-style: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-menu::-webkit-scrollbar {
    display: none;
}

.nav-menu a {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    padding: 4px 2px;
    display: inline-block;
    transition: color 0.15s;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--fg);
    font-weight: 500;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    order: 2;
    margin-left: auto;
}

.level-selector {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 3px;
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
    overflow: hidden;
}

.level-selector a {
    padding: 3px 7px;
    color: var(--muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.level-selector a.active {
    background: var(--fg);
    color: var(--bg);
}

/* CONTAINER */
.main-wrapper {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 16px;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

/* TYPOGRAPHY */
h1 {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--fg);
    margin-bottom: 6px;
}

h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--fg);
    margin-bottom: 6px;
}

h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg);
    margin-bottom: 4px;
}

p {
    color: var(--muted);
    margin-bottom: 12px;
    overflow-wrap: anywhere;
}

.faint-text {
    color: var(--faint);
}

/* CARDS */
.card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.card-soft {
    background: var(--soft);
}

.card-center {
    max-width: 440px;
    width: 100%;
    margin: 30px auto;
}

.card-center-medium {
    max-width: 580px;
    width: 100%;
    margin: 20px auto;
}

.text-center {
    text-align: center;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--line);
    gap: 8px;
    flex-wrap: wrap;
}

.meta-label {
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--faint);
    font-weight: 600;
}

.meta-success {
    color: var(--success);
}

.meta-danger {
    color: var(--danger);
}

/* GRIDS & LAYOUTS */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    align-items: start;
    margin-bottom: 24px;
}

.split-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    align-items: start;
}

.split-layout-wide {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 16px;
    align-items: start;
}

/* Grid çocukları varsayılan olarak min-content genişliğine göre büyür;
   içindeki tablo/kod blokları kolonu taşımasın diye sıfırlıyoruz. */
.split-layout > *,
.split-layout-wide > * {
    min-width: 0;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--fg);
    font-family: inherit;
    line-height: 1.2;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--muted);
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-danger {
    background: var(--bg);
    color: var(--danger);
    border-color: var(--danger-border);
}

.btn-danger:hover {
    background: var(--danger-bg);
}

.btn-block {
    width: 100%;
}

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

.btn-row-center {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* FORMS */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--fg);
}

.form-control {
    width: 100%;
    max-width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 7px 10px;
    color: var(--fg);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.form-control:focus {
    border-color: var(--accent);
}

.form-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.form-inline .form-control {
    flex: 1 1 200px;
    min-width: 0;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--faint);
    overflow-wrap: anywhere;
}

/* ALERTS */
.alert {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    margin-bottom: 16px;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.alert-error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

.alert-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
}

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

/* TABLES & RESPONSIVE CONTAINERS */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: 3px;
    margin-bottom: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
    min-width: 480px;
}

th, td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    background: var(--soft);
    color: var(--muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

tr:last-child td {
    border-bottom: none;
}

.cell-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* PRE / CODE PANELS */
pre {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    color: var(--fg);
    line-height: 1.45;
    margin: 8px 0;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.code-box {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 8px 10px;
    margin: 8px 0;
    overflow-wrap: anywhere;
}

.code-box-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--faint);
    margin-bottom: 4px;
}

.score-display {
    font-weight: 600;
    font-size: 16px;
}

/* DETAILS / ACCORDION */
details {
    border: 1px solid var(--line);
    border-radius: 3px;
    margin-top: 8px;
    background: var(--soft);
    font-size: 13px;
}

details summary {
    padding: 8px 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--muted);
    outline: none;
    user-select: none;
}

details summary:hover {
    color: var(--fg);
}

details .details-body {
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    background: var(--bg);
    overflow-wrap: anywhere;
}

.space-top {
    margin-top: 12px;
}

.space-top-lg {
    margin-top: 16px;
}

.ticket-date {
    margin-top: 8px;
    font-size: 11px;
    color: var(--faint);
    text-align: right;
}

/* FOOTER */
footer {
    border-top: 1px solid var(--line);
    padding: 14px 16px;
    font-size: 12px;
    color: var(--muted);
    background: var(--bg);
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-reset-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    padding: 0;
    font-family: inherit;
}

.footer-reset-btn:hover {
    color: var(--danger);
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (Mobil, Tablet & Masaüstü)
   ========================================================================== */

/* Üst menü 1120px altında yan menüye devredilir; dar ekranda marka
   metni sıkışıp satır kırılmasın ve nav/contoller taşmasın. */
@media (max-width: 1120px) {
    .nav-menu {
        display: none;
    }

    .user-controls {
        display: none;
    }
}

/* Tablet & Küçük Ekranlar (<= 860px) */
@media (max-width: 860px) {
    .split-layout,
    .split-layout-wide {
        grid-template-columns: 1fr;
    }
}

/* Mobil Ekranlar (<= 560px) */
@media (max-width: 560px) {
    .main-wrapper {
        padding: 16px 12px;
    }

    h1 {
        font-size: 19px;
    }

    .page-header {
        flex-direction: column;
        gap: 10px;
    }

    .page-header .btn-row {
        width: 100%;
    }

    .page-header .btn-row .btn {
        flex: 1 1 auto;
    }

    .grid-cards {
        grid-template-columns: 1fr;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline .btn {
        width: 100%;
    }

    .card {
        padding: 14px 12px;
    }

    .card-center,
    .card-center-medium {
        margin: 12px auto;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .cell-truncate {
        max-width: 130px;
    }
}
