/* ═══════════════════════════════════════════════
   styles.css – Futuristic Dark Theme
   ═══════════════════════════════════════════════ */

:root {
  --bg-primary: #0A0F1E;
  --bg-secondary: #111827;
  --bg-card: rgba(255,255,255,0.05);
  --bg-card-hover: rgba(255,255,255,0.09);
  --bg-input: rgba(255,255,255,0.07);
  --border-color: rgba(255,255,255,0.08);
  --border-light: rgba(255,255,255,0.12);
  --neon-blue: #00E5FF;
  --neon-purple: #B200FF;
  --neon-blue-dim: rgba(0,229,255,0.15);
  --neon-purple-dim: rgba(178,0,255,0.15);
  --text-primary: #E8EAED;
  --text-secondary: #9AA0A6;
  --text-muted: #5F6368;
  --danger: #FF3D00;
  --success: #00E676;
  --warning: #FFD600;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --glass-blur: blur(20px);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ──────────────────────────────── */
#app-shell {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

@media (min-width: 481px) {
  body { background: #000; }
  #app-shell {
    border-left: 1px solid rgba(255,255,255,0.05);
    border-right: 1px solid rgba(255,255,255,0.05);
  }
}

/* ── Login Page ─────────────────────────────── */
#login-page {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary);
  max-width: 480px; margin: 0 auto;
}

.login-container {
  width: 90%; max-width: 380px; text-align: center;
}

.login-logo {
  width: 90px; 
  height: 90px; 
  border-radius: 15px;
  background: white;
  display: flex; 
  align-items: center; 
  justify-content: center;
  margin: 0 auto 24px; font-size: 36px; color: #0A0F1E;
  box-shadow: 0 0 40px rgba(0,229,255,0.3);
}

.login-title {
  font-size: 24px; font-weight: 700; margin-bottom: 4px;
  color: white;
}

.login-lang-toggle {
  position: absolute; top: 16px; right: 16px;
}

[dir="rtl"] .login-lang-toggle {
  right: auto; left: 16px;
}

.lang-toggle-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-input); color: var(--text-primary);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: var(--transition);
}

.lang-toggle-btn:active { transform: scale(0.96); }

.lang-toggle-btn i { color: var(--neon-blue); }

.login-subtitle { color: var(--text-secondary); margin-bottom: 32px; font-size: 13px; }

.login-field {
  position: relative; margin-bottom: 16px; text-align: left;
}

.login-field label {
  display: block; font-size: 11px; color: var(--text-secondary);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}

.login-field input, .login-field select {
  width: 100%; padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); background: var(--bg-input);
  color: var(--text-primary); font-size: 15px; outline: none;
  transition: var(--transition);
}

.login-field input:focus, .login-field select:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 0 3px var(--neon-blue-dim);
}

.btn-login {
  width: 100%; padding: 15px; border: none; border-radius: var(--radius-sm);
  background: var(--neon-blue);
  color: #0A0F1E; font-size: 16px; font-weight: 700; cursor: pointer;
  transition: var(--transition); margin-top: 8px;
  box-shadow: 0 4px 20px rgba(0,229,255,0.3);
}

.btn-login:active { transform: scale(0.97); }
.btn-login:disabled { opacity: 0.6; cursor: wait; }

.login-hint {
  margin-top: 20px; font-size: 12px; color: var(--text-muted);
}

.login-hint code {
  background: var(--bg-input); padding: 2px 6px; border-radius: 4px;
  color: var(--neon-blue);
}

/* ── Page Container ─────────────────────────── */
#page-container {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 16px 16px 90px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

#page-container::-webkit-scrollbar { width: 0; }

.page { animation: pageIn 0.3s ease; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Bottom Navigation ──────────────────────── */
#bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  background: rgba(10,15,30,0.92);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-color);
  z-index: 100;
}

.nav-item {
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 4px; cursor: pointer; transition: var(--transition);
  border: none; background: none; color: var(--text-muted);
  font-size: 10px; gap: 3px; min-width: 56px;
  position: relative;
}

.nav-item i { font-size: 20px; transition: var(--transition); }
.nav-item span { font-weight: 500; letter-spacing: 0.3px; }

.nav-item.active { color: var(--neon-blue); }
.nav-item.active i { filter: drop-shadow(0 0 6px var(--neon-blue)); }

