/* ============================================
   KareKodun - Dark UI Tema Sistemi (Altın/Turuncu Accent)
   ============================================ */

:root {
    --bg: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-card-hover: #212121;
    --border: #2a2a2a;
    --accent: #f2a207;
    --accent-hover: #cd7501;
    --accent-soft: rgba(242, 162, 7, 0.12);
    --text: #f2f2f2;
    --text-muted: #9a9a9a;
    --text-dim: #6b6b6b;
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { font-family: 'Poppins', 'Inter', sans-serif; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.01em; }

/* ---- Layout ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 252px;
    background: #0a0a0a;
    border-right: 1px solid var(--border);
    padding: 22px 14px 24px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 6px 10px 20px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo img { display: block; height: 34px; width: auto; }

.sidebar-nav { display: flex; flex-direction: column; flex: 1; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--text-muted);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: var(--bg-card-hover); color: var(--text); }
.sidebar-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-nav a.logout-link { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--text-dim); }
.sidebar-nav a.logout-link:hover { color: var(--danger); background: transparent; }

.main-content { flex: 1; padding: 36px 44px; max-width: 1120px; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 22px; margin-bottom: 3px; }
.topbar .business-name {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; color: var(--text-muted); font-weight: 500;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    margin-bottom: 20px;
    transition: border-color .15s;
}

.card:hover { border-color: #333; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

.stat-card { text-align: left; transition: transform .15s, border-color .15s; }
.stat-card:hover { transform: translateY(-2px); border-color: rgba(242,162,7,0.35); }
.stat-card .stat-value { font-family: 'Poppins', sans-serif; font-size: 34px; font-weight: 700; margin-bottom: 4px; line-height: 1.1; }
.stat-card .stat-label { color: var(--text-muted); font-size: 13px; font-weight: 500; }

/* ---- Forms ---- */
label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="file"], input[type="date"], select, textarea {
    width: 100%;
    background: #0d0d0d;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 16px;
    transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; }

/* ---- Telefon input grubu (+90 sabit önek) ---- */
.phone-input-group { display: flex; align-items: stretch; margin-bottom: 16px; border-radius: var(--radius-sm); transition: box-shadow .15s; }
.phone-prefix {
    display: flex; align-items: center; justify-content: center;
    padding: 0 14px; background: #161616; border: 1px solid var(--border); border-right: 1px solid var(--border);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--accent); font-size: 14px; font-weight: 700; white-space: nowrap;
}
.phone-input-group input {
    margin-bottom: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    letter-spacing: 0.03em; border-left: none;
}
.phone-input-group:focus-within .phone-prefix { border-color: var(--accent); }
.phone-input-group input:focus { position: relative; z-index: 1; }

