/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    /* Prevent body scroll */
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    /* Mobile viewport fix */
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: white;
    font-family: inherit;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Login Page Only */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1e1b4b 0%, var(--bg-dark) 40%);
    position: relative;
    overflow: hidden;
}

/* Animated Circles for Login Background */
.circle-blur {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    z-index: 0;
}

.cb-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
}

.cb-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary);
    bottom: -50px;
    left: -50px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    z-index: 10;
    padding: 2.5rem;
    border-radius: 1.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-muted);
    margin: 0;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Dashboard Layout */
.app-layout {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    width: 100%;
}

.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: var(--bg-dark);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    transition: 0.2s;
    font-weight: 500;
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

@media (hover: hover) {
    .nav-item:hover {
        background: rgba(99, 102, 241, 0.1);
        color: var(--primary);
        cursor: pointer;
    }
}

.nav-item i {
    width: 24px;
    margin-right: 0.75rem;
}

/* POS Specific */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    height: 100vh;
}

.products-area {
    padding: 1.5rem;
    overflow-y: auto;
}

.cart-area {
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.category-pills {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.cat-pill {
    padding: 0.5rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2rem;
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
    transition: 0.2s;
}

.cat-pill.active,
.cat-pill:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
}

.product-card {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
}

.product-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.product-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        will-change: transform;
        backface-visibility: hidden;
        /* Fix for blurry text on some devices */
        width: 280px;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
        /* backdrop-filter: blur(4px); Removed based on user feedback */
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: 1rem;
        margin-left: 0;
        width: 100%;
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll on iOS */
    }

    .mobile-menu-btn {
        display: inline-flex !important;
        margin-right: 1rem;
    }

    .mobile-close-btn {
        display: block !important;
    }

    /* Adjust Grid Layouts */
    .glass-panel>div[style*="grid-template-columns"],
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
    }

    /* Stack Header Elements */
    header[style*="display: flex"] {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    header[style*="display: flex"]>div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    /* Table Scrolling */
    .glass-panel {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
        white-space: nowrap;
        /* Force content width */
    }

    /* Force tables inside glass panels to scroll */
    .glass-panel[style*="overflow: hidden"] {
        overflow: visible !important;
        /* Reset default */
        overflow-x: auto !important;
        /* Force horizontal scroll */
    }

    /* Login Page */
    .login-card {
        margin: 1rem;
    }

    /* Stats Grid */
    div[style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: 1fr !important;
    }
}

.mobile-menu-btn {
    display: none;
}