:root {
    /* Color Palette */
    --primary: #4361ee;
    --primary-hover: #3a53d0;
    --secondary: #f8f9fa;
    --success: #2ec4b6;
    --success-hover: #26a599;
    --danger: #ef233c;
    --danger-hover: #d90429;
    --warning: #ff9f1c;
    --info: #4cc9f0;
    
    /* Backgrounds & Surfaces */
    --bg-body: #f4f7fe;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f8f9fa;
    --sidebar-bg: #ffffff;
    
    /* Text Colors */
    --text-main: #2b2d42;
    --text-muted: #8d99ae;
    --text-light: #ffffff;
    
    /* Borders & Shadows */
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    
    /* Specific UI Colors */
    --blue: #4361ee;
    --blue-light: #e0e8ff;
    --green: #2ec4b6;
    --green-light: #dcf5f2;
    --orange: #ff9f1c;
    --orange-light: #ffebd6;
    --red: #ef233c;
    --red-light: #fcdbd8;
    --purple: #7209b7;
    --purple-light: #eadcf2;
    --yellow: #ffb703;
    --yellow-light: #fff2cc;
    
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --sidebar-width: 260px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Dark Mode Theme */
body.dark-mode {
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --sidebar-bg: #1e293b;
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    
    --border-color: #334155;
    
    --blue-light: rgba(67, 97, 238, 0.2);
    --green-light: rgba(46, 196, 182, 0.2);
    --orange-light: rgba(255, 159, 28, 0.2);
    --red-light: rgba(239, 35, 60, 0.2);
    --purple-light: rgba(114, 9, 183, 0.2);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Hind Siliguri', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: var(--transition);
    overflow-x: hidden;
}

/* Typography Helpers */
.text-blue { color: var(--blue) !important; }
.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }

/* Background Helpers */
.bg-blue { background-color: var(--blue); color: white; }
.bg-green { background-color: var(--green); color: white; }
.bg-orange { background-color: var(--orange); color: white; }
.bg-red { background-color: var(--red); color: white; }
.bg-purple { background-color: var(--purple); color: white; }
.bg-yellow { background-color: var(--yellow); color: white; }

.bg-blue-light { background-color: var(--blue-light); }
.bg-green-light { background-color: var(--green-light); }
.bg-red-light { background-color: var(--red-light); }
.bg-orange-light { background-color: var(--orange-light); }
.bg-purple-light { background-color: var(--purple-light); }

/* Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

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

.sidebar-header h2 {
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shop-name {
    font-family: 'Hind Siliguri', sans-serif;
}

.nav-menu {
    list-style: none;
    padding: 20px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--blue-light);
    color: var(--primary);
}

.nav-item.active {
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

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

.top-header {
    background-color: var(--bg-surface);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

#page-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-main);
}

.current-date {
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-body);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.mobile-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
}

.content-area {
    padding: 30px;
    flex: 1;
    position: relative;
}

.page-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.page-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.card-info h3 {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 5px;
}

.card-info p {
    font-size: 1.6rem;
    font-weight: 700;
}

/* Panels & Tables */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.panel {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.panel-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
}

.table-responsive {
    overflow-x: auto;
}

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

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-body);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    transition: var(--transition);
}

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

.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success { background: var(--green-light); color: var(--green); }
.badge-danger { background: var(--red-light); color: var(--red); }
.badge-warning { background: var(--orange-light); color: var(--warning); }

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

.row {
    display: flex;
    gap: 15px;
}

.col {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1.1rem;
}

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

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

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

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background-color: var(--bg-body);
}

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

