/* OrderKu - Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #EFF6FF;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface2: #F1F5F9;
    --border: #E2E8F0;
    --text: #1E293B;
    --text-muted: #64748B;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.04);
    --radius: 10px;
    --radius-sm: 6px;
    --sidebar-w: 240px;
}

[data-theme="dark"] {
    --primary: #A0714F;
    --primary-dark: #6F4E37;
    --primary-light: #2C1A0E;
    --bg: #1C1008;
    --surface: #2C1A0E;
    --surface2: #3A2213;
    --border: #4A2E1A;
    --text: #F5E6D3;
    --text-muted: #A08060;
    --shadow: 0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.3);
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    transition: background .3s, color .3s;
}

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

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

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s;
}

.sidebar-brand {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand .brand-icon {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 18px;
}

.brand-name { font-weight: 700; font-size: 16px; color: var(--text); }
.brand-sub  { font-size: 10px; color: var(--text-muted); }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-label {
    padding: 8px 16px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    border-radius: 0;
    transition: all .2s;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-item i { font-size: 16px; width: 20px; }

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title { font-weight: 700; font-size: 16px; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-body { padding: 24px; flex: 1; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title { font-weight: 700; font-size: 15px; }
.card-body  { padding: 20px; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #EFF6FF; color: #2563EB; }
.stat-icon.green  { background: #ECFDF5; color: #10B981; }
.stat-icon.yellow { background: #FFFBEB; color: #F59E0B; }
.stat-icon.red    { background: #FEF2F2; color: #EF4444; }

[data-theme="dark"] .stat-icon.blue   { background: #1e2d4a; color: #60a5fa; }
[data-theme="dark"] .stat-icon.green  { background: #062a1e; color: #34d399; }
[data-theme="dark"] .stat-icon.yellow { background: #2a1e06; color: #fbbf24; }
[data-theme="dark"] .stat-icon.red    { background: #2a0606; color: #f87171; }

.stat-value { font-size: 22px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-outline  { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--surface2); }
.btn-sm       { padding: 5px 10px; font-size: 12px; }

/* Forms */
.form-group   { margin-bottom: 16px; }
.form-label   { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: border .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); background: var(--surface2); border-bottom: 1px solid var(--border); }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: #ECFDF5; color: #10B981; }
.badge-warning { background: #FFFBEB; color: #D97706; }
.badge-danger  { background: #FEF2F2; color: #EF4444; }
.badge-info    { background: #EFF6FF; color: #2563EB; }
.badge-muted   { background: var(--surface2); color: var(--text-muted); }

[data-theme="dark"] .badge-success { background: #062a1e; color: #34d399; }
[data-theme="dark"] .badge-warning { background: #2a1e06; color: #fbbf24; }
[data-theme="dark"] .badge-danger  { background: #2a0606; color: #f87171; }
[data-theme="dark"] .badge-info    { background: #1e2d4a; color: #60a5fa; }

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
}
.alert-warning { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.alert-danger  { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }
.alert-success { background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; }
.alert-info    { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }

[data-theme="dark"] .alert-warning { background: #2a1e06; border-color: #92400e; color: #fbbf24; }
[data-theme="dark"] .alert-danger  { background: #2a0606; border-color: #991b1b; color: #f87171; }

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px;
    box-shadow: var(--shadow-md);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .icon {
    width: 56px; height: 56px;
    background: var(--primary);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    margin-bottom: 12px;
}

/* Order / Customer Page */
.order-page { max-width: 480px; margin: 0 auto; min-height: 100vh; }
.order-header { background: var(--primary); color: #fff; padding: 20px; }
.menu-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.menu-item-img { width: 70px; height: 70px; border-radius: 8px; object-fit: cover; background: var(--surface2); flex-shrink: 0; }
.menu-item-body { flex: 1; }
.menu-item-name { font-weight: 600; }
.menu-item-price { color: var(--primary); font-weight: 700; }

.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 28px; height: 28px; border: 1px solid var(--border); background: var(--surface); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; }

/* Cart floating */
.cart-bar {
    position: fixed;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--primary);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 -4px 12px rgba(0,0,0,.15);
}

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    animation: slideIn .3s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.danger  { border-left: 4px solid var(--danger); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* QR */
.qr-wrapper { text-align: center; padding: 16px; }
.qr-wrapper canvas { border-radius: 8px; }

/* Dark toggle */
.theme-toggle { cursor: pointer; background: none; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; color: var(--text); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 480px; box-shadow: var(--shadow-md); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.modal-body   { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* Order status colors */
.status-pending    { color: #D97706; }
.status-processing { color: #2563EB; }
.status-done       { color: #10B981; }
.status-cancelled  { color: #EF4444; }

/* Notification pulse */
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.2); } }
.notif-dot { width: 8px; height: 8px; background: var(--danger); border-radius: 50%; animation: pulse 1.5s infinite; display: inline-block; }

/* Subscription alert banner */
.sub-alert { position: sticky; top: 60px; z-index: 40; }
