:root {
  --rose: #DB2777;
  --rose-dark: #BE185D;
  --rose-light: #F9A8D4;
  --rose-bg: #FDF2F8;
  --white: #FFFFFF;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-400: #94A3B8;
  --gray-600: #475569;
  --gray-800: #1E293B;
  --red: #EF4444;
  --red-bg: #FEF2F2;
  --amber: #F59E0B;
  --amber-bg: #FFFBEB;
  --green: #10B981;
  --green-bg: #ECFDF5;
  --yellow: #FDE047;
  --yellow-bg: #FEF9C3;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.12);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: #FFF5F7;
  color: var(--gray-800);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 1300px; margin: 0 auto; padding: 16px 12px 40px; }

/* HEADER */
.header {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-200);
}

.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.header-left { display: flex; align-items: center; gap: 10px; }

.home-btn {
  width: 36px; height: 36px;
  background: var(--rose-bg);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--rose);
  font-size: 16px;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid rgba(219,39,119,0.2);
}

.home-btn:hover {
  background: var(--rose);
  color: white;
}

.logo {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--rose-light), var(--rose));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px;
  box-shadow: 0 4px 14px rgba(249,168,212,0.4);
}

.header-info h1 { font-size: 16px; font-weight: 800; color: var(--gray-800); }
.header-sub { font-size: 10px; color: var(--gray-400); font-weight: 500; }

.iata-badge {
  background: linear-gradient(135deg, var(--rose-light), var(--rose));
  color: white; font-weight: 900; font-size: 18px;
  padding: 6px 16px; border-radius: 30px; letter-spacing: 3px;
  box-shadow: 0 4px 18px rgba(249,168,212,0.4);
}

.header-right { display: flex; align-items: center; gap: 12px; }

.refund-btn {
  background: var(--rose-bg);
  color: var(--rose);
  border: 1px solid rgba(219,39,119,0.2);
  padding: 8px 14px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}

.refund-btn:hover {
  background: var(--rose);
  color: white;
}

.live-clock {
  font-size: 22px; font-weight: 700; color: var(--gray-800);
  display: flex; align-items: center; gap: 8px;
}

.live-dot {
  width: 7px; height: 7px; background: var(--green);
  border-radius: 50%; animation: pulse 2s infinite;
}

@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.4;transform:scale(1.6)} }

.hide-mobile { }

/* MAIN TABS */
.main-tabs { display: flex; gap: 0; margin-bottom: 16px; }

.main-tab {
  flex: 1; background: var(--white); border: 2px solid var(--gray-200);
  padding: 14px 20px; font-weight: 700; font-size: 14px;
  cursor: pointer; transition: all 0.2s;
  font-family: 'Inter', sans-serif; color: var(--gray-600);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

.main-tab:first-child { border-radius: 12px 0 0 12px; }
.main-tab:last-child { border-radius: 0 12px 12px 0; }
.main-tab.active { background: var(--rose); color: white; border-color: var(--rose); }

/* ADMIN TOGGLE */
.admin-toggle-btn {
  width: 100%;
  background: var(--rose);
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 4px 14px rgba(249,168,212,0.4);
}

.admin-toggle-btn:hover {
  background: var(--rose-dark);
  transform: translateY(-2px);
}

.admin-toggle-btn i { font-size: 16px; }

/* ADMIN */
.admin {
  background: var(--white); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-md); border: 1px solid var(--gray-200);
}

.admin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.admin-top h2 { font-size: 16px; font-weight: 700; }

.btn-primary {
  background: var(--rose); color: white; border: none;
  padding: 10px 18px; border-radius: 25px; font-weight: 600; font-size: 13px;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: all 0.2s; font-family: 'Inter', sans-serif;
  box-shadow: 0 2px 10px rgba(219,39,119,0.25);
}

.btn-primary:hover { background: var(--rose-dark); transform: translateY(-1px); }

.form-card {
  background: var(--rose-bg); border: 1px solid rgba(219,39,119,0.15);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
}

.form-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--rose-dark); }

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.field label {
  display: block; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-400); margin-bottom: 4px;
}

.field input, .field select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--gray-200);
  border-radius: 8px; font-size: 13px; font-family: 'Inter', sans-serif;
  transition: all 0.2s; background: white;
}

.field input:focus, .field select:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px rgba(219,39,119,0.08); }

.form-actions { display: flex; gap: 8px; margin-top: 14px; }

.btn-save { background: var(--rose); color: white; border: none; padding: 8px 20px; border-radius: 25px; font-weight: 600; cursor: pointer; font-family: 'Inter', sans-serif; font-size: 13px; }
.btn-save:hover { background: var(--rose-dark); }
.btn-cancel { background: transparent; border: 1px solid var(--gray-200); padding: 8px 20px; border-radius: 25px; font-weight: 600; cursor: pointer; color: var(--gray-600); font-family: 'Inter', sans-serif; font-size: 13px; }