/* ---- Telefon yanındaki WhatsApp ikonu (admin panel işletme listesi) ---- */
.phone-with-wa { display: inline-flex; align-items: center; gap: 8px; }
.wa-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    background: #25D366; color: #fff; flex-shrink: 0;
    transition: transform .15s;
}
.wa-link:hover { transform: scale(1.1); color: #fff; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.checkbox-row input[type="checkbox"] { width: auto; margin: 0; }
.checkbox-row label { margin: 0; color: var(--text); font-weight: 400; }

.allergen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.allergen-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0d0d0d;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
}
.allergen-chip:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.allergen-chip input { width: auto; margin: 0; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: #232323; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #2a2a2a; color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---- Table ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: #232323; color: var(--text-muted); }

/* ---- Progress bar (uyum skoru) ---- */
.progress-track { background: #0d0d0d; border-radius: 100px; height: 10px; overflow: hidden; margin: 10px 0; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 100px; transition: width 0.3s; }
.progress-fill.warning { background: var(--warning); }
.progress-fill.success { background: var(--success); }

/* ---- Auth pages ---- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-box { width: 100%; max-width: 400px; }
.auth-box .card { padding: 32px; }
.auth-logo { text-align: center; font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.auth-logo span { color: var(--accent); }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }

/* ---- Alerts / flash ---- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--accent-soft); color: var(--accent); }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }

/* ---- Utility ---- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-20 { margin-bottom: 20px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }

/* ============================================
   Public QR Menü Sayfası
   ============================================ */
.menu-page { max-width: 640px; margin: 0 auto; padding-bottom: 60px; }
.menu-header {
    padding: 28px 20px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.menu-header .biz-name { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.menu-header .biz-meta { color: var(--text-muted); font-size: 13px; }
.menu-header .price-updated {
    display: inline-block;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-dim);
    background: #1a1a1a;
    padding: 4px 10px;
    border-radius: 100px;
}

.allergen-filter-bar {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
}
.allergen-filter-bar summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.filter-chip {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 100px;
    background: #1a1a1a;
    border: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
}
.filter-chip.excluded { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.menu-category { padding: 24px 20px 4px; }
.menu-category h2 { font-size: 16px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px; }

.menu-item {
    display: flex;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.menu-item img { width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; background: #1a1a1a; }
.menu-item-body { flex: 1; }
.menu-item-top { display: flex; justify-content: space-between; gap: 10px; }
.menu-item-name { font-weight: 600; font-size: 15px; }
.menu-item-price { font-weight: 700; color: var(--accent); white-space: nowrap; }
.menu-item-desc { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.menu-item-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 100px; background: #1a1a1a; color: var(--text-muted); border: 1px solid var(--border); }
.tag-allergen { color: var(--warning); border-color: transparent; background: var(--warning-soft); }
.tag-calorie { color: var(--text-dim); }
.tag-vegan { color: var(--success); background: var(--success-soft); }

.menu-footer-note {
    text-align: center;
    color: var(--text-dim);
    font-size: 11px;
    padding: 24px 20px 0;
}

/* ---- QR Kart / Yazdırma (A5) ---- */
.qr-card {
    width: 148mm;
    height: 210mm;
    background: #fff;
    color: #111;
    margin: 0 auto;
    padding: 30mm 15mm;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
}
.qr-card .qr-biz-name { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.qr-card .qr-instruction { font-size: 14px; color: #555; margin-bottom: 24px; }
.qr-card img.qr-code { width: 60mm; height: 60mm; }
.qr-card .qr-note { margin-top: 24px; font-size: 11px; color: #888; }

@media print {
    body { background: #fff; }
    .no-print { display: none !important; }
    .qr-card { border: none; margin: 0; }
}

/* ---- Responsive ---- */
@media (max-width: 800px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; display: flex; align-items: center; gap: 4px; padding: 12px 16px; overflow-x: auto; }
    .sidebar-logo { margin: 0 12px 0 0; padding: 0; border-bottom: none; }
    .sidebar-logo img { height: 26px; }
    .sidebar-nav { display: flex; gap: 4px; }
    .sidebar-nav a { white-space: nowrap; margin-bottom: 0; }
    .main-content { padding: 20px; }
    .form-row { grid-template-columns: 1fr; }
}

/* ---- Platform Admin Paneli — Mobil ---- */
@media (max-width: 760px) {
    .admin-wrap { padding: 20px 14px !important; }
    .admin-topbar { flex-direction: column; align-items: flex-start !important; gap: 14px; }
    .admin-search-form { flex-direction: column; align-items: stretch !important; width: 100%; }
    .admin-search-form input[type="text"] { min-width: 0 !important; width: 100%; }
    .admin-search-form .btn { width: 100%; }

    /* Tabloyu kart listesine çevir */
    table.admin-table thead { display: none; }
    table.admin-table, table.admin-table tbody, table.admin-table tr, table.admin-table td { display: block; width: 100%; }
    table.admin-table tr {
        margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius);
        padding: 14px; background: #161616;
    }
    table.admin-table td {
        display: flex; justify-content: space-between; align-items: center;
        padding: 7px 0; border-bottom: 1px solid var(--border); text-align: right;
    }
    table.admin-table td:last-child { border-bottom: none; }
    table.admin-table td.td-business {
        display: block; text-align: left; padding-bottom: 10px; margin-bottom: 4px;
        border-bottom: 1px solid var(--border);
    }
    table.admin-table td[data-label]:not(.td-business)::before {
        content: attr(data-label); font-weight: 600; color: var(--text-muted);
        text-align: left; margin-right: 12px; flex-shrink: 0;
    }
    table.admin-table td[data-label=""]::before { content: none; }
}
