@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

:root {
  --color-navy: #0f2a4a;
  --color-navy-dark: #0a1c32;
  --color-navy-light: #163c69;
  --color-petrol: #1e5f74;
  --color-petrol-dark: #154554;
  --color-petrol-light: #2d829e;
  --color-emerald: #059669;
  --color-emerald-light: #10b981;
  --color-emerald-bg: #ecfdf5;
  --color-amber: #d97706;
  --color-amber-bg: #fffbeb;
  --color-red: #dc2626;
  --color-red-bg: #fef2f2;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-border-dark: #cbd5e1;
  --color-text-main: #0f172a;
  --color-text-muted: #475569;
  --color-text-light: #64748b;
  --font-body: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

input, button, select, textarea, optgroup {
  font-family: inherit;
}

body {
  font-family: var(--font-body);
  direction: rtl;
  text-align: right;
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-navy);
  font-weight: 700;
  line-height: 1.3;
}

a {
  color: var(--color-petrol);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-navy);
}

/* Container */
.container {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header & Navbar */
.app-header {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-petrol-dark) 100%);
  color: #ffffff;
  border-bottom: 3px solid var(--color-emerald);
  box-shadow: 0 4px 12px rgba(15, 42, 74, 0.15);
}

.top-bar {
  background-color: rgba(0, 0, 0, 0.18);
  font-size: 0.8125rem;
  padding: 0.4rem 0;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1rem;
  white-space: nowrap;
  overflow-x: auto;
}

.main-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  gap: 1.25rem;
  flex-wrap: nowrap;
}

.brand-wrapper {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  white-space: nowrap;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: #93c5fd;
  font-weight: 400;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.nav-links li {
  flex-shrink: 0;
  white-space: nowrap;
}

.nav-links a {
  color: #e2e8f0;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-bottom-color: var(--color-emerald-light);
}

.user-nav-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  padding-right: 1rem;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Card Elements */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 1.5rem;
}

.card-header {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-title {
  font-size: 1.25rem;
  color: var(--color-navy);
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background-color: var(--color-navy);
  color: #ffffff;
  border-color: var(--color-navy);
}
.btn-primary:hover {
  background-color: var(--color-navy-dark);
  color: #ffffff;
}

.btn-secondary {
  background-color: var(--color-petrol);
  color: #ffffff;
}
.btn-secondary:hover {
  background-color: var(--color-petrol-dark);
  color: #ffffff;
}

.btn-success {
  background-color: var(--color-emerald);
  color: #ffffff;
}
.btn-success:hover {
  background-color: #047857;
  color: #ffffff;
}

.btn-outline {
  background-color: transparent;
  border-color: var(--color-border-dark);
  color: var(--color-text-main);
}
.btn-outline:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
}

.btn-danger-outline {
  background-color: transparent;
  border-color: #fca5a5;
  color: var(--color-red);
}
.btn-danger-outline:hover {
  background-color: var(--color-red-bg);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.8rem 1.6rem;
  font-size: 1rem;
}

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

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-navy);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background-color: #ffffff;
  color: var(--color-text-main);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-petrol);
  box-shadow: 0 0 0 3px rgba(30, 95, 116, 0.12);
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--color-text-light);
  margin-top: 0.35rem;
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

/* Metadata & Zero-Pill Rules */
.meta-text {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.meta-separator {
  color: #94a3b8;
  user-select: none;
}

/* Stepper Navigation */
.stepper-nav {
  display: flex;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.step-tab {
  flex: 1;
  padding: 0.875rem 0.5rem;
  text-align: center;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.step-tab:hover {
  background-color: #f8fafc;
  color: var(--color-navy);
}

.step-tab.active {
  color: var(--color-navy);
  border-bottom-color: var(--color-emerald);
  background-color: #f0fdf4;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #e2e8f0;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
}

.step-tab.active .step-number {
  background-color: var(--color-emerald);
  color: #ffffff;
}

/* Criteria Rating Boxes */
.rating-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  background-color: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-top: 0.75rem;
}

.rating-box {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.15s ease;
}

.rating-box:hover {
  border-color: var(--color-border-dark);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
}

.rating-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-navy);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.5rem;
}

.rating-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.rating-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.4rem;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: all 0.15s ease;
  text-align: center;
}

.rating-label:hover {
  border-color: var(--color-petrol);
  background: #f0fdf4;
  color: var(--color-navy);
}

.rating-label input[type="radio"] {
  margin-bottom: 0.35rem;
  accent-color: var(--color-emerald);
}

.rating-label.selected {
  background-color: #ecfdf5;
  border-color: var(--color-emerald);
  color: var(--color-emerald);
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--color-emerald);
}

