/**
 * Restaurant POS System - RestroPOS Integrated Theme
 * Brand Color Tokens updated to match the RestroPOS Image
 */

:root {
    /* Earthy Restaurant Palette */
    --primary: #5B7E3C; /* Olive Green */
    --primary-hover: #4a6831;
    --primary-light: #eef2eb;
    --primary-gradient: linear-gradient(135deg, #74a04d 0%, #5B7E3C 100%);
    
    --secondary: #ffffff; /* White background for Sidebars */
    --secondary-dark: #111827; /* Darker Slate for premium text */
    --secondary-hover: #f9fafb;
    
    --accent: #fbfbfb; /* Very light background */
    
    --success: #5B7E3C; /* Olive Green */
    --danger: #EA5252;  /* Soft Red */
    --warning: #FF9D23; /* Bright Orange */
    --info: #FFD65A;    /* Yellow/Gold */
    
    --light-success: #eef2eb;
    --light-danger: #fdeeee;
    --light-warning: #fff5e9;
    --light-info: #fffbef;
    --light-purple: #f5f3ff;
    
    --bg-occupied: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
    --bg-reserved: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    --bg-billing: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    --bg-cleaning: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    
    --sidebar-width: 260px;
    --sidebar-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    --card-hover-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
    --radius-lg: 24px;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background-color: var(--accent);
    overflow-x: hidden;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Dynamic SVG Icon overrides */
.lucide {
    display: inline-block;
    vertical-align: middle;
    width: 1.15em;
    height: 1.15em;
    stroke-width: 2px;
}

/* Layout Framework */
#app-wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    padding: 0;
    background-color: var(--accent);
}

#main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    position: relative;
    padding: 1rem 1rem 1rem 0;
    transition: var(--sidebar-transition);
}

@media (max-width: 768px) {
    #main-content {
        padding: 1rem;
    }
}

/* Detached Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: calc(100vh - 2rem);
    margin: 1rem;
    display: flex;
    flex-direction: column;
    background-color: var(--secondary) !important;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    transition: var(--sidebar-transition);
    z-index: 1040;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.sidebar .sidebar-header {
    border-bottom: 1px solid var(--border-color);
}
.sidebar .sidebar-user {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--secondary-hover);
}
.sidebar .nav {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    width: 100%;
    flex-wrap: nowrap;
}
.sidebar .nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar .nav::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}
.sidebar .nav-link {
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--text-secondary) !important;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}
.sidebar .nav-link:hover {
    background-color: var(--primary-light);
    color: var(--primary) !important;
    transform: translateX(4px);
}
.sidebar .nav-link.active {
    background: var(--primary-gradient) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.sidebar .nav-link.active i, .sidebar .nav-link.active svg {
    color: #ffffff !important;
}
.sidebar .nav-link i, .sidebar .nav-link svg {
    font-size: 1.15rem;
    color: var(--text-secondary);
}

/* Sidebar toggled positioning on Mobile views */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-width) - 2rem);
        margin: 1rem 0;
        height: calc(100vh - 2rem);
    }
    .sidebar.active {
        left: 0;
        margin: 1rem;
    }
}

/* Sidebar collapsed state for Desktop views (Animated Icon-Only) */
@media (min-width: 769px) {
    body.sidebar-collapsed .sidebar {
        width: 85px !important;
        min-width: 85px !important;
    }
    
    body.sidebar-collapsed .sidebar .sidebar-brand-text,
    body.sidebar-collapsed .sidebar .sidebar-user-details,
    body.sidebar-collapsed .sidebar .nav-section-title,
    body.sidebar-collapsed .sidebar .nav-link span {
        display: none !important;
    }
    
    body.sidebar-collapsed .sidebar .nav-link {
        justify-content: center !important;
        padding: 0.75rem 0 !important;
    }
    
    body.sidebar-collapsed .sidebar .nav-link i,
    body.sidebar-collapsed .sidebar .nav-link svg {
        margin: 0 !important;
        width: 22px !important;
        height: 22px !important;
    }
    
    body.sidebar-collapsed .sidebar .sidebar-header {
        padding: 1rem 0;
        justify-content: center !important;
    }
    
    body.sidebar-collapsed .sidebar .sidebar-user {
        padding: 1rem 0;
        justify-content: center !important;
    }
}

