/* ==========================================
   CATHAY PACIFIC ROBLOX - MASTER STYLESHEET
   Visual reskin: forest green + pale sage, pill buttons,
   light surfaces, Figtree type. Class names and variable
   names are unchanged so scripts keep working.
   ========================================== */

/* Light theme (default) */
:root {
  --primary-teal: #1d6b5f;      /* text accents, links, icons */
  --teal-hover: #14493f;
  --btn-bg: #2d3f38;            /* primary buttons (forest) */
  --btn-bg-hover: #1e2c27;
  --btn-text: #ffffff;
  --bg-main: #ffffff;
  --panel: #f2f4f2;             /* pale sage surfaces */
  --card-bg: #ffffff;
  --card-border: #dde3df;
  --line-strong: #2d3f38;
  --text-main: #1f2a26;
  --text-muted: #5d6b65;
  --nav-bg: #ffffff;
  --hero-overlay: #f2f4f2;
  --white: #ffffff;
  --red: #c0392b;
  --accent-gold: #8a6420;
  --roblox-btn: #1f2a26;
  --discord-btn: #5865F2;
  --font: 'Figtree', 'Albert Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

/* Dark theme */
[data-theme="dark"] {
  --primary-teal: #7cc4b3;
  --teal-hover: #a3d9cc;
  --btn-bg: #7cc4b3;
  --btn-bg-hover: #a3d9cc;
  --btn-text: #0f1a16;
  --bg-main: #101714;
  --panel: #18221e;
  --card-bg: #151e1a;
  --card-border: #2a3832;
  --line-strong: #cfd9d4;
  --text-main: #edf2ef;
  --text-muted: #9aaaa2;
  --nav-bg: #101714;
  --hero-overlay: #18221e;
  --accent-gold: #d9b26a;
  --roblox-btn: #3a4440;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--primary-teal); outline-offset: 3px; }

/* Utility containers */
.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.section-padding { padding: 72px 20px; }
.text-teal { color: var(--primary-teal); }
.text-center { text-align: center; }

/* Logo light/dark toggle rules */
.logo-dark { display: none !important; }
.logo-light { display: inline-block !important; }
[data-theme="dark"] .logo-light { display: none !important; }
[data-theme="dark"] .logo-dark { display: inline-block !important; }

/* Navbar */
.navbar {
  background: var(--nav-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--card-border);
}

.nav-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.brand-logo { display: flex; align-items: center; text-decoration: none; }
.nav-brand-img { height: 40px; width: auto; object-fit: contain; }

.nav-links { display: flex; list-style: none; gap: 36px; margin-right: auto; margin-left: 32px; }

.nav-link {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.05rem;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-link:hover { color: var(--primary-teal); }
.nav-link.active { color: var(--text-main); font-weight: 600; border-bottom-color: var(--primary-teal); }

.nav-actions { display: flex; align-items: center; gap: 12px; }

/* Buttons: pills */
.btn {
  padding: 11px 24px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-icon { padding: 0; width: 42px; height: 42px; justify-content: center; }
.btn-primary { background-color: var(--btn-bg); color: var(--btn-text); }
.btn-primary:hover { background-color: var(--btn-bg-hover); }
.btn-secondary { background-color: transparent; color: var(--text-main); border-color: var(--line-strong); }
.btn-secondary:hover { background-color: var(--panel); }
.btn-outline { background: transparent; color: var(--text-main); border-color: var(--line-strong); }
.btn-outline:hover { background: var(--panel); }
.btn-roblox { background-color: var(--roblox-btn); color: #ffffff; justify-content: center; }
.btn-roblox:hover { opacity: 0.88; }
.btn-discord { background-color: var(--discord-btn); color: #ffffff; justify-content: center; }
.btn-discord:hover { background-color: #4752C4; }
.btn-danger { background-color: var(--red); color: var(--white); }
.btn-danger:hover { opacity: 0.88; }
.btn-full { width: 100%; justify-content: center; }
.btn-lg { padding: 15px 32px; font-size: 1.05rem; }
.btn-sm { padding: 8px 18px; font-size: 0.875rem; }

/* User profile dropdown widget */
.user-menu-wrapper { position: relative; display: inline-block; }
.user-profile-btn { display: flex; align-items: center; gap: 8px; padding: 8px 18px; }

.user-headshot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--card-border);
}

.user-profile-dropdown {
  position: absolute;
  top: 115%;
  right: 0;
  width: 270px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(20, 35, 30, 0.14);
  padding: 18px;
  z-index: 1000;
}
.user-profile-dropdown.hidden { display: none; }

.dropdown-header { display: flex; flex-direction: column; gap: 6px; }

.membership-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 999px;
  width: fit-content;
}

/* Membership tiers (flat colours) */
.tier-green { background: #3d8b6e; color: #fff; }
.tier-silver { background: #b4beb9; color: #1f2a26; }
.tier-gold { background: #b3822a; color: #fff; }
.tier-diamond { background: #2f7f93; color: #fff; }
.tier-diamond-exec { background: #5b4b8a; color: #fff; }

.dropdown-stats { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-size: 0.92rem; }
.stat-item { display: flex; align-items: center; gap: 6px; }

/* Theme-aware miles icon rules */
.miles-light { display: inline-block !important; width: 16px; height: 16px; vertical-align: middle; }
.miles-dark { display: none !important; width: 16px; height: 16px; vertical-align: middle; }
[data-theme="dark"] .miles-light { display: none !important; }
[data-theme="dark"] .miles-dark { display: inline-block !important; }

.dropdown-link-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 9px 0;
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dropdown-link-btn:hover { color: var(--primary-teal); }
.dropdown-link-btn.logout { color: var(--red); }

hr { border: none; border-top: 1px solid var(--card-border); margin: 10px 0; }

/* Inventory */
.inventory-list-container {
  max-height: 350px;
  overflow-y: auto;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inventory-card {
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.inv-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.inv-code { font-size: 0.92rem; margin-bottom: 4px; }
.inv-code code {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  background: var(--card-bg);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--primary-teal);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.inv-meta { font-size: 0.8rem; color: var(--text-muted); }

.status-badge { font-size: 0.78rem; padding: 2px 10px; border-radius: 999px; font-weight: 600; }
.status-badge.available { background: #3d8b6e; color: #fff; }
.status-badge.redeemed { background: #7a8781; color: #fff; }
.status-badge.expired { background: #c0392b; color: #fff; }

.code-box {
  background: var(--panel);
  padding: 18px;
  text-align: center;
  font-size: 1.5rem;
  border-radius: var(--radius-md);
  color: var(--primary-teal);
  margin: 18px 0;
  font-weight: 600;
}
.code-box code {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
}

/* HERO: pale panel on the left, photo panel on the right */
.hero {
  position: relative;
  padding: 104px max(20px, calc((100% - 1120px) / 2));
  background: var(--hero-overlay);
  text-align: left;
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 44%;
  background: url('images/hero-bg.jpg') no-repeat center center / cover;
  border-bottom-left-radius: 72px;
}

.hero-content { position: relative; z-index: 2; max-width: 50%; }

.hero h1 { font-size: 3rem; font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; margin-bottom: 20px; }
.hero h1 .text-teal { color: inherit; }
.hero p { color: var(--text-main); max-width: 520px; margin: 0 0 36px; font-size: 1.15rem; line-height: 1.6; }
.hero-buttons { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 12px; }

/* Cards and grids */
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 20px; }
.about-card { background: var(--panel); padding: 32px; border-radius: var(--radius-md); }
.about-card h3 { font-size: 1.3rem; font-weight: 600; margin-bottom: 10px; }
.about-card p { color: var(--text-muted); }
.card-icon { color: var(--primary-teal); font-size: 1.6rem; margin-bottom: 18px; line-height: 1; }

.compact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 28px; }
.compact-grid.two-col { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.compact-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.compact-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.compact-icon { font-size: 1.3rem; }
.card-roblox-icon { height: 22px; width: auto; object-fit: contain; }

.compact-card h4 { font-size: 1.1rem; font-weight: 600; }
.compact-card p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.55; flex: 1; }

.section-header { margin-bottom: 32px; }
.sub-title {
  display: inline-block;
  color: var(--primary-teal);
  font-size: 1rem;
  font-weight: 500;
  text-transform: lowercase;
  margin-bottom: 4px;
}
.sub-title::first-letter { text-transform: uppercase; }
.section-header h2 { font-size: 2.2rem; font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; text-transform: lowercase; }
.section-header h2::first-letter { text-transform: uppercase; }
.section-header p { color: var(--text-muted); margin-top: 8px; font-size: 1.05rem; }

/* Flights */
.flights-list { display: flex; flex-direction: column; gap: 14px; }
.flight-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr;
  align-items: center;
  gap: 24px;
}
.flight-main h3 { font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.flight-route { color: var(--text-muted); font-size: 0.95rem; margin: 4px 0 14px; }
.flight-meta label { display: block; font-size: 0.85rem; color: var(--text-muted); }
.flight-meta span { font-weight: 500; font-size: 1.05rem; }
.flight-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.flight-code { font-weight: 600; font-size: 1.3rem; }
.flight-status { font-size: 0.85rem; color: var(--text-muted); }

/* Blog */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 28px; }
.news-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-md); overflow: hidden; }
.news-img { width: 100%; height: 210px; object-fit: cover; display: block; }
.news-body { padding: 24px; }
.news-date { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.news-body h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; margin-bottom: 10px; }
.news-body p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 18px; }

/* Careers */
.careers-list { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--card-border); }
.career-card {
  background: transparent;
  border-bottom: 1px solid var(--card-border);
  padding: 24px 4px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.career-icon { color: var(--primary-teal); font-size: 1.3rem; width: 32px; text-align: center; }
.career-info { flex: 1; }
.career-info h4 { font-size: 1.2rem; font-weight: 600; }
.career-info p { color: var(--text-muted); font-size: 0.95rem; }

/* Store */
.store-user-banner {
  background: var(--panel);
  border-radius: var(--radius-md);
  padding: 22px 28px;
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.store-user-banner h3 { font-weight: 600; font-size: 1.2rem; }
.store-user-banner p { color: var(--text-muted); }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 24px; }
.product-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px 16px 20px;
  display: flex;
  flex-direction: column;
}
.product-img { width: 100%; height: 170px; object-fit: cover; border-radius: 10px; margin-bottom: 16px; }
.product-badge {
  align-self: flex-start;
  background: var(--panel);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.product-card h4 { font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; }
.product-card p { color: var(--text-muted); font-size: 0.92rem; flex: 1; margin-bottom: 18px; }
.product-footer { display: flex; justify-content: space-between; align-items: center; }
.miles-price { font-weight: 600; color: var(--primary-teal); font-size: 1.1rem; }

/* Admin dashboard */
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h2 { font-weight: 500; }
.admin-tabs { display: flex; gap: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--card-border); flex-wrap: wrap; }
.admin-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 12px 2px;
  margin-bottom: -1px;
  cursor: pointer;
  font-weight: 500;
  font-size: 1rem;
}
.admin-tab-btn:hover { color: var(--text-main); }
.admin-tab-btn.active { color: var(--text-main); border-bottom-color: var(--primary-teal); font-weight: 600; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.admin-card { background: var(--panel); border-radius: var(--radius-md); padding: 28px; }
.admin-card h3 { margin-bottom: 18px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.9rem; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea,
.form-control {
  width: 100%;
  padding: 11px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.95rem;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .form-control:focus {
  outline: none;
  border-color: var(--primary-teal);
  box-shadow: 0 0 0 3px rgba(29, 107, 95, 0.18);
}
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--card-border); }

/* Modals */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 28, 24, 0.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--card-bg);
  padding: 36px 32px 32px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  position: relative;
}
.modal-content h3 { font-weight: 600; font-size: 1.3rem; }
.modal-close { position: absolute; top: 16px; right: 22px; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--text-muted); }
.modal-close:hover { color: var(--text-main); }
.modal-icon { font-size: 2rem; color: var(--primary-teal); margin-bottom: 12px; }
.roblox-modal { text-align: center; }
.roblox-header { margin-bottom: 20px; }
.modal-roblox-img { height: 48px; width: auto; margin-bottom: 10px; }

/* Affiliates modal */
.modal-content.modal-lg { max-width: 600px; max-height: 85vh; display: flex; flex-direction: column; }

.modal-header-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.2rem;
  color: var(--primary-teal);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--card-border);
}
.modal-header-badge h3 { color: var(--text-main); }

.affiliates-scroll-container { overflow-y: auto; padding-right: 8px; flex: 1; }
.affiliates-scroll-container::-webkit-scrollbar { width: 6px; }
.affiliates-scroll-container::-webkit-scrollbar-track { background: transparent; }
.affiliates-scroll-container::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }

.affiliate-section-title {
  color: var(--text-main);
  font-weight: 600;
  font-size: 1rem;
  text-transform: lowercase;
  padding: 0 0 8px;
  margin-bottom: 4px;
  border-bottom: 2px solid var(--primary-teal);
}
.affiliate-section-title::first-letter { text-transform: uppercase; }

.affiliate-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--card-border);
}
.affiliate-name { font-weight: 500; font-size: 0.98rem; }

