/* =====================================================
   Amman Departmental Store POS — Saudi/UAE Demo Edition
   Design: utilitarian retail POS, desert-sand + deep-green palette
   ===================================================== */

:root {
    --sand-50: #FBF7F0;
    --sand-100: #F3EAD9;
    --sand-200: #E8D9BE;
    --ink-900: #1F2620;
    --ink-700: #3A4238;
    --green-700: #2F5233;
    --green-600: #3E6B44;
    --green-500: #4C8354;
    --gold-500: #B8873B;
    --gold-400: #D2A25C;
    --red-500: #C1483C;
    --white: #FFFFFF;
    --border-soft: #E2D8C4;
    --shadow-soft: 0 2px 8px rgba(31, 38, 32, 0.08);
    --radius: 10px;
    --font-display: 'Poppins', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'Courier New', monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--sand-50);
    color: var(--ink-900);
}

/* ---------- Login Page ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(160deg, var(--green-700) 0%, var(--ink-900) 100%);
    flex-direction: column;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px 36px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header { text-align: center; margin-bottom: 24px; }
.login-logo { font-size: 42px; margin-bottom: 6px; }
.login-header h1 { font-family: var(--font-display); font-size: 22px; margin: 0 0 4px; color: var(--ink-900); }
.login-sub { color: var(--ink-700); font-size: 13px; margin: 0; }

.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-form label { font-size: 13px; font-weight: 600; color: var(--ink-700); margin-top: 10px; }
.login-form input {
    padding: 11px 14px;
    border: 1.5px solid var(--border-soft);
    border-radius: 8px;
    font-size: 14px;
    background: var(--sand-50);
}
.login-form input:focus { outline: none; border-color: var(--green-500); }

.btn-primary {
    margin-top: 18px;
    padding: 12px;
    background: var(--green-600);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-primary:hover { background: var(--green-700); }

.demo-credentials {
    margin-top: 20px;
    padding: 12px 14px;
    background: var(--sand-100);
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--ink-700);
}
.demo-credentials strong { display: block; margin-bottom: 4px; color: var(--ink-900); }
.demo-credentials code { background: var(--white); padding: 1px 6px; border-radius: 4px; }

.login-notice {
    margin-top: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--gold-500);
    font-weight: 600;
}

.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 14px;
}
.alert-warning { background: #FDEEE9; color: var(--red-500); border: 1px solid #F5C9BE; }

/* ---------- Top Bar (shared) ---------- */
.pos-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--ink-900);
    color: var(--white);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 20px; }
.badge-demo {
    background: var(--gold-500);
    color: var(--ink-900);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    letter-spacing: 0.5px;
}
.user-chip { font-size: 13px; opacity: 0.85; }
.btn-ghost {
    color: var(--white);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }

.demo-timer {
    font-family: var(--font-mono);
    font-weight: 700;
    background: rgba(255,255,255,0.12);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 14px;
}
.demo-timer.timer-warning { background: var(--gold-500); color: var(--ink-900); }
.demo-timer.timer-critical { background: var(--red-500); color: var(--white); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }

/* ---------- POS Layout ---------- */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
    padding: 16px;
    height: calc(100vh - 110px);
    min-height: 600px;
}

.pos-catalog { display: flex; flex-direction: column; overflow: hidden; }
.search-bar input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-soft);
    border-radius: 10px;
    font-size: 14px;
    background: var(--white);
}
.search-bar input:focus { outline: none; border-color: var(--green-500); }

.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 0;
}
.cat-tab {
    flex-shrink: 0;
    padding: 7px 14px;
    border: 1.5px solid var(--border-soft);
    background: var(--white);
    border-radius: 20px;
    font-size: 12.5px;
    cursor: pointer;
    color: var(--ink-700);
    white-space: nowrap;
}
.cat-tab.active { background: var(--green-600); color: var(--white); border-color: var(--green-600); }

.product-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding-right: 4px;
}
.product-card {
    background: var(--white);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 12px 10px;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 0.1s;
}
.product-card:hover { transform: translateY(-2px); border-color: var(--green-500); }
.product-name { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; line-height: 1.3; min-height: 32px; }
.product-price { font-size: 15px; font-weight: 700; color: var(--green-700); }
.product-meta { font-size: 10.5px; color: var(--ink-700); opacity: 0.7; margin-top: 3px; }
.loading-msg { grid-column: 1 / -1; text-align: center; padding: 40px; color: var(--ink-700); }

