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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --transition: all .2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ───────────────────────────────────────────────────────── */
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
}

.card-sm { max-width: 420px; }
.card-md { max-width: 520px; }

/* ── Header / Nav ─────────────────────────────────────────────────────── */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  text-decoration: none;
}

.navbar-brand:hover { text-decoration: none; }
.navbar-brand .logo-icon { font-size: 1.5rem; }

.navbar-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gray-600);
  font-size: .9rem;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

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

.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }

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

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover { background: var(--gray-100); }

.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--gray-200);
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--gray-100); }

/* ── Forms ────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: .9rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  transition: var(--transition);
  background: #fff;
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

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

.form-input-sm { padding: 8px 12px; font-size: .85rem; }

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

.form-error {
  color: var(--danger);
  font-size: .85rem;
  margin-top: 4px;
}

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: var(--primary-light); color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Auth pages ───────────────────────────────────────────────────────── */
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .icon { font-size: 3rem; }
.auth-logo h1 { font-size: 1.5rem; margin-top: 8px; color: var(--gray-900); }
.auth-logo p { color: var(--gray-500); font-size: .9rem; margin-top: 4px; }

.auth-footer {
  text-align: center;
  margin-top: 24px;
  color: var(--gray-500);
  font-size: .9rem;
}

.auth-footer a { font-weight: 500; }

/* ── Dashboard ────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 { margin: 0; }

.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.trip-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid var(--gray-200);
}

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

.trip-card-image {
  height: 180px;
  background: var(--gray-200);
  background-size: cover;
  background-position: center;
  position: relative;
}

.trip-card-image .country-flag {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 24px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

.trip-card-image .placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 3rem;
  color: var(--gray-400);
}

.trip-card-body { padding: 20px; }

.trip-card-body h3 { margin-bottom: 4px; }

.trip-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.trip-card-meta span {
  font-size: .82rem;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 4px;
}

.trip-card-meta .badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.trip-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--gray-500);
}

.trip-empty .icon { font-size: 4rem; margin-bottom: 16px; }
.trip-empty h2 { margin-bottom: 8px; }

/* ── Trip Form ────────────────────────────────────────────────────────── */
.form-section {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
  border: 1px solid var(--gray-200);
}

.form-section h2 {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.gallery img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.gallery img:hover { transform: scale(1.03); opacity: .9; }

.gallery img.selected {
  border: 3px solid var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ── Places List ──────────────────────────────────────────────────────── */
.places-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.place-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: var(--transition);
}

.place-card:hover { border-color: var(--primary); }

.place-card h4 { margin-bottom: 4px; font-size: 1rem; }
.place-card .category {
  display: inline-block;
  font-size: .78rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  margin-bottom: 8px;
  font-weight: 500;
}
.place-card p { font-size: .88rem; color: var(--gray-500); }

/* ── Documents ────────────────────────────────────────────────────────── */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  gap: 12px;
}

.doc-item .doc-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.doc-item .doc-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-item .doc-size { color: var(--gray-400); font-size: .82rem; }
.doc-item .doc-actions { display: flex; gap: 8px; }

/* ── Dropzone ─────────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-50);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone .icon { font-size: 2.5rem; color: var(--gray-400); margin-bottom: 12px; }
.dropzone p { color: var(--gray-500); }

/* ── Trip Detail ──────────────────────────────────────────────────────── */
.detail-header {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--gray-200);
}

.detail-cover {
  height: 300px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.detail-cover-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  padding: 32px;
  color: #fff;
}

.detail-cover-overlay h1 { margin-bottom: 4px; }
.detail-cover-overlay .meta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

.detail-body { padding: 32px; }

.detail-section { margin-bottom: 32px; }
.detail-section h2 { margin-bottom: 16px; }
.detail-section p { color: var(--gray-600); line-height: 1.7; }

/* ── Loading ──────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--gray-500);
  gap: 12px;
}

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal h2 { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ── Spacing helpers ──────────────────────────────────────────────────── */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .trip-grid { grid-template-columns: 1fr; }
  .trip-card-image { height: 140px; }
  .places-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .detail-cover { height: 200px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .navbar .container { flex-wrap: wrap; }
  .card { padding: 24px; }
}

/* ── Toast notifications ──────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
  animation: slideIn .3s ease;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--primary); color: #fff; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
