/* ============================================================
   Restaurant POS - Main Stylesheet
   Professional Dark Theme with Gold Accents
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
    --primary:       #C0392B;
    --primary-dark:  #922B21;
    --primary-light: #E74C3C;
    --gold:          #D4AC0D;
    --gold-light:    #F4D03F;
    --sidebar-bg:    #1a1a2e;
    --sidebar-hover: #16213e;
    --sidebar-active:#0f3460;
    --topbar-bg:     #ffffff;
    --body-bg:       #f0f2f5;
    --card-bg:       #ffffff;
    --text-dark:     #1a1a2e;
    --text-muted:    #6c757d;
    --text-light:    #adb5bd;
    --border-color:  #e9ecef;
    --success:       #27ae60;
    --warning:       #f39c12;
    --danger:        #e74c3c;
    --info:          #2980b9;
    --sidebar-width: 260px;
    --topbar-height: 65px;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg:     0 8px 40px rgba(0,0,0,0.12);
    --transition:    all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--body-bg);
    color: var(--text-dark);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar.collapsed { width: 70px; }
.sidebar.collapsed .brand-info,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 0; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 14px; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--gold));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    color: white;
    box-shadow: 0 4px 12px rgba(192,57,43,0.4);
}

.brand-info h5 {
    color: white;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 16px;
    margin: 0;
    white-space: nowrap;
}

.brand-info small {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Sidebar User */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
}