.w-100 { width: 100%; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-3 { margin-bottom: 16px; }
.border-bottom { border-bottom: 1px solid var(--border-color); }
.pb-2 { padding-bottom: 10px; }

/* Flex Helpers */
.flex-wrap { flex-wrap: wrap; gap: 15px; }
.header-controls { display: flex; gap: 15px; align-items: center; }

/* Search Box */
.search-box {
    position: relative;
}
.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-box input {
    padding-left: 35px;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.summary-card {
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
}
.summary-card h4 {
    color: var(--text-main);
    font-size: 1rem;
    margin-bottom: 10px;
    opacity: 0.8;
}
.summary-card h2 {
    color: var(--text-main);
    font-size: 1.8rem;
}

/* Sales System Layout */
.sales-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.info-box {
    background: var(--bg-body);
    padding: 10px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
}
.info-box small {
    display: block;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.info-box strong {
    font-size: 1.2rem;
}
.qty-input {
    display: flex;
    height: 44px;
}
.qty-input button {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    width: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-main);
    transition: var(--transition);
}
.qty-input button:hover {
    background: var(--border-color);
}
.qty-input input {
    flex: 1;
    width: 50px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-left: none;
    border-right: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    background: var(--bg-surface);
}

.cart-container {
    min-height: 250px;
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}
.cart-table {
    margin-bottom: 0;
}
.cart-summary {
    background: var(--bg-body);
    padding: 15px;
    border-radius: var(--radius-md);
}
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 500;
}
.summary-row.grand-total {
    margin-bottom: 0;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}
.modal.active {
    display: flex;
    animation: fadeInModal 0.3s ease;
}
@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}
.modal-content {
    background: var(--bg-surface);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    animation: slideUpModal 0.3s ease forwards;
}
.modal-content.modal-lg {
    max-width: 700px;
}
@keyframes slideUpModal {
    to { transform: translateY(0); }
}
.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 1.2rem;
    color: var(--text-main);
}
.close-modal {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
}
.close-modal:hover { color: var(--danger); }
.modal-body {
    padding: 20px;
}

/* Toast Notification */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--bg-surface);
    color: var(--text-main);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid var(--primary);
    transform: translateX(100%);
    animation: slideInRight 0.3s forwards;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast-icon { font-size: 1.2rem; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }

@keyframes slideInRight {
    to { transform: translateX(0); }
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}

/* Print Styles */
@media print {
    .sidebar, .top-header, .no-print { display: none !important; }
    .main-content { margin-left: 0; padding: 0; background: white; }
    .content-area { padding: 0; }
    body { background: white; color: black; }
    .panel { box-shadow: none; border: none; }
}

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    justify-content: space-around;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}
.bottom-nav-item i {
    font-size: 1.3rem;
    margin-bottom: 4px;
}
.bottom-nav-item.active {
    color: var(--primary);
}

/* Responsive Design */
@media (max-width: 992px) {
    .dashboard-grid, .sales-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 250px;
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .main-content {
        margin-left: 0;
        padding-bottom: 70px; /* Space for bottom nav */
    }
    .bottom-nav {
        display: flex;
    }
    .mobile-btn {
        display: block;
    }
    .header-right .current-date {
        display: none;
    }
    .panel-header h2 {
        font-size: 0.95rem;
    }
    .dashboard-cards {
        gap: 12px;
        margin-bottom: 15px;
    }
    .card {
        padding: 12px;
    }
    .card-info h3 {
        font-size: 0.8rem;
    }
    .card-info p {
        font-size: 1.05rem;
    }
    .panel {
        padding: 12px;
        margin-bottom: 12px;
    }
    .row { flex-direction: column; gap: 8px; }
    
    /* Shrink form elements on mobile */
    .form-group {
        margin-bottom: 8px;
    }
    .form-control {
        padding: 6px 10px;
        font-size: 0.85rem;
        height: auto;
    }
    .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* Modals act like bottom sheets on mobile */
    .modal {
        align-items: flex-end;
    }
    .modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        margin: 0;
        max-height: 90vh;
        overflow-y: auto;
        transform: translateY(100%);
        animation: slideUpMobile 0.3s ease forwards;
        padding: 15px;
    }
    @keyframes slideUpMobile {
        to { transform: translateY(0); }
    }

    /* Table Mobile Optimizations */
    .table-responsive {
        border: none;
    }
    table {
        border: 0;
    }
    table thead {
        display: none; /* Hide table headers */
    }
    table tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        background: var(--bg-surface-hover);
        padding: 8px;
    }
    table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed var(--border-color);
        padding: 6px 4px;
        font-size: 0.85rem;
    }
    table td:last-child {
        border-bottom: 0;
        justify-content: center;
        gap: 6px;
    }
    table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-align: left;
        font-size: 0.8rem;
    }
    .btn-sm {
        padding: 5px 8px;
        font-size: 0.8rem;
    }
}
