:root {
    /* Premium Color Palette */
    --primary-color: #6366f1;
    /* Indigo 500 */
    --primary-dark: #4f46e5;
    /* Indigo 600 */
    --secondary-color: #1e293b;
    /* Slate 800 */
    --background-light: #f3f4f6;
    /* Gray 100 */
    --surface-white: #ffffff;
    --text-color: #334155;
    /* Slate 700 */
    --text-light: #64748b;
    /* Slate 500 */
    --error-color: #ef4444;
    /* Red 500 */
    --success-color: #10b981;
    /* Emerald 500 */
    --warning-color: #f59e0b;
    /* Amber 500 */

    /* Shadows & Radius */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-light);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    line-height: 1.5;
}

/* Product Form Redesign */
.form-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.brand-tag {
    background: #6366f1;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    margin-bottom: 2rem;
}

.section-label {
    border-left: 4px solid #6366f1;
    padding-left: 10px;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 2rem 0 1.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

.form-card {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.variant-box {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.btn-secondary {
    background: white;
    border: 1px solid #cbd5e1;
    color: var(--secondary-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-add-variant {
    background: #e0e7ff;
    color: #4338ca;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-add-variant:hover {
    background: #c7d2fe;
}

.btn-save-large {
    width: 100%;
    background: #7c3aed;
    /* Purple */
    color: white;
    padding: 1.25rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 1rem;
    box-shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.1), 0 2px 4px -1px rgba(124, 58, 237, 0.06);
}

.btn-save-large:hover {
    background: #6d28d9;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Auth Pages */
.login-container {
    background: var(--surface-white);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-header h2 {
    color: var(--secondary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

/* Forms */
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 0.875rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* Dashboard Layout */
.dashboard-container {
    width: 100%;
    max-width: 1400px;
    padding: 2rem;
    align-self: flex-start;
}

.header {
    background: var(--surface-white);
    padding: 1.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Login Page Redesign */
body.login-body {
    background: white;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Inter', sans-serif;
}

.split-container {
    display: flex;
    width: 100%;
    height: 100vh;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
}

.left-panel {
    flex: 1;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    padding: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: white;
    position: relative;
}

.right-panel {
    flex: 1;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-form-container {
    width: 100%;
    max-width: 400px;
}

.brand-start {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.hero-text h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-weight: 800;
}

.hero-text p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 80%;
}

.testimonial-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 2rem;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.input-field {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.input-field:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.social-login {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.social-btn:hover {
    background: #f8fafc;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-light);
    font-size: 0.875rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.divider::before {
    margin-right: 1rem;
}

.divider::after {
    margin-left: 1rem;
}

/* Responsive Login */
@media (max-width: 900px) {
    .left-panel {
        display: none;
    }
}

.login-header {
    text-align: left;
    /* Override previous center */
}

.header h1,
.header h2 {
    margin: 0;
    color: var(--secondary-color);
    font-weight: 800;
}

/* Cards */
.card {
    background: var(--surface-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* POS Layout */
.pos-container {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 2rem;
    height: calc(100vh - 140px);
}

.product-pane,
.cart-pane {
    background: var(--surface-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

.product-pane {
    overflow: hidden;
    /* Fix scroll */
}

#product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    padding: 0.5rem;
    overflow-y: auto;
}

.product-card {
    background: var(--surface-white);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.p-name {
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.p-variant {
    font-size: 0.85rem;
    color: var(--text-light);
}

.p-price {
    color: var(--primary-color);
    font-weight: 800;
    font-size: 1.1rem;
    margin: 0.5rem 0;
}

.p-stock {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
}

/* Cart Table */
#cart-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

#cart-table th {
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.5rem;
}

#cart-table td {
    background: #f8fafc;
    padding: 0.75rem;
    font-weight: 500;
}

#cart-table tr td:first-child {
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

#cart-table tr td:last-child {
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

/* Buttons */
.btn-qty {
    background: #e2e8f0;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    color: var(--secondary-color);
}

.btn-qty:hover {
    background: #cbd5e1;
}

.btn-danger {
    background: #fee2e2;
    color: var(--error-color);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #fecaca;
}

/* Totals */
.cart-footer {
    margin-top: auto;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    color: var(--text-light);
}

.total-row {
    color: var(--secondary-color);
    font-size: 1.25rem;
    font-weight: 800;
    border-top: 2px dashed #cbd5e1;
    padding-top: 1rem;
    margin-top: 1rem;
}

/* Alerts */
.alert-box {
    background: #fff7ed;
    border: 1px solid #ffedd5;
    color: var(--warning-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-icon {
    font-size: 1.5rem;
}

/* Mobile */
@media screen and (max-width: 768px) {
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
        padding-bottom: 2rem;
    }

    .product-pane {
        height: 50vh;
    }

    .cart-pane {
        height: auto;
    }
}

/* Inventory Dashboard Redesign */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
}

.metric-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--secondary-color);
}

.metric-value.alert {
    color: #dc2626;
}

.metric-value.currency {
    color: #10b981;
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
}

.modern-table th {
    text-align: left;
    padding: 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 700;
    border-bottom: 2px solid #f1f5f9;
    letter-spacing: 0.05em;
}

.modern-table td {
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-color);
}

.modern-table tr:first-child td:first-child {
    border-top-left-radius: 0.5rem;
}

.modern-table tr:first-child td:last-child {
    border-top-right-radius: 0.5rem;
}

.modern-table tr:last-child td:first-child {
    border-bottom-left-radius: 0.5rem;
}

.modern-table tr:last-child td:last-child {
    border-bottom-right-radius: 0.5rem;
}

.cat-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.progress-bar-container {
    width: 60px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    background: #10b981;
}

.progress-bar.low {
    background: #dc2626;
}

.action-icon {
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
}

.action-icon:hover {
    color: #6366f1;
}

/* --- Tailwind Design Translation (v3.0) --- */

/* Glassmorphism & Shapes */
.glass-panel {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 2rem;
    /* Reduced radius */
    box-shadow: 0 20px 25px -5px rgba(224, 231, 255, 0.2), 0 8px 10px -6px rgba(224, 231, 255, 0.2);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem !important;
    /* Reduced padding */
    min-height: 240px !important;
    /* Reduced height */
}

.glass-panel:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(199, 210, 254, 0.4);
}

/* Decorative background circle inside cards */
.decor-circle {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 128px;
    height: 128px;
    border-radius: 50%;
    filter: blur(40px);
    z-index: 0;
    opacity: 0.1;
}

/* Page Background */
.bg-slate-50 {
    background-color: #f8fafc;
}

/* Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Force 3 columns */
    gap: 1.5rem;
    /* Reduced gap */
    max-width: 1200px;
    margin: 0 auto;
}

/* Disappearing Animation */
@keyframes fadeOutCollapse {
    0% {
        opacity: 1;
        max-height: 200px;
        margin-bottom: 2.5rem;
        transform: translateY(0);
    }

    80% {
        opacity: 0;
        max-height: 200px;
        margin-bottom: 2.5rem;
        transform: translateY(-10px);
    }

    100% {
        opacity: 0;
        max-height: 0;
        margin-bottom: 0;
        padding: 0;
        overflow: hidden;
        transform: translateY(-20px);
    }
}

.welcome-fade {
    animation: fadeOutCollapse 1s ease-in-out forwards;
    animation-delay: 4s;
    /* Wait 4s before disappearing */
}

/* Icon Containers */
.icon-box-modern {
    width: 3rem;
    /* Reduced icon size */
    height: 3rem;
    border-radius: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: transform 0.5s ease;
}

.glass-panel:hover .icon-box-modern {
    transform: scale(1.1);
}

/* Typography */
.text-slate-900 {
    color: #0f172a;
}

.text-slate-800 {
    color: #1e293b;
}

.text-slate-500 {
    color: #64748b;
}

.font-black {
    font-weight: 900;
}

.tracking-tight {
    letter-spacing: -0.025em;
}

/* Dynamic Color Themes */

/* Indigo (POS) */
.theme-indigo .icon-box-modern {
    background: #eef2ff;
    color: #4f46e5;
}

.theme-indigo .decor-circle {
    background: #6366f1;
}

.btn-indigo {
    background: #4f46e5;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(199, 210, 254, 0.5);
}

.btn-indigo:hover {
    filter: brightness(1.1);
}

/* Emerald (Inventory) */
.theme-emerald .icon-box-modern {
    background: #ecfdf5;
    color: #059669;
}

.theme-emerald .decor-circle {
    background: #10b981;
}

.btn-emerald {
    background: #059669;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(167, 243, 208, 0.5);
}

/* Blue (Reports) */
.theme-blue .icon-box-modern {
    background: #eff6ff;
    color: #2563eb;
}

.theme-blue .decor-circle {
    background: #3b82f6;
}

.btn-blue {
    background: #2563eb;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(191, 219, 254, 0.5);
}

/* Amber (Sales) */
.theme-amber .icon-box-modern {
    background: #fffbeb;
    color: #d97706;
}

.theme-amber .decor-circle {
    background: #f59e0b;
}

.btn-amber {
    background: #d97706;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(253, 230, 138, 0.5);
}

/* Purple (Audit) */
.theme-purple .icon-box-modern {
    background: #f3e8ff;
    color: #9333ea;
}

.theme-purple .decor-circle {
    background: #a855f7;
}

.btn-purple {
    background: #9333ea;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(233, 213, 255, 0.5);
}

/* Rose (Users) */
.theme-rose .icon-box-modern {
    background: #fff1f2;
    color: #e11d48;
}

.theme-rose .decor-circle {
    background: #f43f5e;
}

.btn-rose {
    background: #e11d48;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(254, 205, 211, 0.5);
}


.btn-action {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: block;
    text-align: center;
}

/* Floating Animation */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }

    100% {
        transform: translateY(0px);
    }
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 6s ease-in-out infinite;
    z-index: -1;
}

/* --- Compact Density for Commercial View --- */
.density-compact .dashboard-container {
    max-width: 100%;
    padding: 1rem 2rem;
}

.density-compact .card,
.density-compact .report-card,
.density-compact .metric-card {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
}

.density-compact h1 {
    font-size: 1.5rem;
}

.density-compact h2 {
    font-size: 1.25rem;
}

.density-compact h3 {
    font-size: 1.1rem;
}

.density-compact .metric-value {
    font-size: 1.5rem;
}

.density-compact .metric-label {
    font-size: 0.7rem;
}

/* Compact Tables */
.density-compact .modern-table th,
.density-compact .modern-table td,
.density-compact .data-table th,
.density-compact .data-table td,
.density-compact .user-table th,
.density-compact .user-table td,
.density-compact .recon-table th,
.density-compact .recon-table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.density-compact .btn-primary,
.density-compact .btn-secondary,
.density-compact .btn-danger {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* --- Fixed POS Layout (Scrollable Panes) --- */
.pos-layout-fixed {
    height: 100vh;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0;
    overflow: hidden;
}

.pos-layout-fixed .product-pane {
    height: 100%;
    overflow-y: auto;
    padding: 1rem;
    border-right: 1px solid #e2e8f0;
}

.pos-layout-fixed .cart-pane {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: white;
}

.pos-layout-fixed .cart-scroll-area {
    flex: 1 1 0;
    overflow-y: auto;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1rem;
    min-height: 0;
    /* Critical for nested flex scrolling */
}

/* --- Security Lock Screen --- */
#lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    /* High z-index to block everything */
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.lock-box {
    background: white;
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.3s ease-out;
}

.lock-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: #f1f5f9;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    margin: 0 auto 1.5rem auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}