.nav-item.active::before {
  content: ''; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 2px; border-radius: 2px;
  background: var(--neon-blue);
  box-shadow: 0 0 8px var(--neon-blue);
}

/* ── Cards / Glass ──────────────────────────── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.glass-card:active { background: var(--bg-card-hover); }

.card-title {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}

.card-title i { color: var(--neon-blue); font-size: 14px; }

/* ── Section Headers ────────────────────────── */
.page-title {
  font-size: 22px; font-weight: 700; margin-bottom: 4px;
}

.page-subtitle {
  font-size: 13px; color: var(--text-secondary); margin-bottom: 20px;
}

/* ── Tabs ───────────────────────────────────── */
.tab-bar {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 4px; margin-bottom: 12px;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-item {
  padding: 8px 16px; border-radius: 20px; font-size: 13px;
  font-weight: 500; white-space: nowrap; cursor: pointer;
  background: var(--bg-input); border: 1px solid var(--border-color);
  color: var(--text-secondary); transition: var(--transition);
  flex-shrink: 0;
}

.tab-item.active {
  background: var(--neon-blue);
  color: #0A0F1E; border-color: transparent; font-weight: 700;
  box-shadow: 0 2px 12px rgba(0,229,255,0.3);
}

/* ── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-input); color: var(--text-primary);
  transition: var(--transition);
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--neon-blue);
  border-color: transparent; color: #0A0F1E; font-weight: 700;
  box-shadow: 0 2px 12px rgba(0,229,255,0.25);
}

.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: var(--radius-xs); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-success { border-color: var(--success); color: var(--success); }

.btn-block { width: 100%; }

/* ── Badges ─────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}

.badge-success { background: rgba(0,230,118,0.15); color: var(--success); }
.badge-warning { background: rgba(255,214,0,0.15); color: var(--warning); }
.badge-danger { background: rgba(255,61,0,0.15); color: var(--danger); }
.badge-info { background: var(--neon-blue-dim); color: var(--neon-blue); }

/* ── Flight Card ────────────────────────────── */
.flight-mini {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--bg-input); border: 1px solid var(--border-color);
  margin-bottom: 8px; cursor: pointer; transition: var(--transition);
}
.flight-mini:active { background: var(--bg-card-hover); }

.flight-route { font-weight: 600; font-size: 15px; }
.flight-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.flight-time { text-align: right; font-size: 13px; font-weight: 600; color: var(--neon-blue); }
.flight-date-sm { font-size: 11px; color: var(--text-secondary); }

/* ── Stats Box ──────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 10px; text-align: center;
}

.stat-value { font-size: 20px; font-weight: 700; }
.stat-value.blue { color: var(--neon-blue); }
.stat-value.purple { color: var(--neon-purple); }
.stat-label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; }

/* ── Gender Bar ─────────────────────────────── */
.gender-bar-wrap { margin: 12px 0; }
.gender-bar {
  height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--bg-input); display: flex;
}
.gender-bar-male {
  background: var(--neon-blue); height: 100%;
  transition: width 0.5s ease;
}
.gender-bar-female {
  background: var(--neon-purple); height: 100%;
  transition: width 0.5s ease;
}
.gender-labels {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: 11px; color: var(--text-secondary);
}
.gender-labels i { margin-right: 4px; }

/* ── Client Table / Cards ───────────────────── */
.client-list { display: flex; flex-direction: column; gap: 6px; }

.client-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 12px;
  transition: var(--transition);
}

.client-row.invoice-group { border-left: 3px solid var(--neon-blue); }

.client-row .full-width { grid-column: 1 / -1; }

.client-field { display: flex; flex-direction: column; }
.client-field-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.client-field-value { color: var(--text-primary); font-weight: 500; }

.tran-link {
  color: var(--neon-blue); cursor: pointer; text-decoration: none;
  border-bottom: 1px dashed var(--neon-blue);
}
.tran-link:hover { color: #fff; }

/* ── Progress Bar ───────────────────────────── */
.progress-bar {
  height: 6px; border-radius: 3px; background: var(--bg-input);
  overflow: hidden; margin-top: 8px;
}

.progress-fill {
  height: 100%; border-radius: 3px;
  background: var(--neon-blue);
  transition: width 0.6s ease;
}

/* ── Form Elements ──────────────────────────── */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block; font-size: 11px; color: var(--text-secondary);
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px;
}

