/* ========================================================
   QR MENU — DESIGN SYSTEM
   Modern, mobile-first, restoran odaklı tema
   ======================================================== */

:root {
    /* Brand */
    --brand-50:  #fff7ed;
    --brand-100: #ffedd5;
    --brand-200: #fed7aa;
    --brand-300: #fdba74;
    --brand-400: #fb923c;
    --brand-500: #f97316;
    --brand-600: #ea580c;
    --brand-700: #c2410c;
    --brand-800: #9a3412;
    --brand-900: #7c2d12;

    /* Neutrals */
    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --slate-950: #020617;

    /* Semantic — light theme */
    --bg:        var(--slate-50);
    --surface:   #ffffff;
    --surface-2: var(--slate-100);
    --surface-3: var(--slate-200);
    --border:    #e5e7eb;
    --border-soft: #eef0f3;
    --text:      var(--slate-900);
    --text-soft: var(--slate-600);
    --muted:     var(--slate-400);
    --primary:       var(--brand-600);
    --primary-hover: var(--brand-700);
    --primary-soft:  var(--brand-50);
    --accent:        var(--slate-800);

    --success: #10b981;
    --error:   #ef4444;
    --warning: #f59e0b;
    --info:    #3b82f6;

    /* Shape */
    --r-xs: 4px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;
    --r-2xl: 32px;
    --r-full: 9999px;

    /* Shadow */
    --sh-xs: 0 1px 2px rgb(15 23 42 / 0.04);
    --sh-sm: 0 1px 3px rgb(15 23 42 / 0.06), 0 1px 2px rgb(15 23 42 / 0.04);
    --sh-md: 0 4px 12px -2px rgb(15 23 42 / 0.08), 0 2px 4px rgb(15 23 42 / 0.04);
    --sh-lg: 0 12px 32px -8px rgb(15 23 42 / 0.16), 0 4px 12px -4px rgb(15 23 42 / 0.08);
    --sh-xl: 0 24px 48px -12px rgb(15 23 42 / 0.24);

    /* Type */
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    /* Layout */
    --sidebar-w: 264px;
    --topbar-h:  64px;
}