#adminFlightsListDep, #adminFlightsListArr { display: flex; flex-direction: column; gap: 6px; }

.admin-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--gray-50);
  border-radius: 10px; border: 1px solid var(--gray-200);
  transition: all 0.2s; flex-wrap: wrap; gap: 8px;
}

.admin-row:hover { background: var(--rose-bg); border-color: rgba(219,39,119,0.25); }
.admin-row-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-row-number { font-weight: 800; color: var(--rose); font-size: 14px; }
.admin-row-route { color: var(--gray-600); font-size: 13px; }
.admin-row-actions { display: flex; gap: 4px; }

.btn-icon {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--gray-200); background: white;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--gray-600); transition: all 0.2s; font-size: 13px;
}

.btn-icon:hover { border-color: var(--rose); color: var(--rose); background: var(--rose-bg); }
.btn-icon.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }

/* TABS */
.tabs-bar { display: flex; gap: 0; margin-bottom: 16px; align-items: center; }

.tab-btn {
  background: var(--white); border: 2px solid var(--gray-200);
  padding: 10px 20px; font-weight: 700; font-size: 12px;
  cursor: pointer; transition: all 0.2s;
  font-family: 'Inter', sans-serif; color: var(--gray-600);
}

.tab-btn:first-child { border-radius: 10px 0 0 10px; }
.tab-btn:last-child { border-radius: 0 10px 10px 0; }
.tab-btn.active { background: var(--rose); color: white; border-color: var(--rose); }

.departed-toggle { margin-left: auto; }

.btn-departed {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  padding: 10px 16px; border-radius: 10px; cursor: pointer;
  font-weight: 600; font-size: 12px; color: var(--gray-600);
  transition: all 0.2s; font-family: 'Inter', sans-serif;
  display: flex; align-items: center; gap: 5px;
}

.btn-departed:hover { background: var(--rose-bg); border-color: var(--rose-light); color: var(--rose); }
.btn-departed.active { background: var(--rose); color: white; border-color: var(--rose); }

/* BOARD */
.board {
  background: var(--white); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-lg); border: 1px solid var(--gray-200);
}

.board-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--rose-light), var(--rose));
  color: white;
}

.board-top-left h2 { font-size: 15px; font-weight: 800; letter-spacing: 1px; }
.update-text { font-size: 11px; opacity: 0.9; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; min-width: 600px; }
thead tr { background: var(--gray-50); }

th {
  padding: 12px 10px; text-align: left; font-size: 9px;
  font-weight: 800; letter-spacing: 1px; color: var(--gray-400);
  text-transform: uppercase; border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

tbody tr { transition: all 0.2s; cursor: pointer; border-bottom: 1px solid var(--gray-100); }
tbody tr:hover { background: var(--rose-bg); }
td { padding: 14px 10px; font-size: 13px; font-weight: 500; color: var(--gray-800); white-space: nowrap; }

.time-cell { font-weight: 600; }
.time-old { text-decoration: line-through; color: var(--gray-400); font-size: 11px; font-weight: 400; }
.time-new { color: var(--amber); font-weight: 700; }

.dest-cell { display: flex; align-items: center; gap: 6px; }
.dest-name { font-weight: 600; }
.dest-iata { background: var(--rose-bg); color: var(--rose); padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 11px; }
.flight-num { font-weight: 700; }

.airline-cell { display: flex; align-items: center; gap: 6px; }
.airline-avatar {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--rose-light), var(--rose));
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: white; font-size: 10px; font-weight: 700;
  flex-shrink: 0;
}

.gate-cell {
  font-weight: 700;
  color: #000;
  background: var(--yellow-bg);
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
  border: 1px solid var(--yellow);
}

/* STATUS */
.status-tag {
  display: inline-block; padding: 5px 12px; border-radius: 15px;
  font-size: 10px; font-weight: 700; white-space: pre-line;
  text-align: center; line-height: 1.4;
}

