/* ═══════════════════════════════════════════════
   المستشارية الثقافية بسفارة جمهورية السودان بالقاهرة — بوابة المعاملات الإلكترونية
   الهوية البصرية الرسمية v2.0
   ═══════════════════════════════════════════════ */

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

/* ── المتغيرات: الوضع الفاتح ── */
:root {
  --primary:        #0e2133;
  --primary-light:  #1c3a55;
  --primary-hover:  #152d44;
  --gold:           #dba227;
  --gold-light:     #e6b85c;
  --gold-pale:      #fdf3e0;
  --bg:             #f4f7f9;
  --card:           #ffffff;
  --text:           #34495e;
  --text-light:     #7f8c8d;
  --border:         #e1e5e8;
  --border-strong:  #c8d0d8;
  --success:        #27ae60;
  --success-bg:     #eafaf1;
  --error:          #c0392b;
  --error-bg:       #fdedec;
  --warning:        #f39c12;
  --warning-bg:     #fef9e7;
  --info:           #2980b9;
  --info-bg:        #eaf4fb;
  --shadow-xs:      0 1px 4px rgba(14,33,51,.06);
  --shadow-sm:      0 2px 10px rgba(14,33,51,.08);
  --shadow-md:      0 6px 24px rgba(14,33,51,.12);
  --shadow-lg:      0 16px 48px rgba(14,33,51,.16);
  --radius-sm:      8px;
  --radius:         12px;
  --radius-lg:      16px;
  --transition:     .2s cubic-bezier(.4,0,.2,1);
  --header-h:       76px;
}

/* ── المتغيرات: الوضع الداكن ── */
@media (prefers-color-scheme: dark) {
  :root {
    --primary:        #0a1929;
    --primary-light:  #122b44;
    --primary-hover:  #0f2338;
    --gold:           #e6b325;
    --gold-light:     #f0c44a;
    --gold-pale:      #1a1500;
    --bg:             #081421;
    --card:           #0e1e2e;
    --text:           #ecf0f1;
    --text-light:     #95a5a6;
    --border:         #2c3e50;
    --border-strong:  #3d5166;
    --success:        #2ecc71;
    --success-bg:     #0a1f14;
    --error:          #e74c3c;
    --error-bg:       #1f0a09;
    --warning:        #f39c12;
    --warning-bg:     #1f1600;
    --info:           #3498db;
    --info-bg:        #091624;
    --shadow-xs:      0 1px 4px rgba(0,0,0,.3);
    --shadow-sm:      0 2px 10px rgba(0,0,0,.35);
    --shadow-md:      0 6px 24px rgba(0,0,0,.4);
    --shadow-lg:      0 16px 48px rgba(0,0,0,.5);
  }
}

/* ── الوضع الداكن اليدوي ── */
[data-theme="dark"] {
  --primary:        #0a1929;
  --primary-light:  #122b44;
  --primary-hover:  #0f2338;
  --gold:           #e6b325;
  --gold-light:     #f0c44a;
  --gold-pale:      #1a1500;
  --bg:             #081421;
  --card:           #0e1e2e;
  --text:           #ecf0f1;
  --text-light:     #95a5a6;
  --border:         #2c3e50;
  --border-strong:  #3d5166;
  --success:        #2ecc71;
  --success-bg:     #0a1f14;
  --error:          #e74c3c;
  --error-bg:       #1f0a09;
  --warning:        #f39c12;
  --warning-bg:     #1f1600;
  --info:           #3498db;
  --info-bg:        #091624;
}

[data-theme="light"] {
  --primary:        #0e2133;
  --primary-light:  #1c3a55;
  --gold:           #dba227;
  --gold-light:     #e6b85c;
  --gold-pale:      #fdf3e0;
  --bg:             #f4f7f9;
  --card:           #ffffff;
  --text:           #34495e;
  --text-light:     #7f8c8d;
  --border:         #e1e5e8;
}

/* ── الأساسيات ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Tajawal', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  direction: rtl;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* ── الهيدر ── */
.site-header {
  background: var(--primary);
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 20px rgba(0,0,0,.3);
  border-bottom: 2px solid var(--primary-light);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 22px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex: 1 1 auto;
  min-width: 0;
}