/* ---------- Cart / Invoice Panel ---------- */
.pos-cart {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
    max-height: 100%;
}
.cart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cart-header h3 { margin: 0; font-size: 15px; }

.invoice-mode-toggle { display: flex; gap: 4px; }
.mode-btn {
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1.5px solid var(--border-soft);
    background: var(--sand-50);
    cursor: pointer;
}
.mode-btn.active { background: var(--gold-500); color: var(--white); border-color: var(--gold-500); }

.cart-customer input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 10px;
}

.cart-items { flex: 0 1 auto; overflow-y: auto; margin-bottom: 10px; min-height: 80px; max-height: 220px; }
.cart-empty { text-align: center; color: var(--ink-700); opacity: 0.6; padding: 30px 0; font-size: 13px; }

.cart-line { padding: 8px 0; border-bottom: 1px solid var(--sand-100); }
.cart-line-name { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.cart-line-controls { display: flex; align-items: center; gap: 8px; }
.qty-btn {
    width: 22px; height: 22px;
    border: 1px solid var(--border-soft);
    background: var(--sand-50);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.qty-val { font-size: 13px; font-weight: 600; min-width: 20px; text-align: center; }
.cart-line-total { margin-left: auto; font-weight: 700; font-size: 13px; color: var(--green-700); }
.remove-btn { border: none; background: none; color: var(--red-500); cursor: pointer; font-size: 13px; }

.cart-totals { border-top: 1.5px solid var(--sand-200); padding-top: 10px; }
.total-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: var(--ink-700); }
.total-grand { font-size: 17px; font-weight: 700; color: var(--ink-900); border-top: 1px dashed var(--border-soft); margin-top: 4px; padding-top: 8px; }

.payment-section { margin-top: 12px; }
.payment-section label { font-size: 12px; font-weight: 600; color: var(--ink-700); }
.pay-methods { display: flex; gap: 6px; margin: 6px 0; }
.pay-btn {
    flex: 1;
    padding: 8px;
    border: 1.5px solid var(--border-soft);
    background: var(--sand-50);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12.5px;
}
.pay-btn.active { background: var(--green-600); color: var(--white); border-color: var(--green-600); }

.cash-row input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    font-size: 13px;
    margin: 4px 0 6px;
}
.change-due { font-size: 12.5px; color: var(--ink-700); }
.change-due span { font-weight: 700; color: var(--green-700); }

.btn-checkout {
    margin-top: 12px;
    padding: 13px;
    background: var(--gold-500);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.btn-checkout:hover { background: var(--gold-400); }
.btn-checkout:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-clear {
    margin-top: 6px;
    padding: 9px;
    background: none;
    border: 1px solid var(--border-soft);
    color: var(--ink-700);
    border-radius: 8px;
    font-size: 12.5px;
    cursor: pointer;
}

/* ---------- Reports ---------- */
.reports-container { max-width: 1100px; margin: 0 auto; padding: 20px; }
.date-filter { display: flex; gap: 12px; align-items: end; margin-bottom: 20px; }
.date-filter label { font-size: 12.5px; color: var(--ink-700); display: flex; flex-direction: column; gap: 4px; }
.date-filter input { padding: 7px 10px; border: 1px solid var(--border-soft); border-radius: 6px; }
.date-filter button { align-self: flex-end; }

.report-card {
    background: var(--white);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-soft);
}
.report-card h2 { font-size: 16px; margin: 0 0 14px; color: var(--ink-900); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat-box { background: var(--sand-50); border-radius: 8px; padding: 12px; text-align: center; }
.stat-box.highlight { background: var(--green-600); }
.stat-box.highlight .stat-value, .stat-box.highlight .stat-label { color: var(--white); }
.stat-label { display: block; font-size: 11px; color: var(--ink-700); margin-bottom: 4px; }
.stat-value { display: block; font-size: 18px; font-weight: 700; }

.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th { text-align: left; padding: 8px; border-bottom: 2px solid var(--sand-200); color: var(--ink-700); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.3px; }
.report-table td { padding: 8px; border-bottom: 1px solid var(--sand-100); }
.no-data { text-align: center; color: var(--ink-700); opacity: 0.6; padding: 20px; }
.report-note { font-size: 11.5px; color: var(--ink-700); margin-top: 10px; font-style: italic; }
.link-view { color: var(--green-600); text-decoration: none; font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer {
    text-align: center;
    padding: 12px;
    font-size: 11.5px;
    color: var(--ink-700);
    opacity: 0.75;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .pos-layout { grid-template-columns: 1fr; height: auto; }
    .product-grid { max-height: 50vh; }
}
