/* ============================================================
   DATAZAD POS PRO - Global styles (dark/light themes)
   ============================================================ */
:root {
    --brand: #0ea5e9;
    --brand-dark: #0284c7;
    --sidebar-w: 230px;
    --radius: 12px;
    --shadow: 0 8px 24px rgba(0, 0, 0, .12);
    --transition: all .2s ease;
}

/* Light theme defaults */
:root, [data-theme="light"] {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #0ea5e9;
    --shadow: 0 8px 24px rgba(15, 23, 42, .08);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #16233a;
    --border: #334155;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --sidebar-bg: #0b1222;
    --sidebar-text: #94a3b8;
    --sidebar-active: #38bdf8;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg); color: var(--text);
    margin: 0; font-size: 14px;
    -webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] .card, [data-theme="dark"] .modal-content,
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select {
    background-color: var(--surface); color: var(--text); border-color: var(--border);
}
[data-theme="dark"] .form-control::placeholder { color: var(--text-muted); }
[data-theme="dark"] .table { color: var(--text); }
[data-theme="dark"] .table-hover tbody tr:hover { background: var(--surface-2); color: var(--text); }
[data-theme="dark"] .modal-header, [data-theme="dark"] .modal-footer { border-color: var(--border); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 100;
    transition: var(--transition); overflow-y: auto;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px; padding: 18px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, .15);
}
.brand-logo {
    width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #0ea5e9, #6366f1);
    display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 15px;
    flex-shrink: 0;
}
.sidebar-brand strong { color: #fff; display: block; font-size: 14px; }
.sidebar-brand small { color: var(--text-muted); font-size: 11px; }
.sidebar .nav { padding: 10px 8px; gap: 2px; }
.sidebar .nav-link {
    color: var(--sidebar-text); padding: 10px 12px; border-radius: 10px;
    display: flex; align-items: center; gap: 12px; font-size: 13.5px; transition: var(--transition);
}
.sidebar .nav-link svg { flex-shrink: 0; font-size: 17px; }
.sidebar .nav-link:hover { background: rgba(148, 163, 184, .12); color: #fff; }
.sidebar .nav-link.active { background: var(--sidebar-active); color: #fff; }
.sidebar .nav-link.pos-link {
    background: linear-gradient(135deg, #0ea5e9, #0d9488); color: #fff; font-weight: 600;
    margin-bottom: 6px; box-shadow: 0 4px 14px rgba(14, 165, 233, .35);
}
.sidebar-foot { margin-top: auto; padding: 14px 16px; border-top: 1px solid rgba(148,163,184,.15); font-size: 12px; }
.sync-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; display: inline-block; margin-inline-end: 6px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 90;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.btn-icon { background: none; border: 0; color: var(--text); font-size: 20px; padding: 6px; border-radius: 8px; }
.btn-icon:hover { background: var(--surface-2); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
    background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.content { padding: 22px 24px 40px; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-header { background: transparent; border-bottom: 1px solid var(--border); font-size: 14px; }
.card-body { padding: 18px; }

.stat-card { display: flex; gap: 14px; padding: 18px; transition: var(--transition); }
.stat-card:hover { transform: translateY(-3px); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff; flex-shrink: 0;
}
.stat-blue .stat-icon { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.stat-green .stat-icon { background: linear-gradient(135deg, #22c55e, #15803d); }
.stat-purple .stat-icon { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.stat-orange .stat-icon { background: linear-gradient(135deg, #f97316, #ea580c); }
.stat-red .stat-icon { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-teal .stat-icon { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.stat-indigo .stat-icon { background: linear-gradient(135deg, #6366f1, #4338ca); }
.stat-pink .stat-icon { background: linear-gradient(135deg, #ec4899, #db2777); }
.stat-value { font-size: 22px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.stat-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.table { margin-bottom: 0; }
.table thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); border-bottom-width: 1px; white-space: nowrap; }
.table td { vertical-align: middle; }
[data-theme="dark"] .table thead th { border-color: var(--border); }

.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.form-control, .form-select { border-radius: 10px; }
[data-theme="dark"] .form-control:focus, [data-theme="dark"] .form-select:focus {
    background: var(--surface); color: var(--text); border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(14,165,233,.15);
}

/* ---------- Auth ---------- */
.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(140deg, #0b1222 0%, #0f172a 55%, #082f49 100%);
    position: relative; overflow: hidden; padding: 20px;
}
.auth-backdrop {
    position: absolute; inset: 0; opacity: .25;
    background:
        radial-gradient(600px 300px at 15% 10%, #0ea5e9 0%, transparent 60%),
        radial-gradient(500px 300px at 85% 90%, #6366f1 0%, transparent 60%);
}
.auth-wrap { position: relative; width: 100%; max-width: 420px; z-index: 2; }
.auth-card {
    background: rgba(30, 41, 59, .85); backdrop-filter: blur(14px);
    border: 1px solid rgba(51, 65, 85, .8); border-radius: 20px;
    padding: 36px 32px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.auth-logo { text-align: center; margin-bottom: 14px; }
.auth-logo img { max-height: 90px; max-width: 90%; object-fit: contain; }
.auth-logo-mark {
    width: 84px; height: 84px; margin: 0 auto; border-radius: 22px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 30px; font-weight: 800;
    box-shadow: 0 12px 30px rgba(14, 165, 233, .4);
}
.auth-title { text-align: center; color: #fff; font-size: 24px; font-weight: 800; margin: 0; }
.auth-sub { text-align: center; color: #94a3b8; font-size: 13px; margin: 4px 0 22px; }

.auth-tabs { display: flex; background: #0f172a; border-radius: 12px; padding: 4px; margin-bottom: 20px; }
.tab-btn {
    flex: 1; border: 0; background: transparent; color: #94a3b8; padding: 10px;
    border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.tab-btn.active { background: var(--brand); color: #fff; }

.auth-form label { color: #94a3b8; font-size: 12px; margin-bottom: 6px; display: block; }
.auth-form .form-control, .auth-form .form-select {
    background: #0f172a; border: 1px solid #334155; color: #fff; border-radius: 12px; padding: 12px 14px;
}
.auth-form .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem rgba(14,165,233,.2); }
.auth-form .form-check-label { color: #cbd5e1; font-size: 13px; }
.auth-lang { display: flex; gap: 8px; align-items: center; margin-top: 18px; }
.auth-lang .form-select { background: #0f172a; color: #fff; border-color: #334155; }
.auth-lang .btn { color: #94a3b8; border-color: #334155; }

.pin-display {
    text-align: center; font-size: 30px; letter-spacing: 12px; color: #fff;
    background: #0f172a; border-radius: 12px; padding: 14px; margin-bottom: 16px;
    border: 1px solid #334155; font-family: monospace;
}
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key {
    border: 0; border-radius: 12px; padding: 18px 0; font-size: 22px; font-weight: 700;
    background: #0f172a; color: #fff; cursor: pointer; transition: var(--transition);
    border: 1px solid #334155; min-height: 60px;
}
.key:hover { background: #1e293b; transform: scale(1.04); }
.key:active { transform: scale(.96); }
.key-ok { background: #22c55e; border-color: #22c55e; }
.key-ok:hover { background: #16a34a; }

.employee-strip { margin-top: 14px; }
.strip-title { color: #94a3b8; font-size: 12px; margin-bottom: 8px; text-align: center; }
.strip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.emp-chip {
    background: #0f172a; border: 1px solid #334155; border-radius: 12px; padding: 10px;
    display: flex; flex-direction: column; align-items: center; gap: 6px; color: #e2e8f0;
    min-width: 80px; cursor: pointer; transition: var(--transition);
}
.emp-chip:hover { border-color: var(--brand); transform: translateY(-2px); }
.emp-chip img, .emp-av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.emp-av { background: linear-gradient(135deg, #0ea5e9, #6366f1); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.emp-chip span { font-size: 11px; }

/* ---------- Tables / misc ---------- */
.img-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; }
.search-bar { max-width: 380px; }
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pagination .page-link { background: var(--surface); border-color: var(--border); color: var(--text); }
.pagination .page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.modal-content { border-radius: 16px; }
.modal-title { font-weight: 700; }
[data-theme="dark"] .modal-content { background: var(--surface); color: var(--text); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 44px; opacity: .4; display: block; margin-bottom: 12px; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 260px 1fr; gap: 22px; }
.settings-nav { display: flex; flex-direction: column; gap: 4px; }
.settings-nav .nav-link { color: var(--text); border-radius: 10px; padding: 10px 14px; }
.settings-nav .nav-link.active { background: var(--surface-2); color: var(--brand); font-weight: 600; }
.settings-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.settings-panel h6 { margin-bottom: 18px; }

/* Responsive */
@media (max-width: 991px) {
    .sidebar { position: fixed; transform: translateX(-100%); box-shadow: var(--shadow); }
    .sidebar-collapsed .sidebar { transform: translateX(0); }
    .main { width: 100%; }
    .content { padding: 14px 14px 40px; }
    .settings-grid { grid-template-columns: 1fr; }
}
[dir="rtl"] .sidebar { border-inline-end: 1px solid rgba(148,163,184,.15); }
[dir="rtl"] .sidebar-collapsed .sidebar { transform: translateX(100%); }