.form-control {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-xs);
  border: 1px solid var(--border-color); background: var(--bg-input);
  color: var(--text-primary); font-size: 14px; outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 0 3px var(--neon-blue-dim);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239AA0A6' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

textarea.form-control { min-height: 60px; resize: vertical; }

/* ── Table ──────────────────────────────────── */
.data-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}

.data-table th {
  text-align: left; padding: 8px 6px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-muted); border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 8px 6px; border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary); vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

/* ── Search Bar ─────────────────────────────── */
.search-bar {
  position: relative; margin-bottom: 12px;
}

.search-bar input {
  width: 100%; padding: 10px 12px 10px 36px;
  border-radius: 20px; border: 1px solid var(--border-color);
  background: var(--bg-input); color: var(--text-primary);
  font-size: 13px; outline: none; transition: var(--transition);
}

.search-bar input:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 0 3px var(--neon-blue-dim);
}

.search-bar i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px;
}

/* ── Toast ──────────────────────────────────── */
#toast-container {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  max-width: 440px; width: calc(100% - 32px); z-index: 10000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: rgba(17,24,39,0.95); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  pointer-events: auto;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-success i { color: var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-error i { color: var(--danger); }
.toast-info { border-left: 3px solid var(--neon-blue); }
.toast-info i { color: var(--neon-blue); }

@keyframes toastIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ── Modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-sheet {
  background: var(--bg-secondary); border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 480px; max-height: 85vh;
  overflow-y: auto; padding: 20px;
  animation: slideUp 0.3s ease;
}

.modal-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--text-muted); margin: 0 auto 16px;
}

.modal-title {
  font-size: 18px; font-weight: 700; margin-bottom: 16px;
}

.modal-actions {
  display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ── Skeleton Loading ───────────────────────── */
.skel {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: skelShimmer 1.5s ease infinite;
  border-radius: var(--radius-xs);
}

.skel-card {
  height: 80px; border-radius: var(--radius); margin-bottom: 10px;
}

.skel-line {
  height: 14px; margin-bottom: 8px;
}

.skel-line.short { width: 60%; }
.skel-line.medium { width: 80%; }

.skel-circle {
  width: 48px; height: 48px; border-radius: 50%;
}

.skel-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-bottom: 12px;
}

.skel-grid .skel-box { height: 64px; border-radius: var(--radius-sm); }

.skel-tabs {
  display: flex; gap: 8px; margin-bottom: 12px;
}

.skel-tab {
  width: 80px; height: 32px; border-radius: 20px;
}

@keyframes skelShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Donut Chart ────────────────────────────── */
.chart-container {
  display: flex; align-items: center; justify-content: center;
  gap: 20px; padding: 12px 0;
}

.chart-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.male { background: var(--neon-blue); }
.legend-dot.female { background: var(--neon-purple); }
.legend-value { font-weight: 600; color: var(--text-primary); }

/* ── Room Distribution ──────────────────────── */
.room-group {
  margin-bottom: 12px; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); overflow: hidden;
}

.room-group-header {
  padding: 10px 12px; background: var(--bg-input);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 600;
}

.room-group-body { padding: 8px 12px; }
.room-client { font-size: 12px; padding: 4px 0; color: var(--text-secondary); }
.room-client::before { content: '• '; color: var(--neon-blue); }

/* ── File Browser ───────────────────────────── */
.file-folder, .file-item {
  padding: 10px 12px; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  transition: var(--transition); font-size: 13px;
}

.file-folder:hover, .file-item:hover { background: var(--bg-input); }
.file-folder i { color: var(--warning); }
.file-item i { color: var(--neon-blue); }

.file-children { padding-left: 24px; }

/* ── Log List ───────────────────────────────── */
.log-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border-color); font-size: 12px;
}

.log-time { color: var(--text-muted); white-space: nowrap; min-width: 90px; }
.log-action { color: var(--text-secondary); flex: 1; }
.log-user { color: var(--neon-blue); white-space: nowrap; }

/* ── Attendance ─────────────────────────────── */
.scan-btn {
  width: 100%; padding: 16px; border: 2px dashed var(--neon-blue);
  border-radius: var(--radius); background: var(--neon-blue-dim);
  color: var(--neon-blue); font-size: 16px; font-weight: 700;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 16px;
}

.scan-btn:active { transform: scale(0.97); background: rgba(0,229,255,0.25); }

