/* zerreLab Core Design Tokens & Accessible Layout System (360px / 768px / 1440px) */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --z-bg-canvas: #090D16;
    --z-bg-surface: #111827;
    --z-bg-elevated: #1E293B;
    --z-text-primary: #F8FAFC;
    --z-text-secondary: #94A3B8;
    --z-border-subtle: #334155;
    --z-accent-primary: #38BDF8;
    --z-accent-hover: #0EA5E9;
    --z-accent-soft: #0C4A6E;
    --z-danger: #EF4444;
    --z-danger-soft: rgba(239, 68, 68, 0.16);
    --z-success: #10B981;
    --z-success-soft: rgba(16, 185, 129, 0.16);
    --z-warning: #F59E0B;
    --z-warning-soft: rgba(245, 158, 11, 0.16);
    --z-font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --z-font-display: 'Inter', system-ui, -apple-system, sans-serif;
    --z-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --z-radius-sm: 8px;
    --z-radius-md: 12px;
    --z-radius-lg: 16px;
    --z-shadow-card: 0 8px 24px rgba(0, 0, 0, 0.18);
    --z-touch-min: 44px;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100dvh;
    background-color: var(--z-bg-canvas);
    color: var(--z-text-primary);
    font-family: var(--z-font-sans);
    line-height: 1.55;
    overflow-x: hidden;
}

/* Klavye erisilebilirlik odak halkasi (§8) */
:focus-visible {
    outline: 2px solid var(--z-accent-primary);
    outline-offset: 2px;
}

.z-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Marka logosu oran koruma ve mobil sinir (§3) */
.z-brand-logo {
    width: auto;
    max-width: 240px;
    object-fit: contain;
    display: block;
}

@media (max-width: 767px) {
    .z-brand-logo {
        max-width: 160px !important;
    }
}

/* Ust cubuk ve yuzey kabugu */
.z-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    background-color: var(--z-bg-surface);
    border-bottom: 1px solid var(--z-border-subtle);
}

.z-topbar-admin {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.z-topbar-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.z-topbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.z-topbar-admin .z-topbar-actions {
    justify-self: end;
    flex-wrap: nowrap;
}

.z-admin-tab-hidden {
    display: none !important;
}

@media (max-width: 960px) {
    .z-topbar-admin {
        display: flex;
        flex-wrap: wrap;
    }
    .z-topbar-tabs {
        order: 3;
        width: 100%;
        padding-top: 0.35rem;
        border-top: 1px solid var(--z-border-subtle);
    }
}

/* Salt okunur Editor Gozuyle Goruntule ve Acil Karantina seritleri */
.z-banner-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-bottom: 1px solid var(--z-border-subtle);
}

.z-banner-preview {
    background-color: var(--z-warning-soft);
    color: var(--z-text-primary);
}

.z-banner-quarantine {
    background-color: var(--z-danger-soft);
    color: var(--z-text-primary);
}

/* 12 sutunlu Bento yerlesimi (Rehber §3: masaustunde 12 sutun, kucuk ekranda tek sutun) */
.z-shell-main {
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
    padding: 1.25rem;
}

.z-grid-12 {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
}

.z-col-12 { grid-column: span 12; }
.z-col-8  { grid-column: span 8; }
.z-col-7  { grid-column: span 7; }
.z-col-6  { grid-column: span 6; }
.z-col-5  { grid-column: span 5; }
.z-col-4  { grid-column: span 4; }

@media (max-width: 1024px) {
    .z-col-8, .z-col-7, .z-col-6, .z-col-5, .z-col-4 {
        grid-column: span 12;
    }
}

@media (max-width: 480px) {
    .z-shell-main {
        padding: 0.75rem;
    }
    .z-topbar {
        padding: 0.5rem 0.75rem;
    }
}

/* Kartlar ve calisma kutulari */
.z-card {
    background-color: var(--z-bg-surface);
    border: 1px solid var(--z-border-subtle);
    border-radius: var(--z-radius-md);
    padding: 1.15rem;
    box-shadow: var(--z-shadow-card);
}

.z-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--z-border-subtle);
}

.z-card-title {
    margin: 0;
    font-family: var(--z-font-display);
    font-size: 1.05rem;
    font-weight: 600;
}

.z-card-sub {
    margin: 0.2rem 0 0;
    font-size: 0.84rem;
    color: var(--z-text-secondary);
}