.header-emblem {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-emblem img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.header-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.header-name {
  color: #fff;
  font-family: 'Tajawal', sans-serif;
  font-size: clamp(14px, 1.5vw, 17px);
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-affiliation {
  color: rgba(255,255,255,.78);
  font-family: 'Tajawal', sans-serif;
  font-size: clamp(11.5px, 1.15vw, 13.5px);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-sub {
  color: var(--gold);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,.15); color: #fff; }
.theme-toggle svg { width: 17px; height: 17px; }

.btn-header {
  background: var(--gold);
  color: var(--primary);
  padding: 8px 18px;
  border-radius: 50px;
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-header:hover { background: var(--gold-light); transform: translateY(-1px); }
.btn-header svg { width: 15px; height: 15px; }

/* ── شريط الإشعار ── */
.notice-bar {
  background: var(--gold-pale);
  border-bottom: 1px solid rgba(219,162,39,.25);
  padding: 9px 24px;
  font-size: 12.5px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.notice-bar strong { color: var(--primary); font-weight: 700; }
.notice-dot {
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── الأزرار ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 50px;
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(14,33,51,.3);
}
.btn-primary:hover { background: var(--primary-light); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(14,33,51,.35); }

.btn-gold {
  background: var(--gold);
  color: var(--primary);
  box-shadow: 0 4px 14px rgba(219,162,39,.35);
}
.btn-gold:hover { background: var(--gold-light); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(219,162,39,.4); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary-light); color: var(--primary); background: var(--card); }

.btn-ghost {
  background: transparent;
  color: var(--text-light);
  padding: 12px 20px;
}
.btn-ghost:hover { color: var(--text); background: var(--bg); }

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── البطاقات ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

/* ── حقول النماذج ── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field[hidden],
[hidden].field {
  display: none !important;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}
.req { color: var(--error); font-size: 15px; line-height: 1; }

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: var(--transition);
  appearance: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary-light);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(28,58,85,.12);
}
.field input.has-error,
.field select.has-error,
.field textarea.has-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(192,57,43,.1);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-light); opacity: .7; }

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237f8c8d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 36px;
  cursor: pointer;
}
.field .select-other-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}
.field .select-other-wrap[hidden] {
  display: none !important;
}

.field textarea { resize: vertical; min-height: 88px; }

.field-hint { font-size: 12px; color: var(--text-light); }
.field-redundancy-warn {
  font-size: 12px;
  line-height: 1.5;
  color: var(--error);
  margin-top: 2px;
}
.field input.has-redundancy,
.field textarea.has-redundancy {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 3px rgba(192,57,43,.12) !important;
}
.field-error {
  font-size: 12px;
  color: var(--error);
  display: none;
  align-items: center;
  gap: 4px;
}
.field-error.show { display: flex; }
.field-error svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── شبكة الحقول ── */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.field-grid .col-full { grid-column: 1 / -1; }
@media (max-width: 560px) {
  .field-grid { grid-template-columns: 1fr; }
  .field-grid .col-full { grid-column: 1; }
}

/* ── رفع الملفات ── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg);
  position: relative;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary-light);
  background: rgba(28,58,85,.04);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-icon {
  width: 44px;
  height: 44px;
  background: rgba(14,33,51,.07);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}
[data-theme="dark"] .upload-icon { background: rgba(255,255,255,.07); }
@media (prefers-color-scheme: dark) { .upload-icon { background: rgba(255,255,255,.07); } }
.upload-icon svg { width: 22px; height: 22px; color: var(--primary-light); }
.upload-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.upload-sub   { font-size: 12px; color: var(--text-light); }

.file-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--success-bg);
  border: 1px solid rgba(39,174,96,.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 0;
}
.file-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.file-preview-thumb {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card);
  border: 1px solid rgba(39,174,96,.2);
  flex-shrink: 0;
}
.file-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.file-preview-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--success);
  background: rgba(39,174,96,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-preview-icon svg { width: 18px; height: 18px; }
.file-preview-info { flex: 1; min-width: 0; }
.file-preview-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview-size { font-size: 11.5px; color: var(--text-light); }
.file-remove-btn {
  color: var(--error);
  cursor: pointer;
  background: var(--error-bg);
  border: 1px solid rgba(192,57,43,.18);
  padding: 5px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.file-remove-btn:hover { transform: scale(1.06); border-color: rgba(192,57,43,.35); }
.file-remove-btn svg { width: 14px; height: 14px; }

/* ── حالات الطلب ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.status-badge svg { width: 14px; height: 14px; }
.status-pending  { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(243,156,18,.25); }
.status-review   { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(41,128,185,.25); }
.status-approved { background: var(--success-bg); color: var(--success); border: 1px solid rgba(39,174,96,.25); }
.status-rejected { background: var(--error-bg);   color: var(--error);   border: 1px solid rgba(192,57,43,.25); }

/* ── الفوتر ── */
.site-footer {
  background: var(--primary);
  border-top: 3px solid var(--gold);
  padding: 28px 24px;
  text-align: center;
}
.footer-flag {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 16px;
}
.flag-stripe {
  height: 5px;
  width: 60px;
  border-radius: 0;
}
.flag-stripe:first-child  { background: #c0392b; border-radius: 3px 0 0 3px; }
.flag-stripe:nth-child(2) { background: #fff; }
.flag-stripe:last-child   { background: #1a1a1a; border-radius: 0 3px 3px 0; }
.footer-text { font-size: 13px; color: rgba(255,255,255,.45); }
.footer-text a { color: var(--gold); text-decoration: none; }

/* ── مؤشر التحميل ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,25,41,.75);
  backdrop-filter: blur(3px);
  z-index: 999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.loading-overlay.show { display: flex; }
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #fff; font-size: 15px; font-weight: 600; }

/* ── الأنيميشن ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .45s cubic-bezier(.4,0,.2,1) both; }
.delay-1 { animation-delay: .08s; }
.delay-2 { animation-delay: .16s; }
.delay-3 { animation-delay: .24s; }
.delay-4 { animation-delay: .32s; }

/* ── ريسبونسيف عام ── */
@media (max-width: 760px) {
  .header-inner { padding: 0 16px; gap: 10px; }
  .header-emblem { width: 44px; height: 44px; }
  .header-name { font-size: 13.5px; }
  .header-affiliation { font-size: 11.5px; }
  .btn-header { padding: 8px 13px; font-size: 12px; }
}
@media (max-width: 640px) {
  .header-sub { display: none; }
  .notice-bar { font-size: 11.5px; gap: 12px; }
}
@media (max-width: 400px) {
  .header-inner { padding: 0 12px; gap: 8px; }
  .header-brand { gap: 8px; }
  .header-name { font-size: 12.5px; }
  .header-affiliation { font-size: 10.5px; }
  .header-emblem { width: 38px; height: 38px; }
  .btn-header { padding: 8px 10px; }
}
