/* 
   POS PRO - Premium Unified Design System
   Combines Global Navigation with High-End POS Dashboard
*/

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
    --accent: #f59e0b;
    --sidebar-w: 260px;
    --sidebar-bg: #111827;
    --bg-pos: #0a0f1d;
    --card-pos: rgba(17, 24, 39, 0.8);
    --border-pos: rgba(255, 255, 255, 0.08);
    --text-pos: #f9fafb;
    --text-muted: #9ca3af;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-pos);
    background-image: 
        radial-gradient(at 0% 100%, hsla(253,16%,15%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(225,39%,10%,1) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-pos);
    margin: 0;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- Global Sidebar Navigation --- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
    scrollbar-width: none; /* Hide for Firefox */
}

.sidebar::-webkit-scrollbar {
    display: none; /* Hide for Chrome/Safari */
}

.sidebar-header {
    padding: 30px 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
}

.logo i { color: var(--primary); }

.sidebar-nav {
    flex: 1;
    padding: 0 16px;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links li { margin-bottom: 8px; }

.nav-links a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    background: rgba(99, 102, 241, 0.1);
    color: white;
}

.nav-links a.active i { color: var(--primary); }

.nav-separator {
    height: 1px;
    background: var(--glass-border);
    margin: 20px 0;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--glass-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --- Main Content Layout --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 40px;
    transition: all 0.3s;
}

/* Mobile Header */
.mobile-header {
    background: var(--sidebar-bg);
    padding: 15px 20px;
    
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
}

.mobile-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 950;
    display: none;
}

.sidebar-overlay.active { display: block; }

/* --- POS Components --- */
.pos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.pos-tag {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 8px;
    display: inline-block;
}

.pos-title { font-size: 2rem; font-weight: 900; margin: 0; }

.pos-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 25px;
}