.tag-ok { background: var(--green-bg); color: var(--green); }
.tag-checkin { background: var(--rose-bg); color: var(--rose); }
.tag-checkin-end { background: var(--amber-bg); color: var(--amber); }
.tag-boarding { background: var(--red-bg); color: var(--red); animation: blinker 1.2s infinite; }
.tag-boarding-end { background: var(--rose-bg); color: var(--rose-dark); }
.tag-delay { background: var(--amber-bg); color: var(--amber); }
.tag-cancel { background: var(--red-bg); color: var(--red); font-weight: 800; }
.tag-departed { background: var(--gray-100); color: var(--gray-600); }
.tag-early { background: #E0F2FE; color: #0284C7; }
.tag-suspended { background: #F1F5F9; color: #64748B; }
.tag-diverted { background: #FEF3C7; color: #B45309; }

@keyframes blinker { 0%,100%{opacity:1} 50%{opacity:0.5} }

.empty td { padding: 40px 20px !important; }
.empty-msg { text-align: center; color: var(--gray-400); }
.empty-msg i { font-size: 32px; margin-bottom: 6px; opacity: 0.3; }
.empty-msg p { font-size: 14px; font-weight: 500; }

/* MODAL */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; z-index: 1000;
  padding: 16px;
}

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

.modal {
  background: white; border-radius: 20px; width: 100%;
  max-width: 600px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 40px 100px rgba(0,0,0,0.3);
  animation: modalIn 0.35s ease;
}

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

.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
  position: sticky; top:0; background:white; z-index:2;
  border-radius:20px 20px 0 0;
}

.modal-head h2 { font-size: 16px; font-weight: 800; }
.modal-head button {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--gray-200); background: white;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--gray-600); transition: all 0.2s;
}
.modal-head button:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }

.modal-content { padding: 20px; }

.modal-flight-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--gray-200);
  flex-wrap: wrap; gap: 10px;
}
.modal-flight-num { font-size: 24px; font-weight: 900; color: var(--rose); }
.modal-flight-dest { font-size: 16px; font-weight: 700; margin-top: 2px; }
.modal-flight-airline { font-size: 13px; color: var(--gray-600); margin-top: 4px; }

.modal-delay-banner {
  background: var(--amber-bg); border: 1px solid rgba(245,158,11,0.3);
  border-radius: 12px; padding: 12px 16px; display: flex;
  align-items: center; gap: 10px; margin-bottom: 16px;
  font-size: 15px; font-weight: 700; color: var(--amber);
}

.modal-fs-destination { margin-bottom: 6px; display: flex; align-items: baseline; gap: 10px; }
.modal-fs-destination h2 { font-size: 28px; font-weight: 900; color: var(--gray-800); }
.modal-fs-iata {
  background: var(--rose-bg); color: var(--rose);
  padding: 3px 10px; border-radius: 8px; font-weight: 800;
  font-size: 16px; letter-spacing: 2px;
}
.modal-fs-info-row { color: var(--gray-400); font-size: 13px; margin-bottom: 16px; }

.modal-fs-table {
  background: var(--gray-50); border-radius: 12px; overflow: hidden;
  margin-bottom: 20px; border: 1px solid var(--gray-200);
}

.modal-fs-table-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr 0.8fr 0.8fr;
  padding: 10px 14px; font-size: 12px;
}

.modal-fs-table-row.header {
  background: var(--gray-100); font-weight: 700; font-size: 9px;
  text-transform: uppercase; letter-spacing: 1px; color: var(--gray-400);
}

.modal-fs-table-row:not(.header) { font-size: 14px; color: var(--gray-800); }

.modal-fs-timeline { margin-bottom: 20px; }
.modal-fs-timeline h3 {
  font-size: 12px; font-weight: 700; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px;
}

.timeline-items { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 10px; padding: 8px 0; position: relative; }
.timeline-item::before {
  content: ''; position: absolute; left: 4px; top: 28px; bottom: -8px;
  width: 2px; background: var(--gray-200);
}
.timeline-item:last-child::before { display: none; }

.timeline-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gray-200); margin-top: 3px;
  flex-shrink: 0; z-index: 1; border: 2px solid white;
}

.timeline-item.done .timeline-dot { background: var(--rose); }
.timeline-item.active .timeline-dot { background: var(--green); animation: pulse 2s infinite; }

.timeline-content { flex: 1; }
.timeline-time { font-size: 16px; font-weight: 700; color: var(--gray-800); }
.timeline-label { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.modal-fs-status { text-align: center; margin: 16px 0; }

.modal-fs-extra {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 16px; border-top: 1px solid var(--gray-200);
}
.modal-fs-extra-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.extra-label { font-size: 12px; color: var(--gray-400); }
.extra-value { font-size: 13px; font-weight: 600; color: var(--gray-800); }

@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .tabs-bar { flex-wrap: wrap; gap: 8px; }
  .departed-toggle { margin-left: 0; width: 100%; }
  .btn-departed { width: 100%; justify-content: center; }
  .admin-top { flex-direction: column; align-items: flex-start; }
  .btn-primary { width: 100%; justify-content: center; }
  .hide-mobile { display: none; }
}

@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
  .main-tab { font-size: 12px; padding: 12px 14px; }
  .admin-toggle-btn { font-size: 13px; padding: 12px 16px; }
}
