:root {
    /* Color Palette - Modern Enterprise */
    --brand-primary: #4f46e5;
    --brand-primary-light: #818cf8;
    --brand-primary-dark: #3730a3;
    --brand-secondary: #6366f1;
    
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-topbar: rgba(255, 255, 255, 0.8);
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Spacing & Sizing */
    --sidebar-width: 260px;
    --topbar-height: 70px;
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

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

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

.sidebar-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border-light);
}

.sidebar-brand-icon {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: var(--shadow-md);
}

.sidebar-brand-text {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0.75rem;
}

.menu-section {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin: 1.5rem 1rem 0.5rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: var(--transition);
    margin-bottom: 0.125rem;
}

.menu-item:hover {
    background-color: var(--border-light);
    color: var(--brand-primary);
}

.menu-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.menu-item.active {
    background-color: rgba(79, 70, 229, 0.08);
    color: var(--brand-primary);
    font-weight: 600;
}

/* ─── Main Content ─── */
.main-container {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background-color: var(--bg-topbar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.page-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-main);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.user-profile:hover {
    background-color: var(--border-light);
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Content Area */
.content-body {
    padding: 2rem;
}

/* ─── Components ─── */

/* Cards */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--brand-primary-light);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.card-body {
    padding: 1.5rem;
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
}

.stat-icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

/* Tables */
.table-container {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-surface);
}

