@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Playfair+Display:wght@600;700&display=swap');

:root {
  --navy-950: #040d1d;
  --navy-900: #071630;
  --navy-800: #0d2247;
  --navy-700: #163366;
  --gold-500: #d4af37;
  --gold-400: #e7c873;
  --gold-600: #b58d1f;
  --bg-page: #f6f4ef;
  --bg-card: #ffffff;
  --text-main: #0e1a2f;
  --text-muted: #5c677d;
  --border-soft: rgba(13, 34, 71, 0.1);
  --success: #138a56;
  --warning: #d97706;
  --danger: #dc2626;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-card: 0 10px 30px rgba(7, 22, 48, 0.07);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
}

.font-en {
  font-family: 'Playfair Display', Georgia, serif;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Top App Header */
.memora-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(135deg, var(--navy-950), var(--navy-800));
  color: #fff;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  box-shadow: 0 6px 24px rgba(4, 13, 29, 0.25);
}

.memora-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}

/* Header buttons never wrap or get pushed outside the bar */
.memora-header .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .memora-header-inner { padding: 8px 12px; gap: 8px; }
  .memora-header .brand-lockup img { height: 34px; }
  .memora-header .brand-lockup .font-en { font-size: 16px !important; }
  .memora-header .btn-sm { padding: 7px 10px; font-size: 12.5px; }
}

@media (max-width: 380px) {
  /* Logo image already carries the wordmark — drop the duplicate text */
  .memora-header .brand-lockup > div { display: none; }
}

.brand-lockup img {
  height: 42px;
  width: auto;
  border-radius: 8px;
  object-fit: contain;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.18);
  color: var(--gold-400);
  border: 1px solid rgba(212, 175, 55, 0.4);
  display: inline-block;
  line-height: 1.7;
  max-width: 100%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-gold {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500), var(--gold-600));
  color: var(--navy-950);
  box-shadow: 0 6px 18px rgba(212, 175, 55, 0.35);
}

.btn-navy {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-950));
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-soft);
  color: var(--text-main);
}

.btn-outline-gold {
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: var(--gold-400);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 10px;
}

/* Containers & Cards */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 16px 96px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.card-dark {
  background: linear-gradient(145deg, var(--navy-900), var(--navy-800));
  color: #fff;
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

/* Form Elements */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid rgba(13, 34, 71, 0.16);
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s;
}

.input:focus, select:focus, textarea:focus {
  border-color: var(--gold-500);
}

/* Status Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill-gold { background: rgba(212, 175, 55, 0.16); color: #8c690b; }
.pill-navy { background: rgba(13, 34, 71, 0.1); color: var(--navy-800); }
.pill-green { background: rgba(19, 138, 86, 0.13); color: var(--success); }
.pill-amber { background: rgba(217, 119, 6, 0.13); color: var(--warning); }
.pill-red { background: rgba(220, 38, 38, 0.12); color: var(--danger); }

/* Mobile Bottom Nav */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: rgba(7, 22, 48, 0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  display: flex;
  justify-content: space-around;
  padding: 6px 4px env(safe-area-inset-bottom, 8px);
}

.mobile-nav button {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  cursor: pointer;
}

.mobile-nav button.active {
  color: var(--gold-400);
}

.mobile-nav button .ico {
  font-size: 19px;
  line-height: 1;
}

/* Desktop Tabs */
.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tab-btn {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border-soft);
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.tab-btn.active {
  background: var(--navy-900);
  color: var(--gold-400);
  border-color: var(--navy-900);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(4, 13, 29, 0.72);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: #fff;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 24px 64px rgba(4, 13, 29, 0.45);
}

/* Toast */
.memora-toast-wrap {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.memora-toast {
  background: var(--navy-900);
  color: #fff;
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0,0,0,0.28);
  pointer-events: auto;
}

.memora-toast.error {
  border-color: var(--danger);
  background: #3b0b0b;
}

.memora-toast.success {
  border-color: var(--success);
  background: #082e1d;
}

/* PWA Install Banner */
.pwa-banner {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.18), rgba(13, 34, 71, 0.08));
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table.memora-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.memora-table th,
table.memora-table td {
  text-align: start;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

table.memora-table th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
  background: #faf8f4;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.media-thumb {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #0a1832;
  aspect-ratio: 4 / 3;
}

.media-thumb img,
.media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stat-val {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}

.stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
}

.card-dark .stat-lbl {
  color: rgba(255, 255, 255, 0.72);
}

@media (min-width: 900px) {
  .mobile-nav {
    display: none;
  }
  .container {
    padding-bottom: 40px;
  }
}
@media (max-width: 899px) {
  .tabs-bar.hide-mobile {
    display: none;
  }
}
