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

/* ── TOKENS ── */
:root {
  --primary:      #8b0000;
  --primary-dark: #6b0000;
  --primary-light:#b91c1c;
  --accent:       #f59e0b;
  --accent-dark:  #b45309;
  --bg:           #fafaf9;
  --bg-card:      #ffffff;
  --border:       #e7e5e4;
  --text:         #1c1917;
  --text-muted:   #78716c;
  --success:      #16a34a;
  --warning:      #d97706;
  --danger:       #dc2626;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 12px rgba(0,0,0,.08);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    linear-gradient(to right bottom, rgba(255,255,255,.96), rgba(255,255,255,.88)),
    url('../fondo-cartagena.jpg');
  background-size: cover;
  background-attachment: fixed;
}

/* ── TOP NAV ── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.topnav-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 80px; gap: 1.5rem;
}
.nav-logo { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.nav-logo img { width: 52px; height: 64px; object-fit: contain; }
.nav-logo-text h1 {
  font-family: 'Merriweather', serif;
  font-size: 1.1rem; font-weight: 900;
  color: var(--primary); text-transform: uppercase; letter-spacing: .05em;
  line-height: 1.1;
}
.nav-logo-text p {
  font-size: .65rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .12em;
  display: flex; align-items: center; gap: .35rem; margin-top: .2rem;
}
.nav-logo-text p::before {
  content: ''; display: inline-block;
  width: 16px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.nav-links { display: flex; align-items: center; gap: .25rem; }
.nav-link {
  display: flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: var(--radius-sm);
  text-decoration: none; font-size: .85rem; font-weight: 500;
  color: var(--text-muted); transition: all .2s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--primary); background: rgba(139,0,0,.06); }
.nav-link.active {
  color: var(--primary); background: rgba(139,0,0,.08);
  font-weight: 600;
}
.nav-link-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); display: none;
}
.nav-link.active .nav-link-dot { display: block; }
.nav-badge {
  padding: .6rem 1.2rem;
  background: rgba(255,255,255,.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: right;
}
.nav-badge-label {
  display: block; font-size: .65rem; font-weight: 700;
  color: var(--primary); text-transform: uppercase;
  letter-spacing: .1em; opacity: .9;
}
.nav-badge-title {
  display: block; font-size: .82rem; font-weight: 700; color: var(--text);
}
.nav-underline {
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
}
/* User menu in nav */
.nav-user { display: flex; align-items: center; gap: .75rem; position: relative; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; cursor: pointer;
  flex-shrink: 0; border: 2px solid rgba(139,0,0,.2);
}
.nav-user-btn {
  display: flex; align-items: center; gap: .5rem;
  background: none; border: none; cursor: pointer;
  font-family: 'Inter', sans-serif; font-size: .85rem;
  color: var(--text); font-weight: 500; padding: .3rem .5rem;
  border-radius: var(--radius-sm); transition: background .2s;
}
.nav-user-btn:hover { background: rgba(0,0,0,.05); }
.user-dropdown {
  position: absolute; top: calc(100% + .5rem); right: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  min-width: 200px; padding: .5rem; display: none; z-index: 200;
}
.user-dropdown.show { display: block; }
.ud-info { padding: .75rem 1rem; border-bottom: 1px solid var(--border); margin-bottom: .5rem; }
.ud-info strong { display: block; font-size: .9rem; }
.ud-info small { color: var(--text-muted); font-size: .75rem; }
.ud-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 1rem; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text); font-size: .85rem;
  transition: background .15s;
}
.ud-item:hover { background: var(--bg); }
.ud-item.danger { color: var(--danger); }
.ud-item.danger:hover { background: rgba(220,38,38,.06); }

