/* ============================================
   498 Familyam Restaurant Management System
   Color Theme derived from brand logo
   Primary: Maroon #8B1A1A
   Secondary: Gold #E8A817
   ============================================ */

:root {
    /* Brand Colors from Logo */
    --primary: #8B1A1A;
    --primary-dark: #6B0F0F;
    --primary-light: #A52A2A;
    --secondary: #E8A817;
    --secondary-dark: #C48E10;
    --secondary-light: #F5C842;

    /* Neutrals */
    --white: #FFFFFF;
    --gray-50: #FAFAF8;
    --gray-100: #F5F3F0;
    --gray-200: #E8E5E0;
    --gray-300: #D1CCC4;
    --gray-400: #A8A29E;
    --gray-500: #78716C;
    --gray-600: #57534E;
    --gray-700: #44403C;
    --gray-800: #292524;
    --gray-900: #1C1917;

    /* Status Colors */
    --success: #16A34A;
    --warning: #D97706;
    --danger: #DC2626;
    --info: #2563EB;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

    /* Typography */
    --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Consolas', 'Monaco', monospace;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== LOGIN PAGE ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: var(--primary-dark);
    padding: 32px 40px 24px;
    text-align: center;
}

.login-header img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: contain;
    background: var(--white);
    padding: 6px;
    margin-bottom: 12px;
}

.login-header h1 {
    color: var(--secondary);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.login-header p {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    margin-top: 4px;
}

.login-body {
    padding: 32px 40px 40px;
}

.login-body .form-group {
    margin-bottom: 20px;
}

.login-body .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.login-body .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-family: var(--font-family);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--gray-50);
}

.login-body .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.1);
    background: var(--white);
}

.login-body .btn-login {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: var(--font-family);
}

.login-body .btn-login:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.login-body .btn-login:active {
    transform: translateY(0);
}

/* ===== LAYOUT ===== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-dark);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-brand img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: contain;
    background: var(--white);
    padding: 3px;
}

.sidebar-brand .brand-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary);
    line-height: 1.2;
}

.sidebar-brand .brand-text small {
    display: block;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.5);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

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

.nav-section-title {
    padding: 16px 20px 6px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: var(--white);
}

.nav-link.active {
    background: rgba(255,255,255,0.1);
    color: var(--secondary);
    border-left-color: var(--secondary);
    font-weight: 600;
}

.nav-link .icon {
    width: 22px;
    text-align: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.nav-link .material-icons-round {
    width: 22px;
    font-size: 20px;
    flex-shrink: 0;
    text-align: center;
}

.nav-link .badge-count {
    margin-left: auto;
    background: var(--danger);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary-dark);
    flex-shrink: 0;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-info .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-info .user-role {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    text-transform: capitalize;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left .page-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-800);
}

.header-left .breadcrumb {
    font-size: 0.8rem;
    color: var(--gray-400);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right .header-time {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
}

.btn-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--gray-700);
    cursor: pointer;
    padding: 6px;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 24px 28px;
}

/* ===== DASHBOARD CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: transform 0.15s, box-shadow 0.15s;
}

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

.stat-card .stat-info h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    font-weight: 600;
    margin-bottom: 6px;
}

.stat-card .stat-info .stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.1;
}

.stat-card .stat-info .stat-change {
    font-size: 0.78rem;
    margin-top: 6px;
    font-weight: 500;
}

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

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

.stat-icon.revenue { background: rgba(139,26,26,0.1); color: var(--primary); }
.stat-icon.orders { background: rgba(232,168,23,0.15); color: var(--secondary-dark); }
.stat-icon.tables { background: rgba(22,163,74,0.1); color: var(--success); }
.stat-icon.items { background: rgba(37,99,235,0.1); color: var(--info); }

/* ===== CARDS & PANELS ===== */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

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

.card-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-800);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ===== TABLES ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--gray-50);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    font-weight: 600;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table .text-right {
    text-align: right;
}