.table th {
    background-color: var(--border-light);
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 1rem;
    font-size: 0.875rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background-color: rgba(248, 250, 252, 1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background-color: var(--brand-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px -2px rgba(79, 70, 229, 0.3);
}

.btn-outline {
    background-color: white;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: var(--border-light);
    border-color: var(--text-muted);
}

/* Badges - Enhanced */
.badge {
    padding: 0.35em 0.8em;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
}

.badge-soft-success { background: #dcfce7; color: #166534; }
.badge-soft-danger { background: #fee2e2; color: #991b1b; }
.badge-soft-warning { background: #fef3c7; color: #92400e; }
.badge-soft-info { background: #e0f2fe; color: #075985; }
.badge-soft-primary { background: #e0e7ff; color: #3730a3; }

/* Pagination Styling */
.pagination {
    gap: 0.25rem;
}
.page-link {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 0.875rem;
    transition: var(--transition);
}
.page-item.active .page-link {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}
.page-link:hover {
    background-color: var(--border-light);
    color: var(--brand-primary);
}

/* Dropdowns */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
}
.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    transition: var(--transition);
}
.dropdown-item:hover {
    background-color: var(--border-light);
    color: var(--brand-primary);
}

/* Form Overrides */
.form-select-sm, .form-control-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.input-group-text {
    background-color: var(--border-light);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Horizontal Rule */
hr {
    border-top-color: var(--border-color);
    opacity: 1;
}

/* Utility Classes */
.rounded-pill { border-radius: 50rem !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.border-0 { border: 0 !important; }

/* ─── Premium Auth Layout ─── */
.auth-split-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Left Side: Branding */
.auth-brand-side {
    flex: 1;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem;
    position: relative;
    overflow: hidden;
    color: white;
}

/* Animated Background Shapes */
.auth-brand-side::before, .auth-brand-side::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    opacity: 0.3;
    animation: floatBg 20s infinite alternate ease-in-out;
}

.auth-brand-side::before {
    background: var(--brand-primary);
    top: -10%;
    left: -10%;
}

.auth-brand-side::after {
    background: #6366f1;
    bottom: -10%;
    right: -10%;
    animation-delay: -10s;
}

@keyframes floatBg {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(100px, 50px) rotate(90deg); }
}

.auth-brand-content {
    position: relative;
    z-index: 10;
    max-width: 500px;
}

.auth-logo-large {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    color: var(--brand-primary);
    font-size: 2.5rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.auth-brand-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.auth-brand-tagline {
    font-size: 1.25rem;
    color: #94a3b8;
    margin-bottom: 3rem;
    font-weight: 500;
}

.feature-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    list-style: none;
    padding: 0;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: #e2e8f0;
}

.feature-item i {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--brand-primary-light);
}

/* Right Side: Form */
.auth-form-side {
    width: 500px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
}

.auth-form-container {
    width: 100%;
    max-width: 380px;
}

/* Auth Cards (for non-split fallback or secondary pages) */
.auth-card {
    background: #fff;
    border-radius: 1.5rem;
    padding: 3rem;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
}

/* Mobile Responsive Adjustments */
@media (max-width: 1024px) {
    .auth-brand-side {
        display: none;
    }
    .auth-form-side {
        width: 100%;
        background: radial-gradient(circle at top right, #1e1b4b, #0f172a);
    }
    .auth-form-container {
        background: white;
        padding: 3rem;
        border-radius: 2rem;
        box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    }
}

/* Input Password Toggle */
.password-toggle {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--brand-primary);
}

/* ─── POS UI Improvements ─── */
.pos-container {
    display: flex;
    height: calc(100vh - var(--topbar-height) - 4rem);
    gap: 1.5rem;
    transition: var(--transition);
}

@media (max-width: 1024px) {
    .pos-container {
        flex-direction: column;
        height: auto;
        padding-bottom: 2rem;
    }
    
    .pos-cart-panel, .pos-cart {
        width: 100% !important;
        height: auto !important;
        margin-top: 1rem;
    }
}

.pos-item-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.pos-total-section {
    padding: 1.5rem;
    background-color: var(--border-light);
    border-top: 1px solid var(--border-color);
}

.pos-grand-total {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--brand-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-container {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }

    .sidebar-menu {
        padding: 1rem 0.5rem;
    }
}

/* Global Table Responsiveness */
.table-responsive {
    border-radius: var(--radius-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 1rem;
}

/* ─── Responsive Media Queries ─── */

/* Desktop & Large Tablet (below 1024px) */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-container {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }

    .topbar {
        padding: 0 1.5rem;
    }

    .content-body {
        padding: 1.5rem;
    }

    /* POS Container Responsiveness */
    .pos-container {
        flex-direction: column;
        height: auto !important;
        gap: 1rem;
    }

    .pos-products {
        width: 100%;
    }

    .pos-cart {
        width: 100% !important;
        position: static;
        height: auto !important;
    }
}

/* Mobile (below 768px) */
@media (max-width: 768px) {
    .content-body {
        padding: 1rem;
    }
    
    .topbar {
        padding: 0 1rem;
        height: 60px;
    }

    .page-title {
        font-size: 1rem;
    }

    /* Touch-friendly buttons and inputs */
    .btn, .btn-sm {
        padding: 0.75rem 1.25rem !important;
        min-height: 44px; /* Minimum touch target size */
        font-size: 0.9rem !important;
    }

    .form-control, .form-select, .form-control-sm, .form-select-sm {
        min-height: 44px !important;
        font-size: 16px !important; /* Prevents auto-zoom on iOS */
    }

    .card-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .card-header .btn {
        width: 100%;
    }

    .stat-card {
        padding: 1rem;
        gap: 1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    /* Auth Responsive */
    .auth-form-side {
        padding: 1.5rem;
    }

    .auth-form-container {
        padding: 2rem !important;
    }

    /* POS Grid Touch-friendly */
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
        gap: 0.75rem !important;
    }

    .product-card {
        padding: 1rem !important;
        min-height: 130px !important;
    }
}

/* Fix for elements that overflow */
img, video, canvas, svg {
    max-width: 100%;
    height: auto;
}

.overflow-hidden {
    overflow: hidden;
}

.transition {
    transition: var(--transition);
}

.hover-primary:hover {
    color: var(--brand-primary) !important;
}

.tracking-wider {
    letter-spacing: 0.05em;
}

