/* Chaat GPT - Mobile First Dark Theme */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --accent-light: rgba(249, 115, 22, 0.15);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --purple: #8b5cf6;
    --cyan: #06b6d4;
    --border: #334155;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.4);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bottom-nav-height: 64px;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Typography */
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }

/* Layout */
.app-container {
    padding-bottom: calc(var(--bottom-nav-height) + 16px);
    min-height: 100vh;
}

.page-header {
    padding: 16px 16px 12px;
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 50;
    border-bottom: 1px solid var(--border);
}

.page-header h1 { display: flex; align-items: center; gap: 8px; }
.page-header h1 svg { width: 24px; height: 24px; flex-shrink: 0; }

.page-content { padding: 16px; }

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

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

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-info { background: var(--info); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; min-width: 36px; }

.btn:disabled, .btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Forms */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

/* Toggle Switch */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-input);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Tables */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:hover { background: var(--bg-hover); }

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    min-width: 52px;
    gap: 2px;
}

.nav-item svg { width: 22px; height: 22px; }

.nav-item.active {
    color: var(--accent);
}

.nav-item.active svg { stroke: var(--accent); }

/* More Menu */
.nav-more-menu {
    position: fixed;
    bottom: var(--bottom-nav-height);
    right: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    display: none;
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    z-index: 101;
}

.nav-more-menu.show { display: block; }

.nav-more-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.nav-more-menu a:hover { background: var(--bg-hover); }
.nav-more-menu a svg { width: 18px; height: 18px; }

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 32px 24px;
}

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

.login-logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 340px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: #1e293b; }
.toast-info { background: var(--info); }

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

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
    animation: slideUp 0.3s ease;
}

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 1.2rem;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Order Cards */
.order-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 14px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.order-card:active { border-color: var(--accent); }

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-number {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent);
}

.order-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.order-items-preview {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.order-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.order-total {
    font-weight: 700;
    font-size: 1rem;
}

/* Kitchen Display */
.kitchen-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border-left: 4px solid var(--accent);
    padding: 16px;
    margin-bottom: 12px;
}

.kitchen-card.preparing { border-left-color: var(--purple); }
.kitchen-card.ready { border-left-color: var(--success); }

.kitchen-items {
    list-style: none;
    margin: 10px 0;
}

.kitchen-items li {
    padding: 6px 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}

.kitchen-items li:last-child { border-bottom: none; }

.item-qty {
    font-weight: 700;
    color: var(--accent);
    min-width: 32px;
}

/* Delivery Card */
.delivery-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 12px;
}

.delivery-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.delivery-actions .btn { flex: 1; }

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.tab .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 4px;
    padding: 0 5px;
}

/* Kanban Board */
.kanban-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.kanban-scroll::-webkit-scrollbar { display: none; }

.kanban-column {
    min-width: 280px;
    max-width: 300px;
    flex-shrink: 0;
}

.kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    font-weight: 600;
    font-size: 0.85rem;
}

.kanban-body {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 8px;
    min-height: 200px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Star Rating */
.star-rating { display: flex; gap: 4px; }

.star-rating .star {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.star-rating .star.active { color: var(--warning); }

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

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p { font-size: 0.9rem; }

/* Pulse Animation (for new orders) */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(249,115,22,0.4); }
    70% { box-shadow: 0 0 0 10px rgba(249,115,22,0); }
    100% { box-shadow: 0 0 0 0 rgba(249,115,22,0); }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Search */
.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-bar input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-bar svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

/* Utility */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.p-3 { padding: 12px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* Image preview */
.img-preview {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Responsive Desktop */
@media (min-width: 768px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }

    .bottom-nav { display: none; }

    .app-container {
        padding-bottom: 0;
        padding-left: 240px;
    }

    .sidebar {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 240px;
        background: var(--bg-secondary);
        border-right: 1px solid var(--border);
        z-index: 100;
        padding: 20px 0;
        overflow-y: auto;
    }

    .sidebar-logo {
        padding: 0 20px 20px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 12px;
    }

    .sidebar-logo h2 {
        color: var(--accent);
        font-size: 1.3rem;
        font-weight: 800;
    }

    .sidebar-nav { flex: 1; padding: 0 8px; }

    .sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 0.88rem;
        font-weight: 500;
        border-radius: var(--radius-sm);
        margin-bottom: 2px;
        transition: all 0.2s;
    }

    .sidebar-nav a:hover { background: var(--bg-hover); color: var(--text-primary); }
    .sidebar-nav a.active { background: var(--accent-light); color: var(--accent); }
    .sidebar-nav a svg { width: 20px; height: 20px; flex-shrink: 0; }

    .sidebar-footer {
        padding: 12px 20px;
        border-top: 1px solid var(--border);
        margin-top: auto;
    }
    .sidebar-footer svg { width: 18px; height: 18px; flex-shrink: 0; }

    .modal { border-radius: var(--radius); }
    .modal-overlay { align-items: center; }

    .page-content { padding: 24px; }
}

@media (max-width: 767px) {
    .sidebar { display: none !important; }
    .desktop-only { display: none !important; }
}

/* Print */
@media print {
    .bottom-nav, .sidebar, .page-header { display: none !important; }
    .app-container { padding: 0 !important; }
    body { background: #fff; color: #000; }
}
