/* ============================================================
   LOUIS WORKSHOP — SHARED STYLESHEET
   Design System: Trust & Authority
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700;900&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --navy:        #1B2D4F;
  --navy-dark:   #111E33;
  --navy-light:  #2A3F6B;
  --gold:        #F5A623;
  --gold-dark:   #D4901A;
  --gold-light:  #FFF3D6;
  --bg:          #FFF8EF;
  --white:       #FFFFFF;
  --text:        #2C3E50;
  --text-muted:  #6B7A99;
  --border:      #E8DDD0;
  --success:     #27AE60;
  --error:       #E74C3C;

  --font-heading: 'Noto Sans TC', sans-serif;
  --font-body:    'Noto Sans TC', sans-serif;

  --max-width: 1160px;
  --px:        1.25rem;

  --shadow-sm: 0 2px 8px rgba(27,45,79,0.08);
  --shadow-md: 0 4px 20px rgba(27,45,79,0.12);
  --shadow-lg: 0 8px 40px rgba(27,45,79,0.16);

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;

  --ease: 0.22s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: inherit; text-decoration: none; }
ul  { list-style: none; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  color: var(--navy);
  line-height: 1.3;
}

h1 { font-size: clamp(1.875rem, 5vw, 3.25rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.375rem); font-weight: 700; }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.75rem); font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--px);
}

.section { padding: 5rem 0; }
.section--light { background: var(--bg); }
.section--white { background: var(--white); }
.section--navy  { background: var(--navy); }

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.label {
  display: inline-block;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.875rem;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--ease);
  border: 2px solid transparent;
  line-height: 1;
  white-space: nowrap;
}

.btn-gold {
  background: var(--gold);
  color: var(--navy);
  box-shadow: 0 4px 16px rgba(245,166,35,0.4);
}
.btn-gold:hover {
  background: var(--gold-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(245,166,35,0.5);
}
.btn-gold:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--white);
  border-color: rgba(255,255,255,0.55);
}
.btn-outline:hover {
  background: rgba(255,255,255,0.12);
}

.btn-navy {
  background: var(--navy);
  color: var(--white);
}
.btn-navy:hover {
  background: var(--navy-light);
  transform: translateY(-2px);
}

.btn-lg  { padding: 1.1rem 2.25rem; font-size: 1.0625rem; }
.btn-sm  { padding: 0.55rem 1.1rem; font-size: 0.875rem; }
.btn-full { width: 100%; }

/* ============================================================
   IMAGE PLACEHOLDER SYSTEM
   ============================================================ */

/* Full-width section image block */
.section-img {
  position: relative;
  width: 100%;
  background: #EDE6DC;
}
.section-img img {
  width: 100%;
  display: block;
  object-fit: cover;
}
.section-img .ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 320px;
  padding: 3rem 2rem;
  border-top: 2px dashed var(--border);
  border-bottom: 2px dashed var(--border);
  color: var(--text-muted);
  text-align: center;
  background: #F0EAE0;
}
.section-img .ph-icon { font-size: 2.5rem; opacity: 0.45; }
.section-img .ph-label { font-size: 0.9375rem; font-weight: 600; }
.section-img .ph-hint  { font-size: 0.8rem; opacity: 0.7; }

/* Inline image block (inside container) */
.img-block {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #EDE6DC;
}
.img-block img { width: 100%; display: block; }
.img-block .ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 220px;
  padding: 2.5rem 2rem;
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  text-align: center;
  background: #F0EAE0;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  background: var(--navy);
  padding: 1.125rem 0;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 20px rgba(0,0,0,0.25);
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-brand {
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.navbar-cta {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  background: var(--navy);
  min-height: 88vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}
.hero-bg .ph {
  width: 100%;
  height: 100%;
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: rgba(255,255,255,0.25);
  font-size: 0.8rem;
  border: none;
  border-radius: 0;
  background: transparent;
}
.hero-bg .ph-icon { font-size: 3rem; opacity: 0.4; }

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(27,45,79,0.2) 0%, rgba(27,45,79,0.75) 100%);
  z-index: 1;
}

.hero-body {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 7rem 0 6rem;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.95);
  border: none;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.375rem 1.1rem;
  border-radius: 100px;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.hero-title {
  color: var(--white);
  text-shadow: 0 2px 24px rgba(0,0,0,0.3);
  margin-bottom: 1.25rem;
}

.hero-subtitle {
  color: rgba(255,255,255,0.82);
  font-size: clamp(1rem, 2vw, 1.2rem);
  max-width: 580px;
  margin: 0 auto 2.5rem;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.875rem;
}

