/* ========================================
   Excursion Platform — Mobile-First CSS
   ======================================== */

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

:root {
  --bg: #faf9f7;
  --bg-card: #ffffff;
  --text: #2c2c2c;
  --text-muted: #7a7a7a;
  --primary: #e06c40;
  --primary-dark: #c45830;
  --primary-light: #fdf0eb;
  --accent: #3a7d6e;
  --accent-light: #e8f5f0;
  --border: #e8e5e0;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Nunito', -apple-system, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --max-w: 640px;
  --nav-h: 56px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; display: block; }

/* ---- Layout ---- */
.page { max-width: var(--max-w); margin: 0 auto; padding: 0 16px 100px; }
.page-wide { max-width: 960px; margin: 0 auto; padding: 0 16px 60px; }

/* ---- Top Nav ---- */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,249,247,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  max-width: var(--max-w); margin: 0 auto;
}
.topnav-wide { max-width: 960px; }
.topnav .logo {
  font-family: var(--font-display);
  font-size: 1.15rem; font-weight: 700; color: var(--text);
}
.topnav .nav-links { display: flex; gap: 16px; align-items: center; }
.topnav .nav-links a {
  font-size: 0.85rem; font-weight: 600; color: var(--text-muted);
  transition: color .2s;
}
.topnav .nav-links a:hover, .topnav .nav-links a.active { color: var(--primary); }

/* ---- Hero ---- */
.hero {
  padding: 32px 0 24px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 1.75rem; line-height: 1.2; margin-bottom: 8px;
}
.hero p { color: var(--text-muted); font-size: 0.95rem; }

/* ---- Search ---- */
.search-bar {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.search-bar input {
  flex: 1; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.95rem; font-family: var(--font);
  background: var(--bg-card); outline: none;
  transition: border-color .2s;
}
.search-bar input:focus { border-color: var(--primary); }
.search-bar button {
  padding: 12px 20px; background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius-sm); font-weight: 700; cursor: pointer;
  font-family: var(--font); font-size: 0.9rem;
  transition: background .2s;
}
.search-bar button:hover { background: var(--primary-dark); }

/* ---- Category Chips ---- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  padding: 6px 14px; border-radius: 20px; font-size: 0.82rem; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted);
  cursor: pointer; transition: all .2s;
}
.chip:hover, .chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ---- Excursion Cards ---- */
.card-grid { display: flex; flex-direction: column; gap: 16px; }

