:root {
    --primary: #1e3a8a; /* Dark Blue */
    --primary-hover: #1e40af;
    --primary-light: #dbeafe;
    --secondary: #334155;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --success: #10b981;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: #1e3a8a;
    --secondary: #94a3b8;
    --background: #0f172a;
    --surface: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --border: #334155;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
}
body, body * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* Utilities */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 1rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.w-full { width: 100%; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    font-size: 0.95rem;
}
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(234, 88, 12, 0.39);
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.23);
}
.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { opacity: 0.9; }

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}



/* Dashboard Layout */
.app-wrapper { display: flex; min-height: 100vh; }
.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
}
.sidebar-header { margin-bottom: 2rem; padding: 0 1rem; font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.nav-link:hover, .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}
.nav-link i { margin-right: 0.75rem; font-size: 1.25rem; }

.main-content {
    flex: 1;
    padding: 2rem 3rem;
    background: var(--background);
    overflow-y: auto;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.8rem; font-weight: 700; color: var(--text-main); }

/* Cards & Tables */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.alert { padding: 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* --- PREMIUM POS TERMINAL LAYOUT --- */
.pos-body {
    overflow: hidden; /* No scroll on body */
    background: var(--background);
}

.pos-fullscreen-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    background: var(--background);
}

/* Header */
.pos-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    background: var(--surface);
    box-shadow: 0 4px 20px -2px rgba(0,0,0,0.05);
    z-index: 100;
}
body.dark-mode .pos-topbar {
    box-shadow: 0 4px 20px -2px rgba(0,0,0,0.5);
}

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

.pos-logo {
    font-size: 1.8rem;
    font-weight: 900;
    margin: 0;
    letter-spacing: -0.5px;
}

.pos-datetime {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    border-left: 2px solid var(--border);
    padding-left: 1.5rem;
}

.pos-user-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pos-icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    height: 40px;
    width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pos-icon-btn:hover {
    background: var(--border);
    color: var(--text-main);
}

.pos-logout-btn:hover {
    background: #fee2e2;
    color: var(--danger);
}
body.dark-mode .pos-logout-btn:hover {
    background: rgba(239,68,68,0.2);
}

/* Main Grid */
.pos-main-grid {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 1.5rem;
    gap: 1.5rem;
}

/* Left Column: Ticket */
.pos-ticket-panel {
    flex: 7;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}

.pos-table-container {
    flex: 1;
    overflow-y: auto;
}

.pos-ticket-table {
    width: 100%;
    border-collapse: collapse;
}

.pos-ticket-table th {
    background: var(--background);
    color: var(--text-muted);
    padding: 1rem;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--border);
}
.pos-ticket-table th.text-right { text-align: right; }

.pos-ticket-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 1.1rem;
    vertical-align: middle;
}

.pos-item-row {
    transition: background 0.2s;
}
.pos-item-row:hover {
    background: rgba(234, 88, 12, 0.05);
}

.pos-qty-btn {
    background: var(--background);
    border: 2px solid var(--border);
    padding: 0.4rem;
    border-radius: 8px;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-main);
    width: 70px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.pos-qty-btn:hover {
    border-color: var(--primary);
    background: rgba(234, 88, 12, 0.05);
}

/* Numpad Modal */
.pos-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pos-numpad-container {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 320px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.pos-numpad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.pos-numpad-header h3 { margin: 0; font-size: 1.2rem; }

.pos-close-btn {
    background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted);
}
.pos-close-btn:hover { color: var(--danger); }

.pos-numpad-display input {
    width: 100%;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    font-size: 2rem;
    text-align: right;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.pos-numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.num-btn {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.2rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}
.num-btn:active, .num-btn:hover {
    background: var(--border);
}

.pos-numpad-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

/* Search Modal */
.pos-search-container {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 600px;
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.pos-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.pos-search-header h3 { margin: 0; font-size: 1.2rem; }

.pos-search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s;
}
.pos-search-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2);
}
.pos-search-input-wrapper i { color: var(--text-muted); font-size: 1.2rem; margin-right: 0.8rem; }
.pos-search-input-wrapper input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 0.5rem 0;
    font-size: 1.2rem;
    color: var(--text-main);
    outline: none;
}

.pos-search-results {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
}

.pos-search-result-row {
    transition: background 0.2s;
}
.pos-search-result-row:hover {
    background: rgba(234, 88, 12, 0.1);
}

.pos-active-input-row {
    background: rgba(234, 88, 12, 0.03);
}

.pos-input-wrapper {
    display: flex;
    align-items: center;
    background: #000;
    border-radius: 8px;
    margin: 0.5rem;
    padding: 0 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border: 2px solid transparent;
    transition: all 0.3s;
}

.pos-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.2);
}

.pos-input-wrapper i {
    color: var(--primary);
    font-size: 1.2rem;
}

#pos-code-input {
    width: 100%;
    background: transparent;
    color: #fff;
    border: none;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    outline: none;
}
#pos-code-input::placeholder { color: #666; font-weight: 400; }

.pos-ticket-actions {
    display: flex;
    padding: 1rem;
    gap: 1rem;
    background: var(--background);
    border-top: 1px solid var(--border);
}

.pos-action-btn {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.pos-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.pos-action-btn i { font-size: 1.2rem; color: var(--text-muted); }
.pos-action-btn:hover i { color: var(--primary); }

.kbd {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
}

/* Right Column: Sidebar Panel */
.pos-sidebar-panel {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pos-totals-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pos-customer-info {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px dashed var(--border);
}
.customer-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.3rem;
}
.customer-name {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
}

.pos-amounts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: auto;
}

.amount-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-muted);
}
.amount-row.discount { color: var(--success); }

.amount-row.grand-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border);
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--text-main);
    align-items: center;
}
.amount-row.grand-total span:first-child {
    font-size: 1.2rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pos-num-pad {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pos-pay-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 1.5rem;
    font-size: 1.6rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(30, 58, 138, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

/* Virtual Keyboard Styles */
.pos-keyboard {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.key-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    min-width: 45px;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.key-btn:hover, .key-btn:active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(2px);
    box-shadow: none;
}

.key-action {
    flex-grow: 1.5;
    background: #fff0f0;
}

.key-space {
    flex-grow: 1;
    max-width: 500px;
}
.pos-pay-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(30, 58, 138, 0.5);
}
.pos-pay-btn .kbd {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
}

.pos-secondary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.pos-sec-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
}
.pos-sec-btn i { font-size: 1.4rem; }
.pos-sec-btn:hover {
    transform: translateY(-2px);
    background: var(--background);
}

/* Utilities inside POS */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: #f59e0b; }
.text-info { color: #3b82f6; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.font-bold { font-weight: bold; }
.p-0 { padding: 0 !important; }