/* Calisma kutusu Zen Modu (§8: klavye/dokunma cikisli, secim ve konumu koruyan tam alan) */
.z-workbox-zen-active {
    position: fixed !important;
    inset: 0 !important;
    z-index: 90 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    overflow: auto !important;
    background-color: var(--z-bg-surface) !important;
}

/* Dokunma hedefi en az 44x44 piksel olan buton ve ikon kontrolleri (§8) */
.z-btn,
.z-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: var(--z-touch-min);
    min-width: var(--z-touch-min);
    padding: 0.55rem 0.95rem;
    border-radius: var(--z-radius-sm);
    border: 1px solid var(--z-border-subtle);
    background-color: var(--z-bg-elevated);
    color: var(--z-text-primary);
    font-family: var(--z-font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.z-icon-btn {
    padding: 0.5rem;
}

.z-btn:hover:not(:disabled),
.z-icon-btn:hover:not(:disabled) {
    border-color: var(--z-accent-primary);
}

.z-btn-primary {
    background-color: var(--z-accent-primary);
    border-color: var(--z-accent-primary);
    color: #041019;
    font-weight: 600;
}

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

.z-btn-danger {
    background-color: var(--z-danger-soft);
    border-color: var(--z-danger);
    color: var(--z-text-primary);
}

.z-btn:disabled,
.z-icon-btn:disabled,
[data-field-locked="1"] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Form elemanlari */
.z-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
}

.z-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--z-text-primary);
}

.z-input,
.z-select,
.z-textarea {
    width: 100%;
    min-height: var(--z-touch-min);
    padding: 0.6rem 0.8rem;
    border-radius: var(--z-radius-sm);
    border: 1px solid var(--z-border-subtle);
    background-color: var(--z-bg-canvas);
    color: var(--z-text-primary);
    font-family: var(--z-font-sans);
    font-size: 0.94rem;
}

.z-textarea-mono {
    font-family: var(--z-font-mono);
    font-size: 0.83rem;
    line-height: 1.45;
    min-height: 220px;
    resize: vertical;
}

/* Yama gorsel fark (diff) kutusu (§6.C) */
.z-diff-box {
    font-family: var(--z-font-mono);
    font-size: 0.8rem;
    background-color: var(--z-bg-canvas);
    border: 1px solid var(--z-border-subtle);
    border-radius: var(--z-radius-sm);
    padding: 0.75rem;
    overflow-x: auto;
    white-space: pre;
}

.z-diff-add {
    background-color: rgba(16, 185, 129, 0.16);
    display: block;
}

.z-diff-del {
    background-color: rgba(239, 68, 68, 0.16);
    display: block;
}

/* Duyarli tablolar */
.z-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--z-border-subtle);
    border-radius: var(--z-radius-sm);
}

.z-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.z-table th,
.z-table td {
    padding: 0.65rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--z-border-subtle);
}

.z-table th {
    background-color: var(--z-bg-elevated);
    font-weight: 600;
}

/* Modal katmani */
.z-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: rgba(3, 7, 18, 0.75);
}

.z-modal-backdrop[hidden] {
    display: none !important;
}

.z-modal-dialog {
    width: 100%;
    max-width: 560px;
    max-height: 90dvh;
    overflow-y: auto;
    background-color: var(--z-bg-surface);
    border: 1px solid var(--z-border-subtle);
    border-radius: var(--z-radius-lg);
    padding: 1.25rem;
    box-shadow: var(--z-shadow-card);
}

/* Sag alt Toast bildirim yasam dongusu ve "Tumunu Kapat" kontrolu (§4.A) */
.z-toast-region {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: min(420px, calc(100vw - 2rem));
    pointer-events: none;
}

.z-toast-dismiss-all {
    pointer-events: auto;
    min-height: 36px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.z-toast-item {
    pointer-events: auto;
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.75rem 0.95rem;
    border-radius: var(--z-radius-sm);
    border: 1px solid var(--z-border-subtle);
    background-color: var(--z-bg-surface);
    color: var(--z-text-primary);
    box-shadow: var(--z-shadow-card);
    font-size: 0.88rem;
}

.z-toast-danger {
    border-color: var(--z-danger);
    background-color: var(--z-bg-surface);
}

.z-toast-success {
    border-color: var(--z-success);
}