/* ==========================================================================
   HORIZON TRAVEL - Admin Panel CSS
   ========================================================================== */

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

:root {
  --navy:       #0d3a58; /* Bleu Mer Profond */
  --navy-dark:  #07253b; /* Abysse / Bleu Noir */
  --navy-mid:   #1a5d8c; /* Bleu Mer Moyen */
  --gold:       #a6734c; /* Marron Terre / Torab */
  --gold-light: #d4a373; /* Sable Chaud / Ocre */
  --success:    #10b981;
  --danger:     #ef4444;
  --warning:    #f59e0b;
  --white:      #ffffff;
  --bg:         #f7f4ee; /* Fond Sable Doux */
  --bg-card:    #ffffff;
  --border:     #f2ebe1; /* Bordure Sable Doux */
  --text-dark:  #0d3a58; /* Bleu Mer Profond */
  --text-mid:   #5c4d40; /* Marron Grisâtre */
  --text-light: #8c7d70; /* Sable Foncé */
  --sidebar-w:  280px;
  --topbar-h:   68px;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 2px 16px rgba(13,58,88,0.06);
  --shadow-lg:  0 8px 40px rgba(13,58,88,0.10);
  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text-dark); }
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font-family: inherit; }

/* ===== LAYOUT ===== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-dark);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.logo-title {
  font-size: 15px;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}

.logo-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
}

.sidebar-close {
  background: none; border: none; color: rgba(255,255,255,0.4);
  font-size: 16px; cursor: pointer; padding: 4px;
  display: none;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.1em;
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  margin-bottom: 2px;
  cursor: pointer;
  transition: var(--transition);
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: white;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(166, 115, 76, 0.25), rgba(166, 115, 76, 0.1));
  color: var(--gold-light);
  font-weight: 600;
}

.nav-icon { font-size: 16px; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.btn-view-site {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: rgba(166, 115, 76, 0.15);
  border: 1px solid rgba(166, 115, 76, 0.3);
  border-radius: var(--radius-sm);
  color: var(--gold-light);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.btn-view-site:hover {
  background: rgba(166, 115, 76, 0.25);
  color: var(--gold);
}

/* ===== MAIN ===== */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
.admin-topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}

.menu-toggle {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--text-mid); padding: 4px;
  display: none;
}

.topbar-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.btn-save-all {
  padding: 9px 20px;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; gap: 6px;
}

.btn-save-all:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(26,46,69,0.25);
}

/* ===== CONTENT ===== */
.admin-content { padding: 28px; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 28px;
}
.page-header h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
}
.page-header p {
  color: var(--text-mid);
  font-size: 14px;
}

/* ===== DASHBOARD ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-icon { font-size: 32px; }
.stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
  margin-top: 4px;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.quick-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.quick-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transform: scaleX(0);
  transition: var(--transition);
}

.quick-card:hover::before { transform: scaleX(1); }

.quick-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.quick-card-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.quick-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.quick-card p {
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.5;
}

.quick-card-arrow {
  position: absolute;
  bottom: 20px; right: 20px;
  font-size: 20px;
  color: var(--gold);
  font-weight: 700;
}

.info-banner {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.info-banner-icon { font-size: 24px; flex-shrink: 0; }
.info-banner strong { display: block; color: var(--navy); font-size: 15px; margin-bottom: 6px; }
.info-banner p { font-size: 13px; color: var(--text-mid); }
.info-banner code {
  background: rgba(26,46,69,0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}

/* ===== FORM CARD ===== */
.form-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.form-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-dark);
  background: #fafbfc;
  transition: var(--transition);
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: white;
  box-shadow: 0 0 0 3px rgba(166, 115, 76, 0.12);
}

.form-group small {
  font-size: 11px;
  color: var(--text-light);
}

/* ===== BUTTONS ===== */
.btn-primary {
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26,46,69,0.3);
}

.btn-secondary {
  padding: 12px 28px;
  background: white;
  color: var(--text-dark);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--text-light);
}

.btn-danger {
  padding: 12px 28px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 4px 0 20px;
}

/* ===== TRIPS LIST ===== */
.trips-admin-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.trip-admin-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
}

.trip-admin-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--gold-light);
}

.trip-admin-thumb {
  width: 80px; height: 64px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}

.trip-admin-info {
  flex: 1;
  min-width: 0;
}

.trip-admin-dest {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.trip-admin-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-admin-meta {
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  gap: 12px;
}

.trip-admin-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-edit, .btn-delete {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-edit {
  background: rgba(26,46,69,0.08);
  color: var(--navy);
}
.btn-edit:hover { background: var(--navy); color: white; }

.btn-delete {
  background: rgba(239,68,68,0.08);
  color: var(--danger);
}
.btn-delete:hover { background: var(--danger); color: white; }

/* ===== ITEMS LIST ===== */
.items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.item-row-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-dark);
  line-height: 1.5;
  direction: rtl;
  text-align: right;
}