/* 2x2 Stakeholder Matrix */
.matrix-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 1rem;
  margin-top: 1rem;
}

.matrix-quadrant {
  background: #ffffff;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
  min-height: 180px;
}

.quadrant-close {
  border-color: var(--color-emerald);
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
}

.quadrant-satisfied {
  border-color: var(--color-petrol);
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
}

.quadrant-informed {
  border-color: #ca8a04;
  background: linear-gradient(180deg, #fefce8 0%, #ffffff 100%);
}

.quadrant-monitor {
  border-color: #94a3b8;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.quadrant-header {
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.quadrant-title {
  font-size: 1rem;
  font-weight: 700;
}

.quadrant-desc {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.quadrant-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quadrant-item {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Notice / Alert Banners */
.notice-box {
  background-color: var(--color-amber-bg);
  border-right: 4px solid var(--color-amber);
  border-radius: 0 6px 6px 0;
  padding: 0.875rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: #92400e;
  line-height: 1.5;
}

.info-box {
  background-color: #eff6ff;
  border-right: 4px solid #3b82f6;
  border-radius: 0 6px 6px 0;
  padding: 0.875rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: #1e40af;
}

.success-box {
  background-color: var(--color-emerald-bg);
  border-right: 4px solid var(--color-emerald);
  border-radius: 0 6px 6px 0;
  padding: 0.875rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: #065f46;
}

.error-box {
  background-color: var(--color-red-bg);
  border-right: 4px solid var(--color-red);
  border-radius: 0 6px 6px 0;
  padding: 0.875rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: #991b1b;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.875rem;
}

.data-table th {
  background-color: #f1f5f9;
  color: var(--color-navy);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--color-border);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-main);
}

.data-table tr:hover {
  background-color: #f8fafc;
}

/* Status text badges */
.status-text {
  font-weight: 600;
  font-size: 0.8125rem;
}
.status-text.submitted {
  color: var(--color-emerald);
}
.status-text.draft {
  color: var(--color-amber);
}

/* Footer */
.app-footer {
  background-color: var(--color-navy-dark);
  color: #94a3b8;
  font-size: 0.8125rem;
  padding: 1.5rem 0;
  margin-top: auto;
  border-top: 1px solid #1e293b;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Print Stylesheet */
@media print {
  .app-header,
  .app-footer,
  .no-print,
  .stepper-nav,
  .btn,
  .alert-bar {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .container {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .card {
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  .print-header {
    display: block !important;
    margin-bottom: 20px;
    border-bottom: 2px solid #0f2a4a;
    padding-bottom: 10px;
  }
}

/* ========================================================
   REBUILT SIMPLIFIED ADMIN DASHBOARD STYLES
   ======================================================== */
.admin-header-wrapper {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.admin-header-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 0.35rem;
}

.admin-header-desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-stat-card {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.admin-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.04);
}

.admin-stat-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.admin-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-navy);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.admin-stat-sub {
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-top: 0.4rem;
}

/* Governorate Segmented Filter Tabs */
.gov-tabs-wrapper {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.gov-tabs-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-navy);
  margin-left: 0.5rem;
}

.gov-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: #f1f5f9;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s ease;
}

.gov-tab-btn:hover {
  background: #e2e8f0;
  color: var(--color-navy);
}

.gov-tab-btn.active {
  background: var(--color-navy);
  color: #ffffff;
  border-color: var(--color-navy);
}

.gov-tab-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.08);
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
}

.gov-tab-btn.active .gov-tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Filter Bar */
.admin-filter-bar {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

/* Clean Admin Table */
.admin-table-container {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.admin-table-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  background: #f8fafc;
  padding: 0.85rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-navy);
  border-bottom: 1px solid var(--color-border);
  text-align: right;
  white-space: nowrap;
}

.admin-table td {
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

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

.admin-table tr:hover td {
  background-color: #f8fafc;
}

/* Clean Badges without AI pill slop */
.clean-status-submitted {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-emerald);
  font-weight: 700;
  font-size: 0.8125rem;
}

.clean-status-draft {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-amber);
  font-weight: 700;
  font-size: 0.8125rem;
}

/* Pagination */
.admin-pagination {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafafa;
}

/* Detail Card Styling */
.detail-block {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-block-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-grid-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.detail-field-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.detail-field-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-navy);
}

@media (max-width: 768px) {
  .matrix-container {
    grid-template-columns: 1fr;
  }
  .stepper-nav {
    flex-direction: column;
  }
  .main-navbar {
    flex-direction: column;
    align-items: stretch;
  }
  .top-bar-content {
    flex-direction: column;
    text-align: center;
  }
  .user-nav-box {
    border-right: none;
    padding-right: 0;
    justify-content: center;
  }
}