.data-table .text-center {
    text-align: center;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--gray-900);
}
.btn-secondary:hover {
    background: var(--secondary-dark);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}
.btn-success:hover {
    background: #15803d;
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}
.btn-danger:hover {
    background: #B91C1C;
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(139,26,26,0.04);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 13px 28px;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-primary { background: rgba(139,26,26,0.1); color: var(--primary); }
.badge-secondary { background: var(--gray-200); color: var(--gray-600); }
.badge-success { background: rgba(22,163,74,0.1); color: var(--success); }
.badge-warning { background: rgba(217,119,6,0.1); color: var(--warning); }
.badge-danger { background: rgba(220,38,38,0.1); color: var(--danger); }
.badge-info { background: rgba(37,99,235,0.1); color: var(--info); }

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 18px;
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--font-family);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
    color: var(--gray-800);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.08);
}

select.form-control {
    appearance: auto;
}

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

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

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-text {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--border-radius);
    margin-bottom: 18px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid;
}

.alert-success {
    background: rgba(22,163,74,0.06);
    color: #15803D;
    border-color: rgba(22,163,74,0.2);
}

.alert-danger {
    background: rgba(220,38,38,0.06);
    color: #B91C1C;
    border-color: rgba(220,38,38,0.2);
}

.alert-warning {
    background: rgba(217,119,6,0.06);
    color: #B45309;
    border-color: rgba(217,119,6,0.2);
}

.alert-info {
    background: rgba(37,99,235,0.06);
    color: #1D4ED8;
    border-color: rgba(37,99,235,0.2);
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

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

.modal {
    background: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== VEG / NON-VEG INDICATORS ===== */
.veg-badge {
    width: 16px;
    height: 16px;
    border: 2px solid #16A34A;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.veg-badge::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16A34A;
}

.nonveg-badge {
    width: 16px;
    height: 16px;
    border: 2px solid #DC2626;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nonveg-badge::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #DC2626;
}

/* ===== GRID LAYOUTS ===== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ===== TABLE STATUS GRID ===== */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

.table-tile {
    border-radius: var(--border-radius);
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.table-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.table-tile.available {
    background: rgba(22,163,74,0.08);
    border-color: rgba(22,163,74,0.2);
}

.table-tile.occupied {
    background: rgba(220,38,38,0.08);
    border-color: rgba(220,38,38,0.2);
}

.table-tile.reserved {
    background: rgba(217,119,6,0.08);
    border-color: rgba(217,119,6,0.2);
}

.table-tile .table-number {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--gray-800);
}

.table-tile .table-seats {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* ===== ORDER ITEMS ===== */
.order-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.order-item-row:last-child {
    border-bottom: none;
}

.order-item-name {
    flex: 1;
    font-weight: 500;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
}

.qty-control button {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-50);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-600);
    transition: background 0.15s;
}

.qty-control button:hover {
    background: var(--gray-200);
}

.qty-control .qty-value {
    width: 38px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    background: var(--white);
}

/* ===== BILL SUMMARY ===== */
.bill-summary {
    border-top: 2px solid var(--gray-200);
    padding-top: 16px;
    margin-top: 16px;
}

.bill-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.9rem;
}

.bill-row.total {
    border-top: 2px solid var(--gray-800);
    padding-top: 12px;
    margin-top: 8px;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
}

/* ===== UTILITIES ===== */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary-dark); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--gray-400); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state h3 {
    color: var(--gray-600);
    margin-bottom: 6px;
}

/* ===== SEARCH BOX ===== */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 40px;
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .btn-menu-toggle {
        display: block;
    }
    .content-area {
        padding: 16px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .grid-3 { grid-template-columns: 1fr; }
    .top-header {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .login-body {
        padding: 24px;
    }
}

/* Print styles */
@media print {
    .sidebar, .top-header, .btn, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0;
    }
    .content-area {
        padding: 0;
    }
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