[data-theme="dark"] {
    --bg:        #0f172a;             /* slate-900, daha rahat */
    --surface:   #1e293b;             /* slate-800 */
    --surface-2: #273449;             /* hafif daha açık */
    --surface-3: #334155;             /* slate-700 */
    --border:    rgba(255,255,255,0.08);
    --border-soft: rgba(255,255,255,0.05);
    --text:      #f1f5f9;             /* slate-100 */
    --text-soft: #cbd5e1;             /* slate-300 */
    --muted:     #94a3b8;             /* slate-400 */
    --primary-soft: rgba(249, 115, 22, 0.18);
    --sh-xs: 0 1px 2px rgb(0 0 0 / 0.25);
    --sh-sm: 0 2px 6px rgb(0 0 0 / 0.3);
    --sh-md: 0 6px 16px -2px rgb(0 0 0 / 0.4);
    --sh-lg: 0 16px 40px -8px rgb(0 0 0 / 0.55);
}
/* Dark mode için card/elements ek tatlandırıcılar */
[data-theme="dark"] .card { background: #1e293b; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .stat-card { background: linear-gradient(135deg, #1e293b, #1a2540); }
[data-theme="dark"] .data-table th { background: #1a2540; color: #94a3b8; }
[data-theme="dark"] .data-table tr:hover td { background: rgba(249, 115, 22, 0.05); }
[data-theme="dark"] .btn-ghost { background: #1e293b; color: #f1f5f9; border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .btn-ghost:hover { background: #273449; }
[data-theme="dark"] .icon-btn { background: #1e293b; color: #cbd5e1; border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .icon-btn:hover { background: #273449; color: #f1f5f9; }
[data-theme="dark"] .icon-btn.danger:hover { background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(239,68,68,0.4); }
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .input { background: #1e293b; color: #f1f5f9; border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder { color: #64748b; }
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus,
[data-theme="dark"] .input:focus { border-color: var(--primary); background: #243349; }
[data-theme="dark"] .modal-dialog { background: #1e293b; border: 1px solid rgba(255,255,255,0.08); }
[data-theme="dark"] .modal-foot { background: #1a2540; }
[data-theme="dark"] .alert { background: #1e293b; }
[data-theme="dark"] .alert-success { background: rgba(16,185,129,0.12); color: #6ee7b7; }
[data-theme="dark"] .alert-error   { background: rgba(239,68,68,0.12); color: #fca5a5; }
[data-theme="dark"] .alert-info    { background: rgba(59,130,246,0.12); color: #93c5fd; }
[data-theme="dark"] .alert-warning { background: rgba(245,158,11,0.12); color: #fcd34d; }
[data-theme="dark"] .toast { background: #0f172a; border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .empty-state { color: #64748b; }
[data-theme="dark"] code { background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 4px; }
[data-theme="dark"] hr { border-color: rgba(255,255,255,0.08); }

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; transition: color 0.15s; }
img, svg, video { display: block; max-width: 100%; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }

::selection { background: var(--brand-200); color: var(--brand-900); }

/* ============== UTILITY ============== */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.soft { color: var(--text-soft); }
.small { font-size: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.inline { display: inline-block; }
.hidden { display: none !important; }
.mt-md { margin-top: 16px; }
.mb-md { margin-bottom: 16px; }
.p-0 { padding: 0 !important; }

/* ============== BUTTONS ============== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 10px 18px;
    font-size: 14px; font-weight: 600; line-height: 1;
    border: 1px solid transparent; border-radius: var(--r-md);
    cursor: pointer; user-select: none;
    transition: transform 0.05s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--primary); color: #fff;
    box-shadow: var(--sh-sm), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost {
    background: var(--surface); color: var(--text);
    border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--error); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: transparent; color: var(--text-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: #fee2e2; color: var(--error); border-color: #fecaca; }
.icon-btn svg { width: 18px; height: 18px; }

/* ============== FORMS ============== */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; margin-bottom: 6px;
    font-size: 13px; font-weight: 600; color: var(--text-soft);
}
.form-group input,
.form-group select,
.form-group textarea,
.input {
    display: block; width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--muted); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-group input[type="color"] { height: 44px; padding: 4px; cursor: pointer; }
.form-group input:disabled,
.form-group select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }
.form-stack > * + * { margin-top: 16px; }
.form-actions { display: flex; gap: 8px; padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--border-soft); }

@media (max-width: 600px) {
    .form-row-2 { grid-template-columns: 1fr; }
}

.checkbox {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 14px; cursor: pointer; user-select: none;
}
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.checkbox-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }

.input-with-icon { position: relative; }
.input-with-icon input { padding-right: 40px; }
.input-icon-btn {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--muted);
    width: 32px; height: 32px; border-radius: var(--r-sm); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.input-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.search-input { min-width: 240px; }

/* ============== SWITCH ============== */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; cursor: pointer; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; inset: 0;
    background: var(--surface-3); border-radius: var(--r-full);
    transition: background 0.2s;
}
.switch .slider::before {
    content: ''; position: absolute; left: 2px; top: 2px;
    width: 20px; height: 20px; background: #fff; border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgb(15 23 42 / 0.18);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch.sm { width: 32px; height: 18px; }
.switch.sm .slider::before { width: 14px; height: 14px; }
.switch.sm input:checked + .slider::before { transform: translateX(14px); }

/* ============== ALERTS ============== */
.alert {
    padding: 12px 16px; border-radius: var(--r-md);
    margin: 12px 0; font-size: 14px;
    border-left: 4px solid var(--info);
    background: var(--surface);
    box-shadow: var(--sh-xs);
}
.alert-success { border-left-color: var(--success); background: #ecfdf5; color: #064e3b; }
.alert-error   { border-left-color: var(--error);   background: #fef2f2; color: #991b1b; }
.alert-info    { border-left-color: var(--info);    background: #eff6ff; color: #1e3a8a; }
.alert-warning { border-left-color: var(--warning); background: #fffbeb; color: #78350f; }

/* ============== CARDS ============== */
.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 16px;
}
.card-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ============== TOAST ============== */
.toast-host {
    position: fixed; right: 16px; bottom: 16px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    padding: 12px 18px; min-width: 240px; max-width: 380px;
    background: var(--slate-900); color: #fff;
    border-radius: var(--r-md);
    box-shadow: var(--sh-lg);
    font-size: 14px;
    animation: toast-in 0.25s cubic-bezier(.2,.8,.2,1);
    border-left: 3px solid var(--info);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }
@keyframes toast-in {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ============== MODAL ============== */
.modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
@media (max-width: 600px) {
    .modal { padding: 8px; }
}
@media (max-width: 480px) {
    .modal { padding: 0; align-items: stretch; }
    .modal .modal-dialog {
        max-width: 100vw !important;
        /* dvh = dynamic viewport height — iOS Safari address bar'ını dikkate alır */
        max-height: 100dvh !important;
        max-height: 100vh !important;  /* fallback */
        max-height: 100dvh !important;
        height: 100dvh;
        height: 100vh;  /* fallback */
        height: 100dvh;
        border-radius: 0;
        margin: 0;
    }
}
.modal[hidden] { display: none; }
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgb(15 23 42 / 0.55);
    backdrop-filter: blur(6px);
    animation: fade-in 0.2s ease;
}
.modal-dialog {
    position: relative;
    width: 100%; max-width: 480px;
    max-height: calc(100vh - 40px);
    background: var(--surface);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-xl);
    overflow: hidden;
    display: flex; flex-direction: column;
    animation: modal-in 0.25s cubic-bezier(.2,.8,.2,1);
}
.modal-dialog.wide { max-width: 760px; }
@keyframes modal-in {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Modal içinde <form> wrapper varsa onu da flex column yap → body scroll çalışsın */
.modal-dialog > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.modal-head {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-soft);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;  /* Sabit kalsın, scroll olmasın */
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;  /* KRİTİK: flex column içinde scrollable için zorunlu */
    -webkit-overflow-scrolling: touch;  /* iOS smooth scroll */
}
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .modal-grid { grid-template-columns: 1fr; } }
.modal-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border-soft);
    display: flex; gap: 8px; justify-content: flex-end;
    background: var(--surface-2);
    flex-shrink: 0;  /* Sabit altta kalsın */
}

/* ============== LINKS / DOTS / EMPTY ============== */
.link { color: var(--primary); cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.strong { font-weight: 600; }

.dot {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; flex-shrink: 0; background: var(--muted);
}
.dot.dot-pending     { background: var(--warning); }
.dot.dot-completed   { background: var(--success); }
.dot.dot-cancelled   { background: var(--muted); }
.dot.dot-in_progress { background: var(--info); }

.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty-state.full { grid-column: 1 / -1; }

/* ============== ERROR PAGES ============== */
.error-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background:
      radial-gradient(circle at 20% 20%, rgba(249,115,22,0.10), transparent 40%),
      radial-gradient(circle at 80% 80%, rgba(15,23,42,0.05), transparent 40%),
      var(--bg);
}
.error-card {
    background: var(--surface);
    padding: 48px 32px; text-align: center;
    border-radius: var(--r-2xl);
    box-shadow: var(--sh-xl);
    max-width: 480px;
    border: 1px solid var(--border-soft);
}
.error-code {
    font-size: 96px; font-weight: 900; line-height: 1;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.error-card h1 { margin: 16px 0 8px; font-size: 22px; }
.error-card p { color: var(--text-soft); margin-bottom: 24px; }

/* ============== BRAND ============== */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: inherit; }
.brand-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    color: #fff; border-radius: var(--r-md);
    font-weight: 800; font-size: 13px; letter-spacing: 0.02em;
    box-shadow: 0 4px 10px -2px rgba(249,115,22,0.4);
}
