/* ============================================================
   ANC FREE ZONE (AJMAN NUVENTURES CENTRE) PORTAL
   Clean, Classical, High-End Corporate Design (Light & Crisp)
   Zero Neon / Zero Dark Blobs
   ============================================================ */

:root {
  /* Brand Palette (ANC Royal Navy & Blue) */
  --primary: #144299;
  --primary-hover: #0e3073;
  --primary-light: #eff6ff;
  --secondary: #0284c7;
  
  /* Clean Corporate Palette */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);

  --font-ar: 'Cairo', system-ui, -apple-system, sans-serif;
  --font-en: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  --radius-lg: 14px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --transition: all 0.2s ease-in-out;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-ar);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

html[lang="en"] body {
  font-family: var(--font-en);
}

/* Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Header */
.top-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 24px;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-zone {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-small {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.portal-tag {
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  border-right: 1.5px solid var(--border-subtle);
  padding-right: 14px;
}

html[dir="ltr"] .portal-tag {
  border-right: none;
  border-left: 1.5px solid var(--border-subtle);
  padding-right: 0;
  padding-left: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #f1f5f9;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.lang-toggle-btn:hover {
  background: #e2e8f0;
}

.security-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.sec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #16a34a;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

/* ================= LOGIN VIEW ================= */
.auth-card-container {
  width: 100%;
  max-width: 460px;
}

.auth-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  padding: 36px 32px;
}

.card-hero {
  text-align: center;
  margin-bottom: 24px;
}

.logo-wrapper {
  margin-bottom: 16px;
  display: inline-block;
}

.main-anc-logo {
  max-width: 220px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.portal-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.portal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* Forms */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.link-btn:hover {
  text-decoration: underline;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  right: 14px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  pointer-events: none;
}

html[dir="ltr"] .input-icon {
  right: auto;
  left: 14px;
}

.form-input {
  width: 100%;
  height: 46px;
  padding: 0 44px 0 14px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

html[dir="ltr"] .form-input {
  padding: 0 14px 0 44px;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 66, 153, 0.12);
}

.eye-btn {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

html[dir="ltr"] .eye-btn {
  left: auto;
  right: 12px;
}

.eye-btn:hover {
  color: var(--text-primary);
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.checkbox-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}

.demo-pill {
  background: var(--primary-light);
  border: 1px dashed #93c5fd;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 16px;
  cursor: pointer;
  font-family: inherit;
}

.demo-pill:hover {
  background: #dbeafe;
}

.submit-btn {
  width: 100%;
  height: 48px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(20, 66, 153, 0.2);
}

.submit-btn:hover {
  background: var(--primary-hover);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-arrow {
  display: inline-block;
  transition: var(--transition);
}

html[dir="ltr"] .btn-arrow {
  transform: rotate(180deg);
}

.card-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.support-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.trust-footer {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Alert Box */
.alert-box {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-box.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-box.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

/* ================= ADMIN DASHBOARD VIEW ================= */
.dashboard-container {
  width: 100%;
  max-width: 1040px;
}

.dashboard-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  padding: 32px 30px;
}

/* Top Dashboard Header */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 16px;
}

.user-greeting {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-avatar-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
}

.badge-role {
  display: inline-block;
  padding: 2px 8px;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

.dash-welcome-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.dash-welcome-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

.dash-actions-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* PRIMARY REQUESTED BUTTON: إضافة الكيو ار كود للرخصة */
.add-qr-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(20, 66, 153, 0.25);
}

.add-qr-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.add-icon {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #dc2626;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.logout-btn:hover {
  background: #fee2e2;
}

/* ================= DEDICATED PERMANENT AMIRI DECREE QR ================= */
.dedicated-decree-card {
  margin: 24px 0 28px 0;
  background: #ffffff;
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.dedicated-decree-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.decree-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}

.decree-content {
  display: flex;
  gap: 22px;
  align-items: center;
}

@media (max-width: 700px) {
  .decree-content {
    flex-direction: column;
    align-items: flex-start;
  }
}

.decree-qr-box {
  background: #ffffff;
  padding: 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  width: 154px;
}

.decree-qr-img {
  width: 134px !important;
  height: 134px !important;
  max-width: 134px !important;
  max-height: 134px !important;
  object-fit: contain;
  display: block;
}

.qr-scan-hint {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
}

.decree-info {
  flex: 1;
}

.decree-title {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.decree-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.meta-item {
  font-size: 12px;
  color: var(--text-secondary);
}

.drn-code {
  background: #f1f5f9;
  color: #0f172a;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
}

.status-pill.active {
  background: #dcfce7;
  color: #15803d;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 700;
}

.decree-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.decree-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  border: 1px solid transparent;
}

.btn-action.primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-action.primary:hover {
  background: var(--primary-hover);
}

.btn-action.secondary {
  background: var(--secondary);
  color: #ffffff;
}

.btn-action.secondary:hover {
  background: #0369a1;
}

.btn-action.outline {
  background: #ffffff;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

.btn-action.outline:hover {
  background: #f8fafc;
}

/* ================= HISTORY TABLE & EMPTY STATE ================= */
.history-section {
  margin-top: 8px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.history-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.history-count-badge {
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.history-filter-info {
  font-size: 12px;
  color: var(--text-muted);
}

.table-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 13px;
}

html[dir="ltr"] .history-table {
  text-align: left;
}

.history-table thead th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  white-space: nowrap;
}

.history-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f8fafc;
  color: var(--text-primary);
  vertical-align: middle;
}

/* Empty State */
.table-empty-state {
  padding: 44px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-icon-box {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 440px;
  line-height: 1.5;
  margin-bottom: 18px;
}

.empty-action-btn {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  color: var(--primary);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.empty-action-btn:hover {
  background: #dbeafe;
}

/* ================= MODALS ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 30px 26px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  position: relative;
  text-align: center;
}

.modal-box-lg {
  max-width: 500px;
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  background: none;
  border: none;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
}

html[dir="ltr"] .modal-close-btn {
  left: auto;
  right: 14px;
}

.modal-icon {
  font-size: 34px;
  margin-bottom: 8px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: right;
}

html[dir="ltr"] .modal-form {
  text-align: left;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.form-select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

.modal-buttons-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn-cancel {
  padding: 0 18px;
  height: 48px;
  background: #f1f5f9;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-cancel:hover {
  background: #e2e8f0;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

html[dir="ltr"] .toast-container {
  right: auto;
  left: 24px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }
.toast.info { background: #1d4ed8; }

/* Global Footer */
.app-footer {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.footer-sub {
  margin-top: 2px;
  color: #94a3b8;
}
