:root {
    /* Futuristic & Simple Color Palette */
    --primary: #8b5cf6;
    /* Vibrant Violet */
    --primary-glow: rgba(139, 92, 246, 0.4);
    --secondary: #64748b;
    --accent: #22d3ee;
    /* Cyan */
    --accent-glow: rgba(34, 211, 238, 0.3);

    --bg-main: #0f172a;
    /* Deep Slate (Futuristic Base) */
    --bg-surface: rgba(30, 41, 59, 0.7);
    --bg-sidebar: rgba(15, 23, 42, 0.95);
    --bg-card: rgba(255, 255, 255, 0.03);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-on-dark: #ffffff;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --border: rgba(255, 255, 255, 0.08);

    /* Design Tokens */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 25px 60px -12px rgba(0, 0, 0, 0.5);
    --glass: blur(12px) saturate(160%);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset & Mesh Gradient Background */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    background-image:
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(34, 211, 238, 0.05) 0px, transparent 50%);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Loader & Glass Spinner */
#loader {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: var(--glass);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid var(--primary);
    border-right: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Login Experience - Floating Futurism */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #020617;
    background-image: url("https://www.transparenttextures.com/patterns/stardust.png");
    position: relative;
    padding: 20px;
}

.login-card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: var(--glass);
    padding: 4rem 3rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 0 80px rgba(139, 92, 246, 0.1);
    width: 100%;
    max-width: 460px;
    border: 1px solid var(--border);
    animation: fadeIn 1s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
}

/* Layout & Integrated Sidebar */
.app-layout {
    display: none;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

.sidebar {
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    color: var(--text-on-dark);
    padding: 3rem 1.5rem;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    width: 280px;
    flex-shrink: 0;
}

.sidebar h1 {
    font-size: 1.4rem;
    font-weight: 900;
    margin-bottom: 3rem;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    font-weight: 600;
    transition: var(--transition);
    gap: 14px;
    border: 1px solid transparent;
}

.nav-link i {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
    color: #fff;
    box-shadow: 0 10px 30px -5px var(--primary-glow);
    border-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active i {
    transform: scale(1.1);
}

/* Main Content Area */
.main-content {
    flex: 1;
    min-width: 0;
    background-color: transparent;
}

header {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: var(--glass);
    padding: 1.5rem clamp(1.5rem, 5vw, 4rem);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 900;
}

#view-container {
    padding: clamp(1.5rem, 5vh, 4rem);
}

#page-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

/* Futuristic Cards */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.card {
    background: var(--bg-card);
    padding: 2.2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    backdrop-filter: var(--glass);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: 0.3s;
}

.card:hover {
    transform: translateY(-8px) scale(1.01);
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-md);
}

.card:hover::before {
    opacity: 1;
}

/* Modern Minimalist Tables */
.table-container {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-top: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: rgba(255, 255, 255, 0.02);
    text-align: left;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 800;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1.4rem 1.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-weight: 500;
    font-size: 0.95rem;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Buttons & Neo-Inputs */
.btn {
    padding: 0.8rem 1.6rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 25px var(--primary-glow);
}

input,
select,
textarea {
    width: 100%;
    padding: 1rem 1.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.4);
    color: #fff;
    transition: var(--transition);
    outline: none;
    backdrop-filter: blur(5px);
}

input:focus,
select:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Glass Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 17, 0.7);
    backdrop-filter: blur(12px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9000;
    padding: 20px;
}

.modal-card {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 700px;
    width: 95%;
    max-height: 90vh;
    padding: 3rem;
    overflow-y: auto;
    animation: modalPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
}

/* Badges with Neon Soul */
.badge {
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Responsive Adjustments */
@media (max-width: 800px) {
    .sidebar {
        position: fixed;
        left: -300px;
    }

    .sidebar.open {
        left: 0;
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
    }

    .mobile-toggle {
        display: flex;
        background: var(--bg-card);
        border: 1px solid var(--border);
        color: #fff;
        padding: 10px;
        border-radius: 12px;
    }
}

.glass-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Toasts */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: toastIn 0.3s ease-out;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-danger {
    border-left: 4px solid var(--danger);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* PDV Responsiveness */
.pdv-modal {
    height: 95vh;
    display: flex;
    flex-direction: column;
}

.pdv-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    flex: 1;
    overflow: hidden;
}

@media (max-width: 992px) {
    .pdv-modal {
        height: 100vh;
        width: 100% !important;
        max-width: none !important;
        border-radius: 0;
        padding: 1rem !important;
    }

    .pdv-container {
        grid-template-columns: 1fr;
        overflow-y: auto !important;
    }

    .pdv-products-section {
        border-right: none !important;
        border-bottom: 1px solid var(--border);
        max-height: 50vh;
        overflow-y: auto !important;
    }

    .pdv-cart-section {
        min-height: 450px;
        flex: none !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .pdv-cart-list {
        min-height: 150px !important;
        flex: none !important;
    }

    .pdv-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 1rem !important;
    }

    .pdv-cart-footer {
        position: relative !important;
        box-shadow: none !important;
        border-radius: 12px !important;
        margin: 0.5rem;
    }
}

/* Enhanced Cart Item Visibility */
.cart-item {
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    transition: transform 0.2s;
}

.cart-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

#cart-count {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--primary-glow);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(139, 92, 246, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
    }
}