.item-row-edit {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: 14px; padding: 2px 6px;
  transition: var(--transition);
}
.item-row-edit:hover { color: var(--navy); }

.item-row-delete {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: 14px; padding: 2px 6px;
  transition: var(--transition);
}
.item-row-delete:hover { color: var(--danger); }

/* Hotel item */
.hotel-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.hotel-item-info { flex: 1; }
.hotel-item-name { font-size: 13px; font-weight: 600; color: var(--navy); }
.hotel-item-meta { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* Itinerary item */
.itinerary-item {
  padding: 12px 14px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
}

.itinerary-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.itinerary-day-badge {
  background: var(--navy);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.itinerary-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
  margin: 0 10px;
  direction: rtl;
  text-align: right;
}

.itinerary-item-desc {
  font-size: 12px;
  color: var(--text-mid);
  line-height: 1.5;
  direction: rtl;
  text-align: right;
}

.itinerary-item-actions {
  display: flex;
  gap: 6px;
}

/* ===== ADD ITEM ROW ===== */
.add-item-row, .add-hotel-row, .add-itinerary-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 8px;
}

.btn-add-item {
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy-dark);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.btn-add-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(166, 115, 76, 0.4);
}

/* Input fallback styling */
.add-item-row input, .add-item-row textarea,
.add-hotel-row input, .add-hotel-row select {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  flex: 1;
  background: #fafbfc;
  transition: var(--transition);
}

.add-item-row input:focus, .add-item-row textarea:focus,
.add-hotel-row input:focus, .add-hotel-row select:focus {
  outline: none;
  border-color: var(--gold);
  background: white;
}

/* ===== PRICE EDITOR ===== */
.price-editor {
  margin-top: 16px;
}

.price-option-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.price-option-row input {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.price-option-row input:focus {
  outline: none;
  border-color: var(--gold);
}

/* ===== DATES ===== */
.dates-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.date-admin-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f0f4f8;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--navy);
  direction: rtl;
}

.date-admin-badge button {
  background: none; border: none; cursor: pointer;
  color: var(--danger); font-size: 14px; line-height: 1;
  padding: 0 2px;
}

/* ===== EXPORT ===== */
.export-card {
  background: white;
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.export-icon { font-size: 64px; margin-bottom: 16px; }

.export-card h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 12px;
}

.export-card p {
  color: var(--text-mid);
  font-size: 15px;
  margin-bottom: 28px;
}

.export-card code {
  background: rgba(26,46,69,0.08);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
}

.btn-export {
  padding: 14px 36px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy-dark);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-export:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(166, 115, 76, 0.4);
}

.export-steps {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
}

.export-steps h3 {
  font-size: 16px; font-weight: 700; color: var(--navy);
  margin-bottom: 20px;
}

.steps-list { display: flex; flex-direction: column; gap: 16px; }

.step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.step-num {
  width: 32px; height: 32px;
  background: var(--navy);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}

.step strong { display: block; font-size: 14px; color: var(--navy); margin-bottom: 4px; }
.step p { font-size: 13px; color: var(--text-mid); }
.step code {
  background: rgba(26,46,69,0.08);
  padding: 1px 6px; border-radius: 4px; font-family: monospace; font-size: 11px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  background: var(--navy-dark);
  color: white;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--navy); }
.toast.show { transform: translateY(0); opacity: 1; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,31,48,0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
}

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

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 40px;
  width: 420px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.modal-icon { font-size: 48px; margin-bottom: 16px; }
.modal h3   { font-size: 20px; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.modal p    { font-size: 14px; color: var(--text-mid); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close { display: block; }
  .menu-toggle   { display: block; }

  .admin-main {
    margin-left: 0;
  }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-cards { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full-width { grid-column: 1; }
  .admin-content { padding: 16px; }
  .add-hotel-row { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .trip-admin-thumb { display: none; }
  .trip-admin-actions { flex-direction: column; }
}

/* ===== AUTH OVERLAY ===== */
.auth-overlay {
  position: fixed; inset: 0;
  background: var(--navy-dark);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: white;
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gold-light);
}

.auth-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.auth-card h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 8px;
}

.auth-card p {
  font-size: 13px;
  color: var(--text-mid);
  margin-bottom: 24px;
  line-height: 1.5;
}

.auth-card input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 16px;
  outline: none;
}

.auth-card input:focus {
  border-color: var(--gold);
}