.qr-input-area {
  display: none; margin-bottom: 16px;
}

.qr-input-area.show { display: block; }

.qr-input-area textarea {
  width: 100%; padding: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); background: var(--bg-input);
  color: var(--text-primary); font-family: monospace; font-size: 12px;
  min-height: 60px; outline: none; resize: none;
}

.qr-input-area textarea:focus { border-color: var(--neon-blue); }

/* ── Payment Item ───────────────────────────── */
.payment-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-bottom: 1px solid var(--border-color);
}

.payment-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--border-color);
}

.payment-info { flex: 1; }
.payment-emp { font-size: 13px; font-weight: 600; }
.payment-datetime { font-size: 11px; color: var(--text-muted); }
.payment-amount { font-size: 15px; font-weight: 700; color: var(--success); }
.payment-type { font-size: 10px; color: var(--text-muted); }
.payment-actions { display: flex; gap: 4px; }
.payment-actions button {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 4px; font-size: 14px;
}
.payment-actions button:hover { color: var(--text-primary); }

/* ── Penalty Item ───────────────────────────── */
.penalty-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.penalty-type { font-weight: 600; flex: 1; }
.penalty-amount { color: var(--danger); font-weight: 700; }
.penalty-note { color: var(--text-muted); font-size: 11px; flex: 1; }

/* ── Agent Card ─────────────────────────────── */
.agent-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); margin-bottom: 8px;
  background: var(--bg-input);
}

.agent-logo {
  width: 40px; height: 40px; border-radius: 10px;
  object-fit: cover; border: 1px solid var(--border-color);
}

.agent-info { flex: 1; }
.agent-name { font-size: 14px; font-weight: 600; }
.agent-pkg { font-size: 11px; color: var(--text-muted); }
.agent-qty { font-size: 12px; color: var(--neon-blue); }

/* ── Profile Page ───────────────────────────── */
.profile-header {
  text-align: center; padding: 24px 0;
}

.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--neon-blue);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; font-size: 28px; color: #0A0F1E;
  box-shadow: 0 0 30px rgba(0,229,255,0.3);
}

.profile-name { font-size: 20px; font-weight: 700; }
.profile-role { font-size: 13px; color: var(--text-secondary); }

.profile-menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border-color);
  cursor: pointer; transition: var(--transition); font-size: 14px;
}

.profile-menu-item:hover { background: var(--bg-input); }
.profile-menu-item i { color: var(--neon-blue); width: 20px; text-align: center; }
.profile-menu-item .arrow { margin-left: auto; color: var(--text-muted); font-size: 12px; }

/* ── Service Table Wrap ──────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap::-webkit-scrollbar { height: 0; }

/* ── Utilities ───────────────────────────────── */
.text-neon { color: var(--neon-blue); }
.text-purple { color: var(--neon-purple); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }


.camera-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}

.scan-frame {
  width: 200px; height: 200px; border: 2px solid var(--neon-blue);
  border-radius: 12px; position: relative;
  box-shadow: 0 0 30px rgba(0,229,255,0.2);
}

.scan-line {
  position: absolute; top: 0; left: 10%; width: 80%; height: 2px;
  background: var(--neon-blue);
  box-shadow: 0 0 8px var(--neon-blue);
  animation: scanMove 2s linear infinite;
}

@keyframes scanMove {
  0% { top: 5%; }
  50% { top: 95%; }
  100% { top: 5%; }
}