.hero-note {
  margin-top: 1.5rem;
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem;
}

@media (min-width: 480px) {
  .hero-actions { flex-direction: row; justify-content: center; }
}

/* ============================================================
   TICKET CARD
   ============================================================ */
.ticket-wrap {
  max-width: 460px;
  margin: 0 auto;
}

.ticket-card {
  background: var(--white);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--gold);
}

.ticket-head {
  background: var(--navy);
  padding: 2rem 2rem 1.75rem;
  text-align: center;
}

.ticket-badge {
  display: inline-block;
  background: var(--gold);
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.22rem 0.75rem;
  border-radius: 100px;
  margin-bottom: 0.75rem;
}

.ticket-head h3 {
  color: var(--white);
  font-size: 1.375rem;
}

.ticket-body {
  padding: 2rem 2rem 2.25rem;
  text-align: center;
}

.price-original {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: line-through;
  margin-bottom: 0.2rem;
}

.price-current {
  color: var(--gold-dark);
  font-family: var(--font-heading);
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.price-saving {
  display: inline-block;
  background: var(--gold-light);
  color: var(--gold-dark);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.22rem 0.75rem;
  border-radius: 100px;
  margin-bottom: 1.75rem;
}

.ticket-features {
  text-align: left;
  margin-bottom: 1.75rem;
}

.ticket-features li {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.525rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.6;
}
.ticket-features li:last-child { border-bottom: none; }

.tick {
  color: var(--gold-dark);
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

/* ============================================================
   FLOATING CTA
   ============================================================ */

/* Desktop: vertical pill on right edge */
.floating-cta {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 300;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  background: var(--gold);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 1.25rem 0.7rem;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  box-shadow: -4px 0 20px rgba(245,166,35,0.35);
  cursor: pointer;
  transition: all var(--ease);
  text-decoration: none;
}
.floating-cta:hover {
  background: var(--gold-dark);
  padding-right: 1rem;
  box-shadow: -6px 0 28px rgba(245,166,35,0.45);
}

/* Mobile: bottom sticky bar (with iOS safe area support) */
@media (max-width: 768px) {
  .floating-cta {
    writing-mode: horizontal-tb;
    right: 0 !important;
    left: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    transform: none !important;
    border-radius: 0;
    padding: 1rem 1.5rem;
    /* Push content above iOS home indicator */
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    text-align: center;
    box-shadow: 0 -4px 20px rgba(245,166,35,0.3);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    z-index: 9999 !important;
  }
  .floating-cta:hover { padding-right: 1.5rem; }
}

/* ============================================================
   FORMS
   ============================================================ */
.form-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  margin: 0 auto;
}

@media (min-width: 560px) {
  .form-card { padding: 3rem 2.5rem; }
}

.form-group { margin-bottom: 1.5rem; }

.form-label {
  display: block;
  font-weight: 600;
  color: var(--navy);
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
}
.form-label .req { color: var(--error); margin-left: 3px; }

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.15);
}
.form-input.is-error { border-color: var(--error); }

.form-err {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 0.375rem;
  display: none;
}
.form-err.show { display: block; }

/* ============================================================
   ORDER SUMMARY BOX
   ============================================================ */
.order-box {
  background: var(--bg);
  border-radius: var(--r-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
}
.order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.order-row:last-child { border-bottom: none; }
.order-row .ok { color: var(--text-muted); }
.order-row .ov { font-weight: 600; color: var(--navy); }
.order-row.total .ov { color: var(--gold-dark); font-size: 1.1rem; }

/* ============================================================
   STATUS PAGES (success / failed)
   ============================================================ */
.status-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 2rem var(--px);
}

.status-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 3rem 2rem 2.5rem;
  text-align: center;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 520px) { .status-card { padding: 3.5rem 3rem 3rem; } }

.status-icon { font-size: 5rem; line-height: 1; margin-bottom: 1.375rem; }
.status-card h2 { margin-bottom: 0.75rem; }
.status-desc { color: var(--text-muted); margin-bottom: 2rem; }

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-body {
  background: #EEF2F7;
  min-height: 100vh;
  font-family: var(--font-body);
}

.admin-nav {
  background: var(--navy);
  color: var(--white);
  padding: 1.125rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-nav h1 {
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
}
.admin-nav span {
  color: rgba(255,255,255,0.55);
  font-size: 0.82rem;
}

.admin-main {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Stats row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--r-md);
  padding: 1.25rem 1.375rem;
  box-shadow: var(--shadow-sm);
}
.stat-card .sl { font-size: 0.78rem; color: #7A8CA0; margin-bottom: 0.25rem; }
.stat-card .sv {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy);
  font-family: var(--font-heading);
  line-height: 1;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}
