:root {
    /* Premium Color Palette */
    --primary-color: #4F46E5;
    /* Indigo 600 */
    --primary-hover: #4338CA;
    --secondary-color: #10B981;
    /* Emerald 500 */
    --accent-color: #F59E0B;
    /* Amber 500 */
    --danger-color: #EF4444;
    /* Red 500 */

    --bg-dark: #0F172A;
    /* Slate 900 */
    --bg-card: #1E293B;
    /* Slate 800 */
    --bg-light: #F1F5F9;
    /* Slate 100 */

    --text-main: #F8FAFC;
    /* Slate 50 */
    --text-muted: #94A3B8;
    /* Slate 400 */
    --text-dark: #1E293B;

    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Spacing & Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;

    --font-main: 'Inter', sans-serif;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at top right, #312e81, #0f172a);
}

.auth-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.auth-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-menu {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    /* Scrollable */
    overflow-x: hidden;
    padding-right: 5px;
    /* Space for scrollbar */
}

/* Scrollbar Styling */
.nav-menu::-webkit-scrollbar {
    width: 6px;
}

.nav-menu::-webkit-scrollbar-track {
    background: transparent;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.nav-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--text-main);
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-dark);
    padding: 2rem;
}

/* Header */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Utilities */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* POS Specific */
.pos-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* Products : Cart */
    gap: 1.5rem;
    height: 100%;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.product-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid var(--glass-border);
}

.product-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.product-image {
    height: 120px;
    width: 100%;
    object-fit: cover;
    background-color: #334155;
}

.product-info {
    padding: 0.75rem;
}

.product-price {
    color: var(--secondary-color);
    font-weight: 700;
}

.cart-panel {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.cart-header {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.cart-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-footer {
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border);
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.btn-checkout {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 700;
}

.btn-checkout:hover {
    background-color: #059669;
}

/* Desktop Sidebar Collapse */
@media (min-width: 769px) {
    .sidebar {
        transition: width 0.3s ease;
    }

    .sidebar.collapsed {
        width: 80px;
        padding: 1.5rem 0.5rem;
    }

    .sidebar.collapsed .logo span {
        display: none;
    }

    .sidebar.collapsed .logo {
        justify-content: center;
        font-size: 1.25rem;
    }

    .sidebar.collapsed .nav-link {
        justify-content: center;
        padding: 0.875rem 0;
    }

    .sidebar.collapsed .nav-link span {
        display: none;
    }

    .sidebar.collapsed .nav-link i {
        font-size: 1.25rem;
        margin: 0;
    }
}

/* ==================== */
/* UI Polish & Animations */
/* ==================== */

/* Smooth transitions for all interactive elements */
button,
.btn-primary,
.nav-link,
.product-card,
.card {
    transition: all 0.2s ease;
}

/* Enhanced buttons with hover effects */
.btn-primary:active {
    transform: scale(0.98);
}

/* Table Styling */
table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    text-align: left;
    padding: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--glass-border);
}

table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

table tbody tr {
    transition: background-color 0.2s ease;
}

table tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.05);
}

/* Card Hover Effect */
.card {
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* Stats Cards Polish */
.stat-card {
    background: linear-gradient(145deg, var(--bg-card), rgba(30, 41, 59, 0.8));
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Modal Animations */
.modal {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal[style*="flex"] {
    opacity: 1;
}

/* Input Focus Glow */
.form-input:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
    border-color: var(--primary-color);
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Pulse Animation for alerts */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ==================== */
/* Mobile Responsiveness */
/* ==================== */

#sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 1rem;
    display: block;
}

@media (max-width: 768px) {

    /* Layout */
    .app-container {
        position: relative;
    }

    /* Main content padding */
    .main-content {
        padding: 1rem;
    }

    /* Sidebar - Slide in */
    .sidebar {
        position: absolute;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 50;
        transition: left 0.3s ease-in-out;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.active {
        left: 0;
    }

    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
        backdrop-filter: blur(2px);
    }

    .sidebar.active+.sidebar-overlay {
        display: block;
    }

    /* POS Layout - Stack */
    .pos-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        gap: 1rem;
        height: auto;
        min-height: calc(100vh - 100px);
    }

    .product-grid {
        max-height: 35vh;
        min-height: 180px;
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .cart-panel {
        max-height: none;
        min-height: auto;
        overflow: visible;
    }

    .cart-items {
        max-height: 120px;
        overflow-y: auto;
    }

    .cart-footer {
        position: relative;
        padding-bottom: 1rem;
    }

    .btn-checkout {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
        position: relative;
        z-index: 10;
    }

    /* Grid Adjustments */
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    /* Table - Responsive */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    table th,
    table td {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    /* Header */
    #sidebar-toggle {
        display: block;
    }

    .top-bar {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .page-title {
        flex: 1;
        font-size: 0.9rem;
    }

    .user-profile span {
        display: none;
    }

    /* Card */
    .card {
        padding: 1rem;
    }

    /* Stat Cards */
    .stat-card {
        padding: 1rem;
    }

    /* Modal Responsiveness */
    .auth-card {
        margin: 1rem;
        padding: 1.5rem;
        max-width: calc(100vw - 2rem);
    }

    /* Form inputs */
    .form-input {
        padding: 0.65rem 0.75rem;
        font-size: 0.9rem;
    }

    /* Button sizes */
    .btn-primary {
        padding: 0.65rem;
        font-size: 0.9rem;
    }

    /* Product card on mobile */
    .product-card {
        font-size: 0.85rem;
    }

    .product-image {
        height: 80px;
    }

    .product-info {
        padding: 0.5rem;
    }

    .product-info h4 {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .product-price {
        font-size: 0.9rem;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .grid-cols-4 {
        grid-template-columns: 1fr !important;
    }

    .pos-layout {
        gap: 0.75rem;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .top-bar {
        margin-bottom: 1rem;
    }

    /* Even smaller modal */
    .auth-card {
        padding: 1rem;
    }
}