/* ── Invoice Group Colors ───────────────────── */
.inv-color-0 { border-left-color: var(--neon-blue) !important; }
.inv-color-1 { border-left-color: var(--neon-purple) !important; }
.inv-color-2 { border-left-color: var(--warning) !important; }
.inv-color-3 { border-left-color: var(--success) !important; }
.inv-color-4 { border-left-color: var(--danger) !important; }
.inv-color-5 { border-left-color: #00BCD4 !important; }
.inv-color-6 { border-left-color: #E91E63 !important; }
.inv-color-7 { border-left-color: #3F51B5 !important; }

/* ── Sub-tabs (Attendance, etc) ─────────────── */
.sub-tab-bar {
  display: flex; margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sub-tab {
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.sub-tab.active {
  color: var(--neon-blue); border-bottom-color: var(--neon-blue);
}

/* ── Dropdown ───────────────────────────────── */
.dropdown-wrap { margin-bottom: 12px; }
.dropdown-wrap select { composes: form-control; }

/* ── Passengers services icons ──────────────── */
.service-icons { display: flex; gap: 4px; }
.service-icon {
  width: 22px; height: 22px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; background: var(--bg-input); border: 1px solid var(--border-color);
}
.service-icon.bed { color: var(--neon-blue); }
.service-icon.car { color: var(--success); }
.service-icon.breakfast { color: var(--warning); }

/* ── Confirmation Dialog ────────────────────── */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}

.confirm-box {
  background: var(--bg-secondary); border-radius: var(--radius);
  padding: 24px; width: 90%; max-width: 320px; text-align: center;
  animation: slideUp 0.3s ease;
}

.confirm-msg { font-size: 15px; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 8px; justify-content: center; }

/* ── Page header with back ──────────────────── */
.page-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}

.back-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-input); border: 1px solid var(--border-color);
  color: var(--text-primary); display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: var(--transition);
  font-size: 16px;
}

.back-btn:active { background: var(--bg-card-hover); }

/* ── Detail Header Card ─────────────────────── */
.detail-header {
  background: rgba(0,229,255,0.06);
  border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 16px;
}

.detail-header-top {
  display: flex; align-items: center; gap: 16px; margin-bottom: 16px;
}

.detail-avatar {
    width: 80px;
    height: 56px;
    border-radius: 12px; /* square with slight rounding, change to 0 for perfect square */
    object-fit: cover;
    border: 2px solid var(--neon-blue);
    cursor: pointer;
}

.detail-info { flex: 1; }
.detail-name { font-size: 18px; font-weight: 700; }
.detail-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.detail-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}

.detail-stat {
  background: var(--bg-input); border-radius: var(--radius-xs);
  padding: 8px; text-align: center;
}

.detail-stat-val { font-size: 16px; font-weight: 700; }
.detail-stat-lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }

/* ── Action Buttons Row ─────────────────────── */
.action-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px;
}

.action-row .btn { font-size: 11px; padding: 6px 10px; }