.t-search, .t-filter, .t-select {
  padding: 0.6rem 0.875rem;
  border: 1.5px solid #D1D9E6;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  background: var(--white);
  font-family: var(--font-body);
  outline: none;
}
.t-search { flex: 1; min-width: 200px; }
.t-search:focus, .t-filter:focus, .t-select:focus {
  border-color: var(--navy);
}
.spacer { flex: 1; }

/* Table */
.tbl-wrap {
  background: var(--white);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: auto;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 720px;
}
.tbl thead th {
  background: var(--navy);
  color: var(--white);
  padding: 0.875rem 1.125rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  font-family: var(--font-body);
}
.tbl tbody td {
  padding: 0.8rem 1.125rem;
  border-bottom: 1px solid #F0F2F7;
  color: var(--text);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #F7F9FF; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.22rem 0.6rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-paid    { background: #E5F9EE; color: #1A8845; }
.badge-pending { background: #FFF4E0; color: #B96B0A; }
.badge-failed  { background: #FDEAEA; color: #C0392B; }

/* Login overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,30,51,0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
}
.login-box {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 2.5rem 2rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.login-box h2 { margin-bottom: 0.5rem; }
.login-box p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.75rem; }

/* ============================================================
   CHECKOUT HEADER
   ============================================================ */
.checkout-page {
  min-height: 100vh;
  background: var(--bg);
  padding: 2.5rem var(--px) 4rem;
}
.checkout-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.checkout-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  transition: color var(--ease);
}
.checkout-header .back-link:hover { color: var(--navy); }

/* ============================================================
   REGISTRATION COUNTER
   ============================================================ */
.reg-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.5rem 1.375rem;
  font-size: 0.875rem;
  color: var(--text);
  margin: 0 auto 1.75rem;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}

.reg-dot {
  width: 8px;
  height: 8px;
  background: #27AE60;
  border-radius: 50%;
  flex-shrink: 0;
  animation: reg-pulse 2s ease-in-out infinite;
}

@keyframes reg-pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(39,174,96,0.4); }
  50%       { opacity: 0.7; transform: scale(0.9); box-shadow: 0 0 0 4px rgba(39,174,96,0); }
}

.reg-remaining {
  font-weight: 700;
  color: var(--navy);
}

.reg-full {
  color: var(--error);
  font-weight: 700;
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* ============================================================
   FAQ ACCORDION
   ============================================================ */
.faq-section {
  background: var(--white);
}
.faq-list {
  max-width: 720px;
  margin: 0 auto;
}
.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-item:first-child {
  border-top: 1px solid var(--border);
}
.faq-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.375rem 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.5;
  transition: color var(--ease);
}
.faq-btn:hover { color: var(--gold-dark); }

.faq-icon {
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border-radius: 50%;
  transition: transform var(--ease), background var(--ease);
}
.faq-icon svg { width: 14px; height: 14px; stroke: var(--navy); }
.faq-btn[aria-expanded="true"] .faq-icon {
  transform: rotate(45deg);
  background: var(--gold);
}
.faq-btn[aria-expanded="true"] .faq-icon svg { stroke: var(--navy); }

.faq-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}
.faq-body-inner {
  padding: 0 0 1.375rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.75;
}
.faq-body-inner a {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .section { padding: 3.5rem 0; }
  .ticket-wrap { padding: 0 0.75rem; }

  /* Admin mobile fixes */
  .admin-main { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Toolbar: stack search full-width, selects side-by-side, buttons row */
  .toolbar { gap: 0.5rem; }
  .t-search { min-width: unset; width: 100%; flex: unset; }
  .t-filter, .t-select { flex: 1; min-width: 0; }
  .spacer { display: none; }
  #export-btn, #refresh-btn { flex: 1; }

  /* Table: prevent order ID wrapping */
  .tbl { font-size: 0.78rem; }
  .tbl thead th,
  .tbl tbody td { padding: 0.6rem 0.5rem; white-space: nowrap; }
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Ensure footer/content can scroll above sticky bar + iOS safe area */
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  /* Admin body doesn't have floating CTA, no extra padding needed */
  .admin-body {
    padding-bottom: 0;
  }
}

@media (min-width: 769px) {
  .hero-actions { flex-direction: row; justify-content: center; }
  .stats-grid   { grid-template-columns: repeat(4, 1fr); }
}
