/* --- BASE RESET & VARIABLES --- */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

:root {
    --primary: #FF6B35;
    --primary-dark: #E85A2A;
    --secondary: #FFD23F;
    --success: #4CAF50;
    --danger: #f44336;
    --dark: #1a1a2e;
    --light: #fff;
    --gray: #f5f5f5;
    --gray-dark: #999;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.2);
    --info: #0984e3;
    --purple: #6c5ce7;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--gray);
    color: var(--dark);
    line-height: 1.6;
}

/* --- NAVIGATION --- */
nav {
    background: var(--light);
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

/* --- ADMIN DASHBOARD CORE --- */
.admin-view { 
    min-height: 100vh; 
    background: var(--gray); 
}

.admin-nav { 
    background: var(--dark); 
    color: var(--light); 
    padding: 20px 30px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.logout-btn { 
    background: var(--primary); 
    color: var(--light); 
    padding: 10px 25px; 
    border-radius: 25px; 
    border: none; 
    font-weight: 700; 
    cursor: pointer; 
    transition: 0.3s;
}

.logout-btn:hover { background: var(--primary-dark); transform: scale(1.05); }

.admin-container { 
    max-width: 1400px; 
    margin: 0 auto; 
    padding: 40px 30px; 
}

.admin-tabs-container { 
    display: flex; 
    gap: 15px; 
    margin-bottom: 40px; 
    flex-wrap: wrap; 
}

.admin-tab-btn { 
    background: var(--light); 
    color: var(--dark); 
    padding: 15px 30px; 
    border: 2px solid var(--gray); 
    border-radius: 15px; 
    font-weight: 700; 
    cursor: pointer; 
    transition: all 0.3s ease; 
}

.admin-tab-btn.active { 
    background: var(--primary); 
    color: var(--light); 
    border-color: var(--primary); 
}

.admin-tab-content { display: none; }
.admin-tab-content.active { 
    display: block; 
    animation: fadeIn 0.5s ease-out; 
}

/* --- STATS GRID --- */
.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 25px; 
    margin-bottom: 40px; 
}

.stat-card { 
    background: var(--light); 
    padding: 30px; 
    border-radius: 20px; 
    box-shadow: 0 4px 20px var(--shadow); 
    border-left: 5px solid var(--primary); 
}

.stat-value { 
    font-size: 2.8rem; 
    font-weight: 800; 
    color: var(--primary); 
    margin-bottom: 10px; 
}

/* --- TABLES --- */
.table-container { 
    background: var(--light); 
    border-radius: 20px; 
    overflow: hidden; 
    box-shadow: 0 4px 20px var(--shadow); 
}

.table-header { 
    background: var(--dark); 
    color: var(--light); 
    padding: 20px 30px; 
    display: flex;
    justify-content: space-between;
    align-items: center;
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 18px 20px; text-align: left; border-bottom: 1px solid var(--gray); }
th { background: var(--gray); font-weight: 700; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px; color: var(--dark); }

/* --- ORDER BILL (IN-TABLE VIEW) --- */
.bill-container { max-width: 280px; }

.order-bill-item {
    display: flex;
    justify-content: space-between;
    background: #f1f2f6;
    padding: 6px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    font-size: 0.85rem;
    border-left: 3px solid var(--primary);
}

.price-text {
    color: var(--success);
    font-weight: 800;
    font-size: 1.1rem;
}

/* --- BUTTONS & STATUS --- */
.table-btn { 
    padding: 8px 16px; 
    border: none; 
    border-radius: 8px; 
    font-weight: 600; 
    cursor: pointer; 
    transition: 0.2s;
}

.table-btn:hover { transform: translateY(-2px); filter: brightness(1.1); box-shadow: var(--shadow); }

.bill-btn { background: var(--dark); color: var(--secondary); border: 1px solid var(--secondary); }
.edit-btn { background: var(--info); color: var(--light); }
.complete { background: var(--success); color: var(--light); }
.delete { background: var(--danger); color: var(--light); }
.refresh-btn { background: var(--purple); color: var(--light); border: none; border-radius: 25px; padding: 10px 20px; cursor: pointer; font-weight: 600; }

.status-badge { padding: 6px 15px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; }
.tag-pending { background: #ffeaa7; color: #d63031; }
.tag-completed { background: #55efc4; color: #00b894; }

.order-row.completed { opacity: 0.7; background-color: #fcfcfc; }

/* --- EDIT ORDER MODAL UI --- */
.edit-order-body { max-height: 400px; overflow-y: auto; padding: 10px 5px; }

.edit-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray);
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.edit-qty-controls { display: flex; align-items: center; gap: 12px; }

.edit-qty-controls button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: white;
    color: var(--primary);
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-qty-controls button:hover { background: var(--primary); color: white; }

.final-bill-summary {
    background: var(--dark);
    color: var(--secondary);
    padding: 20px;
    border-radius: 15px;
    text-align: right;
    margin-top: 20px;
}

.final-bill-summary h3 { font-size: 1.5rem; font-weight: 800; }

.delete-item-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; transition: 0.2s; }
.delete-item-btn:hover { transform: scale(1.2); }

/* --- THERMAL RECEIPT (BILL MODAL) --- */
#billPrintArea {
    background: #fff;
    color: #000;
}

@media print {
    body * { visibility: hidden; }
    #billPrintArea, #billPrintArea * { visibility: visible; }
    #billPrintArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 20px;
    }
}