/* ═══ Arabic Font ═══════════════════════════════ */
[dir="rtl"] html, [dir="rtl"] body {
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ═══ RTL Support ═══════════════════════════════ */
[dir="rtl"] .flight-mini {
  flex-direction: row-reverse;
}

[dir="rtl"] .flight-time,
[dir="rtl"] .flight-date-sm {
  text-align: left;
}

[dir="rtl"] .flight-route,
[dir="rtl"] .flight-meta {
  text-align: right;
}

[dir="rtl"] .search-bar i {
  left: auto;
  right: 12px;
}

[dir="rtl"] .search-bar input {
  padding-left: 12px;
  padding-right: 36px;
}

[dir="rtl"] select.form-control {
  background-position: left 12px center;
  padding-left: 32px;
  padding-right: 12px;
}

[dir="rtl"] .client-row.invoice-group {
  border-left: 1px solid var(--border-color);
  border-right: 3px solid var(--neon-blue);
}

[dir="rtl"] .inv-color-0 { border-right-color: var(--neon-blue) !important; }
[dir="rtl"] .inv-color-1 { border-right-color: var(--neon-purple) !important; }
[dir="rtl"] .inv-color-2 { border-right-color: var(--warning) !important; }
[dir="rtl"] .inv-color-3 { border-right-color: var(--success) !important; }
[dir="rtl"] .inv-color-4 { border-right-color: var(--danger) !important; }
[dir="rtl"] .inv-color-5 { border-right-color: #00BCD4 !important; }
[dir="rtl"] .inv-color-6 { border-right-color: #E91E63 !important; }
[dir="rtl"] .inv-color-7 { border-right-color: #3F51B5 !important; }

[dir="rtl"] .payment-item {
  flex-direction: row-reverse;
}

[dir="rtl"] .payment-info {
  text-align: right;
}

[dir="rtl"] .payment-amount {
  text-align: left;
}

[dir="rtl"] .log-item {
  flex-direction: row-reverse;
}

[dir="rtl"] .log-action {
  text-align: right;
}

[dir="rtl"] .profile-menu-item .arrow {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .detail-header-top {
  flex-direction: row-reverse;
}

[dir="rtl"] .detail-info {
  text-align: right;
}

[dir="rtl"] .page-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .agent-card {
  flex-direction: row-reverse;
}

[dir="rtl"] .agent-info {
  text-align: right;
}

[dir="rtl"] .room-group-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .penalty-item {
  flex-direction: row-reverse;
}

[dir="rtl"] .card-title {
  flex-direction: row-reverse;
}

[dir="rtl"] .gender-labels {
  flex-direction: row-reverse;
}

[dir="rtl"] .flex-between {
  flex-direction: row-reverse;
}

[dir="rtl"] .stat-box {
  direction: rtl;
}

[dir="rtl"] .detail-stat {
  direction: rtl;
}

[dir="rtl"] .file-folder,
[dir="rtl"] .file-item {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .file-children {
  padding-left: 0;
  padding-right: 24px;
}

[dir="rtl"] .scan-btn {
  flex-direction: row-reverse;
}

[dir="rtl"] .modal-actions {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

[dir="rtl"] .confirm-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .data-table th,
[dir="rtl"] .data-table td {
  text-align: right;
}

[dir="rtl"] .client-field-value {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .login-field {
  text-align: right;
}

[dir="rtl"] .login-field label {
  text-align: right;
}

[dir="rtl"] .form-group label {
  text-align: right;
}

[dir="rtl"] .toast {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .sub-tab-bar {
  flex-direction: row-reverse;
}

[dir="rtl"] #bottom-nav {
  flex-direction: row-reverse;
}

[dir="rtl"] .chart-container {
  flex-direction: row-reverse;
}

[dir="rtl"] .chart-legend {
  direction: rtl;
}

[dir="rtl"] .action-row {
  flex-direction: row-reverse;
}


/* ── Ensure full height on all devices ── */
html, body, #app-shell {
    height: 100%;
    max-width: 100%;
}

/* ── Better padding for modern safe areas (iOS notch, Android cutouts) ── */
#page-container {
    padding: 16px 16px calc(90px + env(safe-area-inset-bottom, 0px));
}

#bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
    padding-top: 8px;
}

/* ── Make bottom navigation safe on notch devices ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    #bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ── Landscape mode adjustments (optional) ── */
@media (orientation: landscape) and (max-height: 500px) {
    #bottom-nav .nav-item span {
        display: none; /* hide labels to save space */
    }

    .nav-item i {
        font-size: 24px;
    }

    .nav-item {
        min-width: 48px;
    }
}

/* ── Ensure content fits inside very narrow devices (below 360px) ── */
@media (max-width: 360px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-stats {
        grid-template-columns: 1fr;
    }

    .action-row .btn {
        flex: 1;
        text-align: center;
    }

    .client-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/* ── Prevent horizontal overflow ── */
img, .agent-logo, .detail-avatar, .payment-avatar {
    max-width: 100%;
    height: auto;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-height: 600px) {
    #bottom-nav {
        position: relative;
        margin-top: auto;
    }

    #page-container {
        padding-bottom: 16px;
    }
}

.client-avatar-wrapper {
    flex-shrink: 0;
}

.client-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.client-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--neon-blue);
    border: 1px solid var(--border-color);
}

.detail-avatar-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 12px; /* matches image shape */
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--neon-blue);
    border: 2px solid var(--neon-blue);
    flex-shrink: 0;
    cursor: pointer;
}

.payment-file {
    display: flex;
    align-items: center;
    margin-top: 8px;
    padding: 4px 8px;
    background: var(--bg-input);
    border-radius: 8px;
    transition: var(--transition);
}

    .payment-file:hover {
        background: var(--bg-card-hover);
    }

.log-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.log-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: 8px;
    color: var(--neon-blue);
    font-size: 16px;
}

.log-datetime {
    min-width: 100px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
}

.log-date {
    font-weight: 500;
}

.log-time {
    font-size: 11px;
}

.log-content {
    flex: 1;
}

.log-action {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.log-employee {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.log-more-btn {
    flex-shrink: 0;
    margin-left: auto;
}

.log-employee {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.log-employee-avatar,
.log-employee-avatar-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 12px;
    object-fit: cover;
}

.log-employee-avatar-placeholder {
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--neon-blue);
    border: 1px solid var(--border-color);
}

/* Modal table styling for logs */
.log-more-info .table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
}

    .log-more-info .table th,
    .log-more-info .table td {
        padding: 10px 12px;
        border: 1px solid var(--border-color);
        text-align: left;
        vertical-align: top;
    }

    .log-more-info .table th {
        background: rgba(0, 229, 255, 0.1);
        color: var(--neon-blue);
        font-weight: 600;
    }

    .log-more-info .table td {
        color: var(--text-primary);
    }