.exc-card {
  background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
  cursor: pointer;
}
.exc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.exc-card .cover {
  width: 100%; height: 200px; object-fit: cover; background: var(--border);
}
.exc-card .cover-placeholder {
  width: 100%; height: 200px; background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--primary);
}
.exc-card .card-body { padding: 16px; }
.exc-card h3 {
  font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 6px;
}
.exc-card .desc {
  color: var(--text-muted); font-size: 0.88rem; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.exc-card .meta {
  font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 12px;
}

/* ---- Excursion Detail Page ---- */
.exc-hero-img {
  width: calc(100% + 32px); margin: 0 -16px; height: 260px; object-fit: cover;
}
.exc-hero-placeholder {
  width: calc(100% + 32px); margin: 0 -16px; height: 200px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem; color: var(--primary);
}
.exc-detail { padding-top: 20px; }
.exc-detail h1 { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: 12px; }
.exc-detail .full-desc { color: var(--text); font-size: 0.95rem; line-height: 1.7; white-space: pre-line; }
.exc-detail .points-count { color: var(--text-muted); font-size: 0.88rem; margin: 16px 0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 28px; border-radius: var(--radius-sm); font-size: 1rem;
  font-weight: 700; font-family: var(--font); border: none; cursor: pointer;
  transition: all .2s; text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #2d6459; color: #fff; }
.btn-outline {
  background: transparent; border: 2px solid var(--border); color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-ghost { background: none; border: none; color: var(--text-muted); padding: 8px; cursor: pointer; }

/* ---- Point Page ---- */
.point-progress {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
  font-size: 0.82rem; color: var(--text-muted);
}
.progress-bar {
  flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width .4s ease; }

.point-image {
  width: 100%; margin: 0 auto 20px; max-height: 70vh; object-fit: contain; border-radius: 12px; display: block; 
}
.point-title {
  font-family: var(--font-display); font-size: 1.35rem; margin-bottom: 12px;
}
.point-text {
  font-size: 0.95rem; line-height: 1.75; white-space: pre-line; color: var(--text);
  margin-bottom: 24px;
}
.point-actions {
  display: flex; flex-direction: column; gap: 10px; margin-top: 24px;
  padding-top: 20px; border-top: 1px solid var(--border);
}

/* ---- Finish Screen ---- */
.finish-screen {
  text-align: center; padding: 60px 20px;
}
.finish-icon { font-size: 4rem; margin-bottom: 16px; }
.finish-screen h1 {
  font-family: var(--font-display); font-size: 1.6rem; margin-bottom: 12px;
}
.finish-screen p { color: var(--text-muted); margin-bottom: 30px; }
.finish-actions { display: flex; flex-direction: column; gap: 12px; max-width: 300px; margin: 0 auto; }

/* ---- Favorites ---- */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }

/* ---- Favorite heart ---- */
.fav-btn {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.85); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: transform .2s;
  backdrop-filter: blur(4px);
}
.fav-btn:hover { transform: scale(1.15); }
.fav-btn.active { color: #e74c3c; }

.card-wrap { position: relative; }

/* ---- 404 ---- */
.not-found { text-align: center; padding: 80px 20px; }
.not-found h1 { font-size: 4rem; color: var(--primary); }

/* ========================================
   ADMIN STYLES
   ======================================== */
.admin-body { background: #f4f5f7; }

.admin-nav {
  background: #1e293b; color: #fff; padding: 0 20px; height: 52px;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-nav .brand { font-weight: 800; font-size: 1rem; }
.admin-nav a { color: rgba(255,255,255,0.7); font-size: 0.85rem; font-weight: 600; }
.admin-nav a:hover { color: #fff; }
.admin-nav .nav-right { display: flex; gap: 16px; align-items: center; }

.admin-content { max-width: 960px; margin: 24px auto; padding: 0 16px; }

.admin-card {
  background: #fff; border-radius: 12px; padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06); margin-bottom: 20px;
}
.admin-card h2 { font-size: 1.15rem; margin-bottom: 16px; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-box {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06); text-align: center;
}
.stat-box .num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-box .label { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }

/* Tables */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th {
  text-align: left; padding: 10px 12px; font-weight: 700; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.admin-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:hover td { background: #fafafa; }

.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
}
.status-published { background: #d4edda; color: #155724; }
.status-draft { background: #fff3cd; color: #856404; }
.status-archived { background: #e2e3e5; color: #383d41; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; color: var(--text);
}
.form-group input[type=text],
.form-group input[type=password],
.form-group input[type=number],
.form-group textarea,
.form-group select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.92rem; font-family: var(--font);
  background: #fff; outline: none; transition: border-color .2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--primary);
}
.form-group textarea { min-height: 120px; resize: vertical; }
.form-group .help { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.form-check input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }

.form-row { display: flex; gap: 16px; }
.form-row > * { flex: 1; }

.form-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

.alert {
  padding: 14px 18px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 16px;
}
.alert-success { background: #d4edda; color: #155724; }
.alert-danger { background: #f8d7da; color: #721c24; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-info { background: #d1ecf1; color: #0c5460; }

/* Login */
.login-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  padding: 20px;
}
.login-box {
  background: #fff; border-radius: 16px; padding: 40px 32px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-box h1 {
  font-family: var(--font-display); font-size: 1.5rem; text-align: center; margin-bottom: 24px;
}

/* Action buttons in tables */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions form { display: inline; }

/* Responsive */
@media (min-width: 640px) {
  .card-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 2.2rem; }
}

/* ---- Transitions table ---- */
.trans-mini {
  font-size: 0.8rem; color: var(--text-muted);
}
.trans-mini .arrow { color: var(--primary); font-weight: 700; }

/* Scroll helper for tables on mobile */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Dark Theme ---- */
[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-card: #252525;
  --text: #e8e5e0;
  --text-muted: #999;
  --primary: #f0845c;
  --primary-dark: #e06c40;
  --primary-light: #3a2820;
  --accent: #5aad9a;
  --accent-light: #1e3530;
  --border: #333;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
}
[data-theme="dark"] .topnav {
  background: rgba(26,26,26,0.92);
  border-bottom-color: #333;
}
[data-theme="dark"] .exc-card { background: var(--bg-card); }
[data-theme="dark"] .fav-btn { background: rgba(40,40,40,0.85); color: #ccc; }
[data-theme="dark"] .cover-placeholder,
[data-theme="dark"] .exc-hero-placeholder {
  background: linear-gradient(135deg, #3a2820, #1e3530);
}
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .search-bar input {
  background: #2a2a2a; color: #e8e5e0; border-color: #444;
}
[data-theme="dark"] .chip { background: #2a2a2a; border-color: #444; color: #999; }
[data-theme="dark"] .chip:hover, [data-theme="dark"] .chip.active {
  background: var(--primary-light); border-color: var(--primary); color: var(--primary);
}
[data-theme="dark"] .progress-bar { background: #333; }
[data-theme="dark"] .point-actions { border-top-color: #333; }
[data-theme="dark"] .btn-outline { border-color: #444; color: #ccc; }
[data-theme="dark"] .btn-outline:hover { border-color: var(--primary); color: var(--primary); }
[data-theme="dark"] footer { border-top-color: #333; }
