/* ===== CSS Custom Properties (Design Tokens) ===== */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16162a;
  --bg-card: #222240;
  --bg-card-hover: #2a2a4a;
  --gradient-start: #7c3aed;
  --gradient-mid: #a855f7;
  --gradient-end: #d946a8;
  --accent: #2ec4b6;
  --accent-hover: #26a69a;
  --text-primary: #ffffff;
  --text-secondary: #a0a0c0;
  --text-muted: #6b6b8d;
  --border-color: #2e2e50;
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
}

/* ===== Base ===== */
html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html { font-size: 16px; }
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  margin-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--accent-hover);
}

/* ===== Navbar ===== */
.navbar-dark-custom {
  background: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  padding: 0.75rem 0;
}

.navbar-dark-custom .navbar-brand {
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--gradient-mid));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-dark-custom .nav-link {
  color: var(--text-secondary) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.navbar-dark-custom .nav-link:hover,
.navbar-dark-custom .nav-link.active {
  color: var(--text-primary) !important;
  background: rgba(255, 255, 255, 0.05);
}

.navbar-dark-custom .navbar-toggler {
  border-color: var(--border-color);
}
.navbar-dark-custom .navbar-toggler-icon {
  filter: invert(1);
}

.navbar-dark-custom .navbar-text {
  color: var(--text-secondary) !important;
}

/* ===== Hero Section ===== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 4rem 1rem;
  text-align: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #2d1b69 40%, #6b2fa0 70%, var(--gradient-end) 100%);
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 80%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(46, 196, 182, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to top, var(--bg-primary), transparent);
  pointer-events: none;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  .hero { padding: 6rem 2rem; }
  .hero h1 { font-size: 3.5rem; }
}

.hero .lead {
  color: var(--text-secondary);
  font-size: 1.15rem;
  max-width: 520px;
  margin: 0 auto 2rem;
  position: relative;
  z-index: 1;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--gradient-mid), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Buttons ===== */
.btn-accent {
  background: linear-gradient(135deg, var(--accent), #20b2aa);
  color: #fff;
  font-weight: 600;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 50px;
  transition: all 0.3s;
  box-shadow: 0 4px 20px rgba(46, 196, 182, 0.3);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(46, 196, 182, 0.45);
  color: #fff;
}

.btn-gradient {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  font-weight: 600;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 50px;
  transition: all 0.3s;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
}
.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(124, 58, 237, 0.45);
  color: #fff;
}

.btn-outline-light-custom {
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: transparent;
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-outline-light-custom:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ===== Cards ===== */
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: all 0.3s;
  height: 100%;
}
.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.feature-icon-accent {
  background: rgba(46, 196, 182, 0.15);
  color: var(--accent);
}
.feature-icon-purple {
  background: rgba(124, 58, 237, 0.15);
  color: var(--gradient-mid);
}
.feature-icon-pink {
  background: rgba(217, 70, 168, 0.15);
  color: var(--gradient-end);
}

.feature-card h5 {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* ===== Destination Cards ===== */
.dest-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.3s;
}
.dest-card:hover {
  border-color: var(--gradient-mid);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(124, 58, 237, 0.2);
}

.dest-card-img {
  position: relative;
  height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 1rem;
}

.dest-card-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 50%, transparent 100%);
  pointer-events: none;
}

.dest-card-label {
  position: relative;
  z-index: 1;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.95rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

/* ===== Sections ===== */
.section {
  padding: 3rem 0;
}
@media (min-width: 768px) {
  .section { padding: 5rem 0; }
}

.section-dark {
  background: var(--bg-secondary);
}

.section-title {
  font-weight: 800;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}
@media (min-width: 768px) {
  .section-title { font-size: 2.25rem; }
}

.section-subtitle {
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 2.5rem;
}

/* ===== Footer ===== */
.footer-custom {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  position: absolute;
  bottom: 0;
  width: 100%;
}

.footer-custom a {
  color: var(--text-secondary);
}
.footer-custom a:hover {
  color: var(--accent);
}

/* ===== Login Card ===== */
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.login-card .form-control {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
}
.login-card .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(46, 196, 182, 0.2);
  background: var(--bg-primary);
  color: var(--text-primary);
}

.login-card .form-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}

/* ===== Dashboard overrides ===== */
.dashboard-header {
  color: var(--text-primary);
}

.dashboard-header .text-muted {
  color: var(--text-secondary) !important;
}

.form-select-dark {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}
.form-select-dark:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(46, 196, 182, 0.2);
  background-color: var(--bg-card);
  color: var(--text-primary);
}
.form-select-dark option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-label-dark {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ===== Travel Matrix table ===== */
.matrix-table {
  font-size: 0.8rem;
  color: var(--text-primary);
  --bs-table-bg: var(--bg-card);
  --bs-table-border-color: var(--border-color);
  --bs-table-hover-bg: transparent;
}

.matrix-table th {
  background: var(--bg-secondary) !important;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
}

.matrix-table th,
.matrix-table td {
  vertical-align: middle;
  padding: 0.25rem;
  border-color: var(--border-color) !important;
}

.matrix-table .sticky-col {
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 1;
  min-width: 55px;
  padding: 0.45rem 0.6rem;
}

.matrix-table thead .sticky-col {
  background: var(--bg-secondary) !important;
  z-index: 2;
}

.matrix-table thead th {
  padding: 0.45rem 0.6rem;
}

/* ===== Country Cell Card ===== */
.country-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 78px;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
}

.country-cell:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  z-index: 3;
  color: #fff;
  text-decoration: none;
}

.country-cell-flag {
  position: absolute;
  top: 4px;
  left: 5px;
  width: 24px;
  height: 18px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.country-cell-emoji {
  font-size: 1.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  margin-top: 2px;
}

.country-cell-name {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  margin-top: 3px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
}

.country-cell-price {
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 0.55rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.35);
  padding: 1px 5px;
  border-radius: 8px;
}

/* Rank border indicators */
.rank-best {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.rank-mid {
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.4);
}
.rank-high {
  box-shadow: inset 0 0 0 1px rgba(217, 70, 168, 0.3);
}

/* Price heatmap colors (kept for legend badges) */
.price-low {
  background-color: rgba(46, 196, 182, 0.18) !important;
  color: var(--accent) !important;
}

.price-mid {
  background-color: rgba(168, 85, 247, 0.15) !important;
  color: var(--gradient-mid) !important;
}

.price-high {
  background-color: rgba(217, 70, 168, 0.15) !important;
  color: var(--gradient-end) !important;
}

/* ===== Utilities ===== */
.text-accent { color: var(--accent) !important; }
.text-secondary-custom { color: var(--text-secondary) !important; }
.bg-dark-custom { background: var(--bg-primary) !important; }

.alert-dark-warning {
  background: rgba(217, 70, 168, 0.12);
  border: 1px solid rgba(217, 70, 168, 0.3);
  color: var(--gradient-end);
  border-radius: var(--radius-sm);
}

/* ===== Focus states ===== */
.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(46, 196, 182, 0.25);
}