/* Detached Top Navbar Card */
.navbar-detached {
    background-color: white;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    padding: 0.75rem 1.25rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

/* Button overrides */
.btn-success {
    background: var(--primary-gradient);
    border: none;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.btn-success:hover, .btn-success:focus, .btn-success:active {
    background: var(--primary-gradient) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}
.btn-outline-success {
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-success:hover, .btn-outline-success:focus, .btn-outline-success:active {
    background-color: var(--primary) !important;
    color: white !important;
}
.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* POS Action Buttons Hover */
#btn-save-order, #btn-generate-kot, #btn-print-bill, #btn-quick-settle, #btn-hold-cart {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#btn-save-order:hover, #btn-generate-kot:hover, #btn-print-bill:hover, #btn-quick-settle:hover, #btn-hold-cart:hover {
    transform: translateY(-3px) scale(1.02);
    filter: brightness(1.05);
}

/* 3-Column POS Layout structure */
.pos-layout-3col {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

@media (max-width: 992px) {
    .pos-layout-3col {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }
    /* Left Panel: Horizontal Scroll on Mobile */
    .pos-3col-left {
        width: 100% !important;
        height: auto !important;
        flex-direction: row !important;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
    }
    .pos-3col-left > div {
        flex-direction: row !important;
        gap: 1rem;
    }
    /* Hide the welcome card on mobile */
    .pos-3col-left .mt-auto {
        display: none !important;
    }
    
    .pos-3col-center {
        width: 100% !important;
        height: calc(100vh - 180px) !important;
    }
    
    /* Cart Panel: Sliding Drawer on Mobile */
    .pos-3col-right {
        position: fixed !important;
        bottom: -100%;
        left: 0;
        width: 100% !important;
        height: 85vh !important;
        z-index: 1060;
        background: #f1f5f9;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 50px rgba(0,0,0,0.15);
        transition: bottom 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        margin: 0 !important;
        padding: 1rem !important;
    }
    .pos-3col-right.show-mobile-cart {
        bottom: 0;
    }
}

.pos-3col-left {
    display: none;
}

.pos-3col-center {
    width: 70%;
    display: flex;
    flex-direction: column;
}

.pos-3col-right {
    width: 30%;
    display: flex;
    flex-direction: column;
}

/* Adjust tables grid for 12-20 items */
#tables-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
}
.pos-table-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem 0.5rem;
}

.pos-panel-card {
    background: rgba(255, 255, 255, 0.85); /* Glassmorphism hint */
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.pos-panel-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: white;
}

.pos-panel-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8fafc;
}

.pos-table-card {
    cursor: pointer;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    padding: 1.25rem 1rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy hover */
    background: white;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}
.pos-table-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0,0,0,0.08);
}
/* Table Gradients based on image */
.pos-table-card.table-available {
    background: white;
}
.pos-table-card.table-occupied {
    background: var(--bg-occupied);
    border: none;
}
.pos-table-card.table-reserved {
    background: var(--bg-reserved);
    border: none;
}
.pos-table-card.table-billing {
    background: var(--bg-billing);
    border: none;
}
.pos-table-card.selected {
    box-shadow: 0 0 0 2px var(--primary);
}

/* Products Layout */
.category-pill {
    white-space: nowrap;
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background-color: white;
}
.category-pill:hover, .category-pill.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    font-weight: 600;
}

.pos-product-card {
    border-radius: 20px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy hover */
    background-color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
.pos-product-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--primary);
}
.product-img-placeholder {
    height: 120px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

/* Cart Panel */
.receipt-list {
    flex-grow: 1;
}
.receipt-item {
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}
.receipt-item:last-child {
    border-bottom: none;
}

/* POS Bottom Calculation */
.pos-actions-bar {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    background-color: white;
}

/* =========================================
   LOGIN SCREEN - GLASSMORPHISM & ANIMATION
   ========================================= */

.login-bg {
    position: relative;
    overflow: hidden;
    background-color: #1a1a1a;
    z-index: 1;
}

/* Shifting Turn Animation for dishes */
@keyframes shiftTurn {
    0% { transform: scale(1) rotate(0deg) translate(0, 0); opacity: 0.8; }
    33% { transform: scale(1.1) rotate(10deg) translate(20px, -20px); opacity: 0.6; }
    66% { transform: scale(1.05) rotate(-5deg) translate(-15px, 15px); opacity: 0.9; }
    100% { transform: scale(1) rotate(0deg) translate(0, 0); opacity: 0.8; }
}

.login-bg::before, .login-bg::after, .login-dish-3 {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(8px);
    z-index: -1;
    animation: shiftTurn 20s infinite ease-in-out alternate;
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

.login-bg::before {
    width: 600px;
    height: 600px;
    top: -100px;
    left: -100px;
    background-image: url('../images/dishes/chicken_biryani_1782213734951.png');
    animation-delay: 0s;
}

.login-bg::after {
    width: 500px;
    height: 500px;
    bottom: -50px;
    right: -100px;
    background-image: url('../images/dishes/paneer_butter_masala_1782213713185.png');
    animation-delay: -5s;
}

.login-dish-3 {
    width: 400px;
    height: 400px;
    top: 30%;
    left: 40%;
    background-image: url('../images/dishes/butter_naan_1782213829257.png');
    animation-delay: -10s;
}

/* Add an overlay to darken the background images so the glass card pops out */
.login-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: -1;
}

.glass-card {
    background: rgba(255, 255, 255, 0.25) !important;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3) !important;
    border-radius: 24px !important;
    color: #fff;
}

.glass-card h4, .glass-card .form-label, .glass-card .form-check-label {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.glass-card .form-control, .glass-card .input-group-text {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #333;
}

.glass-card .form-control::placeholder {
    color: #666;
}

/* Tweak drawer for contrast over dark bg */
#devCredentialsDrawer {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px);
}

/* =========================================
   SWEETALERT2 MODERNIZATION
   ========================================= */
div:where(.swal2-container) div:where(.swal2-popup) {
    border-radius: 20px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 2em;
    font-family: inherit;
}
div:where(.swal2-container) h2:where(.swal2-title) {
    font-weight: 700;
    color: #1e293b;
    font-size: 1.5rem;
}
div:where(.swal2-container) div:where(.swal2-html-container) {
    color: #475569;
    font-size: 1.05rem;
    line-height: 1.6;
}
div:where(.swal2-container) button:where(.swal2-styled) {
    border-radius: 12px !important;
    font-weight: 600;
    padding: 10px 24px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08) !important;
}
div:where(.swal2-container) button:where(.swal2-styled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.12) !important;
}