.user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--gold));
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info strong {
    display: block;
    color: white;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.role-badge {
    background: rgba(212,172,13,0.2);
    color: var(--gold-light);
    border: 1px solid rgba(212,172,13,0.3);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.nav-label {
    color: rgba(255,255,255,0.3);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 12px 20px 6px;
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    margin: 2px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.nav-item:hover {
    color: white;
    background: rgba(255,255,255,0.08);
    transform: translateX(2px);
}

.nav-item.active {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 15px rgba(192,57,43,0.4);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    right: -8px; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 60%;
    background: var(--gold);
    border-radius: 2px 0 0 2px;
}

.nav-badge {
    margin-left: auto;
    background: var(--primary-light);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 22px;
    text-align: center;
}

.text-danger-nav { color: rgba(231,76,60,0.7) !important; }
.text-danger-nav:hover { color: var(--danger) !important; background: rgba(231,76,60,0.1) !important; }

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.main-wrapper.expanded { margin-left: 70px; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-toggle {
    width: 36px; height: 36px;
    border: none;
    background: var(--body-bg);
    border-radius: var(--radius-sm);
    color: var(--text-dark);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    font-size: 16px;
}
.topbar-toggle:hover { background: var(--primary); color: white; }

.breadcrumb { font-size: 13px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }

.topbar-time {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    background: var(--body-bg);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-family: 'Poppins', monospace;
}

.btn-pos-quick {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-pos-quick:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(192,57,43,0.4); color: white; }

.topbar-user-btn {
    display: flex; align-items: center; gap: 8px;
    background: var(--body-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    transition: var(--transition);
}
.topbar-user-btn:hover { border-color: var(--primary); }

.user-avatar-sm {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--gold));
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
    flex: 1;
    padding: 24px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
    background: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header i {
    color: var(--primary);
    font-size: 16px;
}

/* ============================================================
   STATS CARDS
   ============================================================ */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 0 var(--radius) 0 100%;
    opacity: 0.1;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.info::before    { background: var(--info); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.stat-icon.primary { background: rgba(192,57,43,0.12); color: var(--primary); }
.stat-icon.success { background: rgba(39,174,96,0.12); color: var(--success); }
.stat-icon.warning { background: rgba(243,156,18,0.12); color: var(--warning); }
.stat-icon.info    { background: rgba(41,128,185,0.12); color: var(--info); }
.stat-icon.gold    { background: rgba(212,172,13,0.12); color: var(--gold); }

.stat-value {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-change {
    font-size: 12px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    padding: 9px 18px;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(192,57,43,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(192,57,43,0.4); color: white; }

.btn-success {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    color: white;
    box-shadow: 0 4px 12px rgba(39,174,96,0.3);
}
.btn-success:hover { transform: translateY(-1px); color: white; }

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #d68910);
    color: white;
    box-shadow: 0 4px 12px rgba(243,156,18,0.3);
}
.btn-warning:hover { transform: translateY(-1px); color: white; }

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #c0392b);
    color: white;
}
.btn-danger:hover { transform: translateY(-1px); color: white; }

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}
.btn-outline-primary:hover { background: var(--primary); color: white; }

.btn-gold {
    background: linear-gradient(135deg, var(--gold), #b7950b);
    color: white;
    box-shadow: 0 4px 12px rgba(212,172,13,0.3);
}
.btn-gold:hover { transform: translateY(-1px); color: white; }

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive { border-radius: var(--radius); overflow: hidden; }

.table {
    margin: 0;
    font-size: 14px;
}

.table thead th {
    background: var(--body-bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    padding: 14px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    border-color: var(--border-color);
    vertical-align: middle;
}

.table tbody tr:hover { background: rgba(192,57,43,0.04); }

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-pending  { background: rgba(243,156,18,0.12); color: #d68910; }
.status-preparing{ background: rgba(41,128,185,0.12); color: #1a6fa0; }
.status-ready    { background: rgba(39,174,96,0.12);  color: #1e8449; }
.status-completed{ background: rgba(39,174,96,0.15);  color: #1e8449; }
.status-cancelled{ background: rgba(231,76,60,0.12);  color: #c0392b; }
.status-available{ background: rgba(39,174,96,0.12);  color: #1e8449; }
.status-occupied { background: rgba(192,57,43,0.12);  color: var(--primary); }
.status-reserved { background: rgba(41,128,185,0.12); color: var(--info); }

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    transition: var(--transition);
    background: white;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.12);
    outline: none;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i {
    color: var(--primary);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-content {
    border-radius: var(--radius);
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius) var(--radius) 0 0;
    border: none;
    padding: 18px 24px;
}

.modal-header .btn-close { filter: invert(1); opacity: 0.8; }
.modal-title { font-weight: 700; font-size: 16px; }
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border-color); padding: 16px 24px; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
    position: fixed;
    top: 80px; right: 20px;
    z-index: 9999;
}

.toast-custom {
    background: white;
    border-left: 4px solid var(--success);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    animation: slideIn 0.3s ease;
}

.toast-custom.error  { border-left-color: var(--danger); }
.toast-custom.warning{ border-left-color: var(--warning); }
.toast-custom.info   { border-left-color: var(--info); }

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

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

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(192,57,43,0.15), transparent 70%);
    top: -200px; right: -200px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212,172,13,0.1), transparent 70%);
    bottom: -100px; left: -100px;
}

.login-card {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}

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

.login-logo .logo-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--gold));
    border-radius: 18px;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 32px;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(192,57,43,0.4);
}

.login-logo h2 {
    font-family: 'Poppins', sans-serif;
    color: white;
    font-weight: 800;
    font-size: 26px;
}

.login-logo p {
    color: rgba(255,255,255,0.5);
    font-size: 13px;
}

.login-card .form-control {
    background: rgba(255,255,255,0.07);
    border: 1.5px solid rgba(255,255,255,0.1);
    color: white;
    border-radius: 10px;
    padding: 13px 16px 13px 44px;
}

.login-card .form-control::placeholder { color: rgba(255,255,255,0.3); }
.login-card .form-control:focus {
    background: rgba(255,255,255,0.12);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 3px rgba(192,57,43,0.2);
}

.login-card .form-label { color: rgba(255,255,255,0.7); }

.login-input-group {
    position: relative;
    margin-bottom: 16px;
}

.login-input-group i {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.35);
    font-size: 15px;
    z-index: 1;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: white;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
    letter-spacing: 0.5px;
}

.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(192,57,43,0.5); }

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: rgba(255,255,255,0.3);
    font-size: 12px;
}

/* ============================================================
   DROPDOWN MENU
   ============================================================ */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px;
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: 13px;
    transition: var(--transition);
}

.dropdown-item:hover { background: rgba(192,57,43,0.08); color: var(--primary); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    padding: 14px 18px;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0 !important; }
    .page-content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .stat-value { font-size: 22px; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.text-primary { color: var(--primary) !important; }
.text-gold    { color: var(--gold) !important; }
.bg-primary   { background: var(--primary) !important; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }

.img-item {
    width: 44px; height: 44px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--body-bg);
}

.img-placeholder {
    width: 44px; height: 44px;
    background: var(--body-bg);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    font-size: 18px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.active { display: block; }