.glass-card {
    background: var(--card-pos);
    /* backdrop-filter: blur(20px); */
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

.pos-card { padding: 15px; }

.card-header-pos {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Professional Input Styling */
.form-row { display: flex; gap: 20px; margin-bottom: 10px; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

input, select {
    width: 100%;
    padding: 14px 18px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0,0,0,0.6);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* Receipt Styles */
.receipt-card { position: sticky; top: 40px; border: 1px solid rgba(255,255,255,0.1); }

.receipt-header {
    /* padding: 10px 10px; */
    border-bottom: 1px dashed var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.receipt-body { padding: 30px; }

.receipt-lbl { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; }
.receipt-val-bold { font-size: 1.2rem; font-weight: 800; margin-top: 4px; }

.receipt-items-list { margin-top: 30px; }
.receipt-item-row { display: flex; justify-content: space-between; margin-bottom: 20px; }

.item-name { display: block; font-size: 0.9rem; font-weight: 700; }
.item-details { display: block; font-size: 0.75rem; color: var(--text-muted); }
.item-price { font-size: 1rem; font-weight: 800; }

.receipt-divider { border-top: 1px dashed var(--glass-border); margin: 30px 0; }

.total-row.large strong { font-size: 2rem; color: var(--success); font-weight: 950; }

.receipt-actions { padding: 30px; border-top: 1px solid var(--glass-border); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

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

.btn-pos-checkout { width: 100%; font-size: 1.1rem; padding: 18px; }

/* --- POS Overlay (Payment) --- */
.pos-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(15px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}
.pos-overlay.show { display: flex; }

.pos-overlay-content { max-width: 500px; width: 90%; padding: 40px; position: relative; }

.total-summary-box { background: rgba(0,0,0,0.5); padding: 30px; border-radius: 20px; text-align: center; margin-bottom: 30px; }
.total-summary-box h2 { font-size: 3rem; font-weight: 950; color: var(--success); margin: 10px 0 0 0; }

.input-pos-large { font-size: 2.5rem !important; text-align: center; font-weight: 900; padding: 25px !important; color: var(--success) !important; }

/* Modal Styles */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    /* background: rgba(0,0,0,0.85); */ /* Using Bootstrap's backdrop or keeping this if needed */
    backdrop-filter: blur(8px);
    display: none;
    z-index: 3000;
    padding: 20px;
}
/* No global flex centering here to let Bootstrap's modal-dialog-centered work */

.modal-content { 
    width: 100%; 
    padding: 30px; 
    position: relative;
    box-shadow: 0 30px 60px -12px rgba(0,0,0,0.5);
    background: #111827 !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    border-radius: 20px !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h2, .modal-header h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
}

.close-modal {
    background: rgba(255,255,255,0.05);
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.close-modal:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Utilities */
.d-none { display: none !important; }
.mb-3 { margin-bottom: 15px; }
.mt-5 { margin-top: 40px; }
.btn-block { width: 100%; }

/* --- ULTIMATE THEME OVERRIDES (Selects & Modals) --- */

/* 1. Choices.js - Total Visibility Force */
.choices {
    color: white !important;
}

.choices__inner, 
.choices__input,
.choices__list--single {
    background-color: rgba(0,0,0,0.5) !important;
    background: rgba(0,0,0,0.5) !important;
    border-color: rgba(255,255,255,0.1) !important;
    color: white !important;
    font-size: 0.95rem !important;
}

.choices__input::placeholder {
    color: rgba(255,255,255,0.4) !important;
}

/* THE DROPDOWN LIST */
.choices__list--dropdown {
    background-color: #0f172a !important; /* Solid Dark Navy */
    background: #0f172a !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8) !important;
}

/* THE ITEMS */
.choices__list--dropdown .choices__item,
.choices__list--dropdown .choices__item--selectable,
.choices__list--dropdown .choices__item--disabled {
    background: transparent !important;
    color: white !important;
    padding: 12px 20px !important;
    border: none !important;
}

/* THE HOVER/HIGHLIGHT STATE */
.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: var(--primary) !important;
    color: white !important;
}

/* 2. Modals - High Performance Refining */
/* Consistently handled in section above */

.modal-header {
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    padding-bottom: 20px !important;
}

.modal-header h2, .modal-header h3 {
    color: white !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.close-modal {
    font-size: 1.2rem !important;
    font-weight: 900 !important;
    color: white !important;
    opacity: 0.6;
}

.close-modal:hover {
    opacity: 1;
    color: var(--danger) !important;
}

/* Standard Table Badges Fix */
.badge { text-transform: uppercase !important; border-radius: 4px !important; }

/* --- Custom Professional Tables --- */
.table-card {
    padding: 0;
    overflow: hidden;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px 24px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--glass-border);
}

.custom-table td {
    padding: 16px 24px;
    font-size: 0.95rem;
    color: var(--text-pos);
    border-bottom: 1px solid var(--border-pos);
    vertical-align: middle;
}

.custom-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

/* Table Badges & Tags */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
}

.badge-jcb { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-excavator { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-lorry { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Compact Buttons for Tables */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    gap: 6px;
}

.btn-danger { background: var(--danger); color: white; }
.btn-outline-danger {
    background: transparent;
    border: 1.5px solid var(--danger);
    color: var(--danger);
}
.btn-outline-danger:hover { background: var(--danger); color: white; }

.actions-column { width: 220px; }

@media (max-width: 1200px) {
    .pos-grid { grid-template-columns: 1fr; }
    .receipt-card { position: relative; top: 0; }
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.show-sidebar {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    .pos-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .modal-content {
        padding: 25px;
    }
}

@media (max-width: 576px) {
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    .pos-title {
        font-size: 1.5rem;
    }
    .custom-table th, .custom-table td {
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
}

/* Login Page Styles */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    max-width: 450px;
    width: 100%;
    padding: 50px 40px;
    text-align: center;
}

.logo-icon {
    width: 70px;
    height: 70px;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    margin: 0 auto 24px;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.login-card h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 40px;
}

.auth-form {
    text-align: left;
}

.input-container {
    position: relative;
    margin-top: 8px;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.alert {
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* --- Vehicle Booking Calendar --- */
#calendar {
    min-height: 700px;
}

.fc {
    --fc-border-color: rgba(255, 255, 255, 0.1);
    --fc-button-bg-color: var(--primary);
    --fc-button-border-color: var(--primary);
    --fc-button-hover-bg-color: var(--primary-hover);
    --fc-button-hover-border-color: var(--primary-hover);
    --fc-today-bg-color: rgba(99, 102, 241, 0.1);
}

.fc-theme-standard td, .fc-theme-standard th {
    border: 1px solid var(--glass-border) !important;
}

.fc-daygrid-day-number {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px !important;
}

.fc-col-header-cell-cushion {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px !important;
    color: var(--text-muted);
}

.fc-event {
    border-radius: 6px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    padding: 2px 8px !important;
    transition: transform 0.2s;
}

.fc-event:hover {
    transform: scale(1.02);
}

/* Sidebar Badge Pulse Animation */
.badge.bg-danger {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