/* --- MODALS GENERAL --- */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    background: rgba(0, 0, 0, 0.7); 
    z-index: 2000; 
    align-items: center; 
    justify-content: center; 
}

.modal.show { display: flex; }

.modal-content { 
    background: var(--light); 
    border-radius: 25px; 
    padding: 35px; 
    width: 90%; 
    max-width: 550px;
    animation: scaleIn 0.3s ease; 
}

/* NEW: CANCEL, UPDATE, & SAVE BUTTONS */
.modal-btn { 
    padding: 12px 25px; 
    border-radius: 12px; 
    border: none; 
    font-weight: 700; 
    cursor: pointer; 
    transition: 0.3s;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
}

.modal-btn.primary { 
    background: var(--primary); 
    color: white; 
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.modal-btn.secondary { 
    background: var(--gray); 
    color: var(--dark); 
    border: 1px solid #ddd;
}

.modal-btn:hover { 
    transform: translateY(-2px); 
    box-shadow: var(--shadow-lg); 
    filter: brightness(1.05);
}

@keyframes scaleIn { 
    from { transform: scale(0.8); opacity: 0; } 
    to { transform: scale(1); opacity: 1; } 
}

.close-btn { 
    background: none; 
    border: none; 
    font-size: 1.8rem; 
    cursor: pointer; 
    color: var(--gray-dark); 
    line-height: 1;
}

.close-btn:hover { color: var(--danger); }

/* --- MENU MANAGEMENT CARD --- */
.add-item-card { 
    background: var(--light); 
    padding: 35px; 
    border-radius: 20px; 
    box-shadow: 0 4px 20px var(--shadow); 
    margin-bottom: 40px; 
}

.form-row { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 20px; 
}

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; }
.form-group input, .form-group select { 
    width: 100%; 
    padding: 12px; 
    border: 2px solid var(--gray); 
    border-radius: 10px; 
    font-family: inherit; 
}

.checkout-btn { 
    width: 100%; 
    background: var(--success); 
    color: white; 
    padding: 15px; 
    border-radius: 12px; 
    border: none; 
    font-weight: 700; 
    cursor: pointer; 
    transition: 0.3s;
}

.checkout-btn:hover { background: #3d8b40; }

/* --- ANIMATIONS & UTILS --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 768px) {
    .nav-container { padding: 15px; }
    .hero h1 { font-size: 2.5rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .table-container { overflow-x: auto; }
    .admin-tab-btn { padding: 10px 15px; font-size: 0.9rem; }
}