/* ── PAGE WRAPPER ── */
.page-wrap { max-width: 1280px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── HERO BANNER ── */
.hero-banner {
  background: linear-gradient(135deg, #6b0000 0%, #8b0000 60%, #a21313 100%);
  border-radius: var(--radius); padding: 2.5rem 3rem;
  color: #fff; margin-bottom: 2rem; position: relative; overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute; right: -40px; top: -40px;
  width: 280px; height: 280px; border-radius: 50%;
  background: url('https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Escudo_de_la_Universidad_Libre_de_Colombia.svg/1280px-Escudo_de_la_Universidad_Libre_de_Colombia.svg.png') center/contain no-repeat;
  opacity: .08;
}
.hero-tag {
  display: inline-block; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  background: rgba(255,255,255,.15); border-radius: 20px;
  padding: .3rem .9rem; margin-bottom: .9rem;
}
.hero-banner h2 {
  font-family: 'Merriweather', serif;
  font-size: 1.85rem; font-weight: 900; margin-bottom: .6rem;
}
.hero-banner p { opacity: .8; font-size: .92rem; max-width: 600px; }

/* ── CARDS ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
}
.card-header h3 {
  font-family: 'Merriweather', serif;
  font-size: 1rem; font-weight: 700; color: var(--text);
}
.card-body { padding: 1.5rem; }

/* ── STAT CARDS ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 1rem;
}
.stat-icon { font-size: 1.6rem; flex-shrink: 0; }
.stat-num {
  font-size: 1.8rem; font-weight: 800; line-height: 1;
  font-family: 'Merriweather', serif; color: var(--primary);
}
.stat-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-top: .2rem; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th {
  padding: .75rem 1rem; text-align: left;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); border-bottom: 2px solid var(--border);
  white-space: nowrap; background: #fafaf9;
}
.data-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: rgba(139,0,0,.03); }
.data-table .empty-row { text-align: center; color: var(--text-muted); padding: 2rem; }

/* ── BADGES ── */
.badge-estado { padding: .25rem .75rem; border-radius: 20px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-pendiente  { background: rgba(217,119,6,.1);  color: #92400e; }
.badge-aprobado   { background: rgba(22,163,74,.1);  color: #14532d; }
.badge-rechazado  { background: rgba(220,38,38,.1);  color: #7f1d1d; }
.badge-cancelado  { background: rgba(120,113,108,.1);color: #44403c; }
.badge-comprado   { background: rgba(37,99,235,.1);  color: #1e3a8a; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.2rem; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all .2s; text-decoration: none;
  font-family: 'Inter', sans-serif;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: rgba(139,0,0,.06); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-sm { padding: .4rem .85rem; font-size: .8rem; }
.btn-xs { padding: .2rem .5rem; font-size: .75rem; border-radius: 6px; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 1.2rem; }
.form-full { grid-column: span 2; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.form-group input,
.form-group select,
.form-group textarea {
  padding: .6rem .85rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: .9rem;
  font-family: 'Inter', sans-serif; color: var(--text);
  background: #fff; transition: border-color .2s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,0,0,.08);
}
.form-divider {
  grid-column: span 2; display: flex; align-items: center; gap: 1rem;
  color: var(--text-muted); font-size: .8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
}
.form-divider::before, .form-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.input-icon-wrap { position: relative; }
.input-icon-wrap input { width: 100%; }
.input-icon-wrap .ico { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .9rem; pointer-events: none; }
.input-icon-wrap input { padding-left: 2.4rem; }
.toggle-pass { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1rem; }

/* ── ALERTS ── */
.alert { padding: .85rem 1.2rem; border-radius: var(--radius-sm); font-size: .875rem; margin-bottom: 1rem; font-weight: 500; }
.alert-success { background: rgba(22,163,74,.08); color: #14532d; border-left: 3px solid var(--success); }
.alert-danger  { background: rgba(220,38,38,.08); color: #7f1d1d; border-left: 3px solid var(--danger); }
.alert-warning { background: rgba(217,119,6,.08);  color: #92400e; border-left: 3px solid var(--warning); }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
}

/* Panel visual izquierdo — foto de Cartagena con overlay carmesí */
.login-visual {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 3rem; text-align: center; overflow: hidden;
  background:
    linear-gradient(160deg, rgba(107,0,0,.88) 0%, rgba(139,0,0,.82) 60%, rgba(162,19,19,.75) 100%),
    url('../fondo-cartagena.jpg') center/cover no-repeat;
}
/* Círculo blanco que contiene el logo */
.login-logo-circle {
  width: 110px; height: 110px;
  background: #ffffff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.75rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.3), 0 0 0 3px rgba(255,255,255,.2);
  padding: 4px;
  overflow: hidden;
}
.login-logo-circle img {
  width: 102px; height: 102px;
  object-fit: contain;
  border-radius: 50%;
}

.login-visual-content { position: relative; color: #fff; z-index: 1; }
.login-visual-content h1 {
  font-family: 'Merriweather', serif;
  font-size: 2rem; font-weight: 900;
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: .5rem;
  text-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.login-visual-content h1 span { display: block; font-size: 1rem; font-weight: 400; opacity: .8; letter-spacing: .18em; margin-top: .3rem; }
.login-visual-content p { opacity: .8; font-size: .9rem; margin: 1.2rem 0 2rem; max-width: 300px; line-height: 1.6; }
.login-stats { display: flex; gap: 2.5rem; justify-content: center; }
.ls-item { text-align: center; }
.ls-num { display: block; font-size: 1.8rem; font-weight: 800; }
.ls-label { font-size: .68rem; opacity: .65; text-transform: uppercase; letter-spacing: .12em; }
.login-visual-line { width: 40px; height: 2px; background: var(--accent); margin: 2rem auto 0; border-radius: 2px; }

/* Panel del formulario derecho */
.login-form-wrap {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 3rem 2rem; background: var(--bg);
}
.login-box {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: var(--radius);
  padding: 2.5rem; box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo img { width: 64px; margin-bottom: .75rem; }
.login-logo h2 {
  font-family: 'Merriweather', serif;
  font-size: 1.1rem; font-weight: 900;
  color: var(--primary); text-transform: uppercase;
}
.login-logo p { font-size: .75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; margin-top: .2rem; }
.login-box h3 { font-family: 'Merriweather', serif; font-size: 1.25rem; font-weight: 700; color: var(--text); margin-bottom: .3rem; }
.login-box > p { color: var(--text-muted); font-size: .875rem; margin-bottom: 1.5rem; line-height: 1.5; }
.btn-login {
  width: 100%; padding: .85rem; border: none;
  background: var(--primary); color: #fff;
  border-radius: var(--radius-sm); font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: background .2s; font-family: 'Inter', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  letter-spacing: .03em;
}
.btn-login:hover { background: var(--primary-dark); }
.login-footer { text-align: center; margin-top: 1.5rem; font-size: .8rem; color: var(--text-muted); line-height: 1.6; }
.login-footer a { color: var(--primary); font-weight: 500; }
/* SVG icons en inputs */
.input-icon-wrap .ico { display: flex; align-items: center; }
@media (max-width: 768px) {
  .login-page { grid-template-columns: 1fr; }
  .login-visual { display: none; }
}

/* ── FLIGHT SEARCH ── */
.search-box {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.search-row { display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr auto; gap: .75rem; align-items: end; }
.airport-wrap { position: relative; }
.autocomplete-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  z-index: 50; max-height: 200px; overflow-y: auto; display: none;
}
.autocomplete-list li {
  padding: .65rem 1rem; cursor: pointer; font-size: .85rem;
  border-bottom: 1px solid var(--border); list-style: none;
  transition: background .15s;
}
.autocomplete-list li:last-child { border-bottom: none; }
.autocomplete-list li:hover { background: rgba(139,0,0,.05); color: var(--primary); }
.swap-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(139,0,0,.08); border: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: all .2s; align-self: end; margin-bottom: 2px;
  color: var(--primary);
}
.swap-btn:hover { background: var(--primary); color: #fff; }

/* ── FLIGHT RESULTS ── */
.flight-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: .75rem; transition: box-shadow .2s;
  box-shadow: var(--shadow);
}
.flight-card:hover { box-shadow: var(--shadow-md); }
.flight-route { display: flex; align-items: center; gap: 1rem; flex: 1; }
.airport-code { font-family: 'Merriweather', serif; font-size: 1.4rem; font-weight: 900; color: var(--text); }
.airport-name { font-size: .72rem; color: var(--text-muted); font-weight: 500; }
.route-line { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.route-duration { font-size: .75rem; color: var(--text-muted); font-weight: 600; }
.route-line-bar {
  width: 100%; height: 1px; background: var(--border);
  position: relative;
}
.route-line-bar::before, .route-line-bar::after {
  content: ''; position: absolute; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary);
}
.route-line-bar::before { left: 0; }
.route-line-bar::after  { right: 0; }
.route-stops { font-size: .72rem; color: var(--text-muted); }
.flight-price { text-align: right; }
.flight-price .price { font-size: 1.4rem; font-weight: 800; color: var(--primary); font-family: 'Merriweather', serif; }
.flight-price .airline { font-size: .78rem; color: var(--text-muted); }
.flight-actions { display: flex; gap: .5rem; align-items: center; }

/* ── PROFILE ── */
.profile-grid { display: grid; grid-template-columns: 300px 1fr; gap: 1.5rem; }
.profile-card-hero { text-align: center; padding: 2rem 1.5rem; }
.avatar-xl {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800; margin: 0 auto 1rem;
  font-family: 'Merriweather', serif; border: 3px solid rgba(139,0,0,.15);
}
.avatar-md { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar-sm { width: 34px; height: 34px; font-size: .85rem; }
.profile-hero-name { font-family: 'Merriweather', serif; font-size: 1.1rem; font-weight: 700; }
.profile-hero-role { color: var(--primary); font-weight: 600; font-size: .85rem; margin: .25rem 0; }
.profile-hero-dep  { color: var(--text-muted); font-size: .82rem; }
.profile-stats-mini { display: flex; justify-content: center; gap: 1.5rem; margin: 1.25rem 0; padding: 1rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.psm-num { display: block; font-size: 1.5rem; font-weight: 800; font-family: 'Merriweather', serif; color: var(--primary); }
.psm-label { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.profile-since { color: var(--text-muted); font-size: .78rem; margin-top: .75rem; }

/* ── MISC ── */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.user-row { display: flex; align-items: center; gap: .75rem; }
.route-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  background: rgba(139,0,0,.07); color: var(--primary);
  padding: .2rem .7rem; border-radius: 20px; font-size: .78rem; font-weight: 600;
}
.link-btn { background: none; border: none; color: var(--primary); font-size: .8rem; cursor: pointer; text-decoration: underline; }
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
  .search-row { grid-template-columns: 1fr 1fr; }
  .nav-badge { display: none; }
}
@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .search-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .topnav-inner { height: 68px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-full { grid-column: span 1; }
}
