:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #059669;
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --success: #22c55e;
    --glass: rgba(255, 255, 255, 0.8);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    font-size: 1.1rem; /* Increased from default */
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

nav {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nav-links {
    list-style: none;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    font-size: 1.05rem;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary);
    color: white;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-trend {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.trend-up {
    color: var(--success);
}

.trend-down {
    color: var(--danger);
}

/* Tables */
.card-table {
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: rgba(255, 255, 255, 0.05);
    text-align: left;
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 1.1rem;
}

/* Forms & Inputs */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.3s ease;
}

input:focus {
    border-color: var(--primary);
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1.5rem;
    width: 500px;
    max-width: 90%;
    border: 1px solid var(--border);
}

/* POS Specific */
.pos-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1.5rem;
}

.cart-card {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin: 1rem 0;
}

.cart-item td {
    padding: 1rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.barcode-input-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.barcode-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* --- Print Styles --- */
@media print {
    body * {
        visibility: hidden;
    }

    #order-details-modal,
    #order-details-modal * {
        visibility: visible;
    }

    #order-details-modal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        display: block !important;
        background: white;
    }

    .modal-content {
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        padding: 0 !important;
    }

    .btn,
    .sidebar,
    .top-bar {
        display: none !important;
    }

    /* Receipt specific styling */
    #order-details-modal h2 {
        margin-top: 2rem;
        text-align: center;
    }

    .print-only {
        display: block !important;
    }
}

/* Scanner UI */
.scanner-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg-card);
    border-radius: 2rem;
    border: 1px solid var(--border);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse-green 2s infinite;
}

.status-dot.disconnected {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-green {
    0% { opacity: 0.5; box-shadow: 0 0 0px var(--success); }
    50% { opacity: 1; box-shadow: 0 0 10px var(--success); }
    100% { opacity: 0.5; box-shadow: 0 0 0px var(--success); }
}

@keyframes pulse-red {
    0% { opacity: 0.5; box-shadow: 0 0 0px var(--danger); }
    50% { opacity: 1; box-shadow: 0 0 10px var(--danger); }
    100% { opacity: 0.5; box-shadow: 0 0 0px var(--danger); }
}

/* Switch Component */
.switch-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.switch-container input {
    display: none;
}

.slider {
    position: relative;
    width: 40px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 20px;
    transition: 0.4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.4s;
}

input:checked + .slider {
    background: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}