.log-more-info .table-responsive {
    overflow-x: auto;
    margin-bottom: 0;
}

.log-more-info .table-bordered {
    border: 1px solid var(--border-color);
}

.modal-sheet .log-more-info {
    color: var(--text-primary);
}

.agent-avatar.square {
    width: 60px; /* adjust to your design */
    height: 60px;
    background-color: #f0f0f0;
    border-radius: 8px; /* remove if you want sharp square */
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-avatar-fallback {
    width: 100%;
    height: 100%;
    background-color: #3b82f6; /* primary color */
    color: white;
    font-size: 24px;
    font-weight: bold;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.attendance-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
}

.attendance-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.attendance-info {
    flex: 1;
}

.attendance-name {
    font-size: 15px;
    font-weight: 600;
}

.attendance-details {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.attendance-actions {
    flex-shrink: 0;
}

/* Toggle switch */
.attendance-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

    .attendance-toggle input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.attendance-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

    .attendance-slider:before {
        position: absolute;
        content: "";
        height: 18px;
        width: 18px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: 0.3s;
        border-radius: 50%;
    }

input:checked + .attendance-slider {
    background-color: var(--success);
}

    input:checked + .attendance-slider:before {
        transform: translateX(26px);
    }

/* In styles.css, ensure .camera-view has height */
.camera-view {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 300px; /* Ensures container has height before video loads */
}

#camera-video {
    width: 100%;
    height: auto;
    display: block;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scan-frame {
    width: 250px;
    height: 250px;
    border: 2px solid var(--neon-blue);
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0,229,255,0.2);
    position: relative;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 10%;
    width: 80%;
    height: 2px;
    background: var(--neon-blue);
    box-shadow: 0 0 8px var(--neon-blue);
    animation: scanMove 2s linear infinite;
}

@keyframes scanMove {
    0% {
        top: 5%;
    }

    50% {
        top: 95%;
    }

    100% {
        top: 5%;
    }
}

/* Statistics Cards */
.stat-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    transition: var(--transition);
}

    .stat-chart-card:hover {
        background: var(--bg-card-hover);
        border-color: var(--neon-blue-dim);
    }

.stat-chart-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--neon-blue);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

    .stat-chart-header i {
        font-size: 16px;
    }

.gender-stats-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .gender-stats-legend .legend-dot {
        display: inline-block;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        margin-right: 8px;
    }

        .gender-stats-legend .legend-dot.male {
            background: var(--neon-blue);
        }

        .gender-stats-legend .legend-dot.female {
            background: var(--neon-purple);
        }

/* Responsive adjustments */
@media (max-width: 600px) {
    .stats-grid[style*="grid-template-columns: repeat(2, 1fr)"] {
        grid-template-columns: 1fr !important;
    }
}

/* Statistics chart cards */
.stat-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    transition: var(--transition);
}

    .stat-chart-card:hover {
        background: var(--bg-card-hover);
        border-color: var(--neon-blue-dim);
    }

.stat-chart-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--neon-blue);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

    .stat-chart-header i {
        font-size: 16px;
    }

.gender-stats-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .gender-stats-legend .legend-dot {
        display: inline-block;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        margin-right: 8px;
    }

        .gender-stats-legend .legend-dot.male {
            background: var(--neon-blue);
        }

        .gender-stats-legend .legend-dot.female {
            background: var(--neon-purple);
        }

/* Fixed canvas heights */
#nationalities-chart,
#nationalities-chart-year,
#top-packages-chart,
#top-packages-chart-year,
#monthly-payments-chart,
#monthly-payments-chart-year {
    height: 200px !important;
    width: 100% !important;
}

#gender-chart,
#gender-chart-year {
    height: 120px !important;
    width: 120px !important;
}

/* Responsive */
@media (max-width: 600px) {
    .stats-grid[style*="grid-template-columns: repeat(2, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    #nationalities-chart,
    #nationalities-chart-year,
    #top-packages-chart,
    #top-packages-chart-year,
    #monthly-payments-chart,
    #monthly-payments-chart-year {
        height: 180px !important;
    }
}