.tab-page { display: none; }
.tab-page.active { display: block; }

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: 13px 28px;
  border-radius: 999px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(20, 35, 30, 0.22);
  z-index: 300;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translate(-50%, 16px); }

/* Footer */
.footer { margin-top: auto; background: var(--panel); padding: 36px 0; }
.footer-content { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; color: var(--text-muted); font-size: 0.9rem; }
.footer-left { display: flex; align-items: center; gap: 20px; }
.footer-logo { height: 30px; width: auto; object-fit: contain; }

.admin-login-link { background: transparent; border: none; color: var(--text-muted); font-size: 0.9rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.admin-login-link:hover { color: var(--text-main); }
.footer-right { display: flex; align-items: center; gap: 24px; }

/* Terms of service */
.legal-card { max-width: 860px; }
.legal-card h3 { font-size: 1.15rem; font-weight: 600; margin: 28px 0 8px; }
.legal-card h3:first-child { margin-top: 0; }
.legal-card p { color: var(--text-muted); font-size: 1rem; line-height: 1.7; }
.legal-card a { color: var(--primary-teal); text-decoration: underline; text-underline-offset: 3px; }

/* Lists inside legal pages (privacy policy) */
.legal-card ul { margin: 8px 0 12px 22px; color: var(--text-muted); line-height: 1.7; }
.legal-card li { margin-bottom: 6px; padding-left: 4px; }
.legal-card li strong { color: var(--text-main); font-weight: 600; }

.empty-msg { color: var(--text-muted); }

.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }
.mb-5 { margin-bottom: 3rem; }

/* Responsive */
@media (max-width: 900px) {
  .hero { padding: 0 20px 56px; }
  .hero-overlay {
    position: relative;
    width: auto;
    height: 230px;
    margin: 0 -20px 36px;
    border-bottom-left-radius: 48px;
  }
  .hero-content { max-width: 100%; }
  .hero h1 { font-size: 2.3rem; }
  .flight-card { grid-template-columns: 1fr 1fr; }
  .flight-main { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .nav-container { flex-wrap: wrap; gap: 12px; }
  .nav-links { order: 3; width: 100%; margin: 0; gap: 22px; overflow-x: auto; padding-bottom: 2px; }
  .nav-link { white-space: nowrap; font-size: 1rem; }
  .nav-actions { margin-left: auto; }
  .section-padding { padding: 48px 20px; }
  .section-header h2 { font-size: 1.8rem; }
  .compact-grid.two-col { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr; }
  .career-card { flex-wrap: wrap; }
  .store-user-banner { flex-direction: column; align-items: flex-start; }
  .footer-content, .footer-left { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
