@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,400;1,700&family=Bebas+Neue&family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=Share+Tech+Mono&display=swap');

:root {
  --void:        #040404;
  --black:       #080808;
  --deep:        #0d0b09;
  --panel:       #110f0d;
  --surface:     #1a1714;
  --border:      #2c2820;
  --border-hi:   #4a4030;
  --gold:        #d4a843;
  --gold-light:  #f0cc7a;
  --gold-dim:    #6b5220;
  --gold-pale:   rgba(212,168,67,0.12);
  --amber:       #b8832a;
  --cream:       #f0e8d8;
  --red:         #b53020;
  --red-dark:    #6e1a10;
  --text:        #e0d4be;
  --muted:       #6e6050;
  --subtle:      #3a3228;
  --curtain-l:   #1a0d0d;
  --curtain-r:   #1a0d0d;
  --font-title:  'Playfair Display', Georgia, serif;
  --font-display:'Bebas Neue', sans-serif;
  --font-body:   'EB Garamond', Georgia, serif;
  --font-mono:   'Share Tech Mono', monospace;
  --radius:      3px;
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background-color: var(--void);
  background-image:
    radial-gradient(ellipse 160% 50% at 50% 0%, rgba(212,168,67,0.07) 0%, transparent 55%),
    radial-gradient(ellipse 80% 40% at 50% 100%, rgba(184,131,42,0.04) 0%, transparent 50%),
    linear-gradient(180deg, var(--deep) 0%, var(--void) 30%, var(--void) 70%, var(--deep) 100%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: default;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 1;
  mix-blend-mode: overlay;
}

/* ── Header ── */
header {
  position: relative;
  text-align: center;
  padding: 5rem 2rem 3.5rem;
  overflow: hidden;
  background: radial-gradient(ellipse 60% 100% at 50% -20%, rgba(212,168,67,0.1) 0%, transparent 70%);
}
header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 28px;
  background: var(--panel) repeating-linear-gradient(90deg, transparent 0px, transparent 14px, rgba(255,255,255,0.06) 14px, rgba(255,255,255,0.06) 28px, transparent 28px, transparent 36px);
  border-bottom: 1px solid var(--border);
}
header::after {
  content: '✦  ✦  ✦';
  position: absolute;
  bottom: 0.6rem; left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  letter-spacing: 1.4rem;
  color: var(--gold-dim);
}
header .curtain-l,
header .curtain-r {
  position: absolute;
  top: 0; bottom: 0;
  width: clamp(20px, 2.5vw, 44px);
  background: repeating-linear-gradient(180deg, #1e0a0a 0px, #1e0a0a 12px, #2a1010 12px, #2a1010 14px);
  pointer-events: none;
}
header .curtain-l { left: 0; border-right: 2px solid #3d1414; box-shadow: 4px 0 20px rgba(0,0,0,0.6); }
header .curtain-r { right: 0; border-left: 2px solid #3d1414; box-shadow: -4px 0 20px rgba(0,0,0,0.6); }

h1 {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: clamp(3.5rem, 11vw, 8rem);
  color: var(--cream);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-shadow: 0 0 80px rgba(212,168,67,0.3), 0 0 160px rgba(212,168,67,0.1), 2px 3px 0px rgba(0,0,0,0.9), 0 0 2px rgba(212,168,67,0.4);
  position: relative;
  animation: spotlightIn 1.6s cubic-bezier(0.16, 1, 0.3, 1) both, flicker 8s 2s infinite;
}
h1::before {
  content: '— PRÉSENTE —';
  display: block;
  font-family: var(--font-display);
  font-size: 0.18em;
  letter-spacing: 0.55em;
  color: var(--gold-dim);
  text-shadow: none;
  margin-bottom: 0.6em;
  font-weight: 400;
  font-style: normal;
}
h1::after {
  content: '';
  display: block;
  width: 40%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-dim), transparent);
  margin: 1rem auto 0;
}

@keyframes spotlightIn {
  0%   { opacity: 0; transform: scale(0.92) translateY(30px); filter: brightness(0); }
  60%  { filter: brightness(0.6); }
  100% { opacity: 1; transform: scale(1) translateY(0); filter: brightness(1); }
}
@keyframes flicker {
  0%, 96%, 100% { opacity: 1; }
  97%  { opacity: 0.88; }
  98%  { opacity: 1; }
  99%  { opacity: 0.92; }
  99.5%{ opacity: 1; }
}

/* ── Main ── */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 3rem 6rem;
  position: relative;
  text-align: center;
}
main::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 22px;
  background: repeating-linear-gradient(180deg, var(--panel) 0px, var(--panel) 10px, var(--surface) 10px, var(--surface) 14px, var(--panel) 14px, var(--panel) 24px);
  border-right: 1px solid var(--border);
  opacity: 0.5;
}
main::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 22px;
  background: repeating-linear-gradient(180deg, var(--panel) 0px, var(--panel) 10px, var(--surface) 10px, var(--surface) 14px, var(--panel) 14px, var(--panel) 24px);
  border-left: 1px solid var(--border);
  opacity: 0.5;
}

/* ── Buttons ── */
main > button {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0.75rem 1.8rem;
  margin: 0 0.5rem 0.6rem 0;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  animation: fadeUp 0.7s 0.5s var(--ease) both;
}
main > button::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14), transparent);
  transition: left 0.45s ease;
  pointer-events: none;
}
main > button:hover::before { left: 160%; }
main > button::after {
  content: '';
  position: absolute;
  top: 50%; right: -1px;
  transform: translateY(-50%);
  width: 5px; height: 10px;
  background: var(--void);
  border-radius: 5px 0 0 5px;
  pointer-events: none;
}
#btnCREATEmovie {
  background: linear-gradient(135deg, #8a6a10 0%, var(--gold) 50%, var(--gold-light) 100%);
  color: var(--black);
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--gold-dim), 0 6px 24px rgba(212,168,67,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}
#btnCREATEmovie:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--gold), 0 12px 40px rgba(212,168,67,0.5), 0 0 60px rgba(212,168,67,0.15); }
#btnREADmovie { background: linear-gradient(135deg, #1e1c18, #2e2a22); color: var(--text); box-shadow: 0 0 0 1px var(--border), 0 4px 16px rgba(0,0,0,0.5); }
#btnREADmovie:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--border-hi), 0 10px 30px rgba(0,0,0,0.7); }
#btnUPDATEmovie { background: linear-gradient(135deg, #5c3d10, #a06828); color: var(--cream); box-shadow: 0 0 0 1px #5c3d10, 0 4px 16px rgba(160,104,40,0.3); }
#btnUPDATEmovie:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--amber), 0 10px 32px rgba(184,131,42,0.45); }
#btnDELETEmovie { background: linear-gradient(135deg, var(--red-dark), var(--red)); color: #f8d0c8; box-shadow: 0 0 0 1px var(--red-dark), 0 4px 16px rgba(181,48,32,0.35); }
#btnDELETEmovie:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--red), 0 10px 36px rgba(181,48,32,0.55), 0 0 60px rgba(181,48,32,0.15); }
main > button:active { transform: translateY(0) scale(0.975); }

/* ── Table ── */
#movies {
  width: 100%;
  border-collapse: collapse;
  margin-top: 2rem;
  font-family: var(--font-body);
  animation: fadeUp 0.7s 0.7s var(--ease) both;
  outline: 1px solid var(--border);
  outline-offset: 7px;
  box-shadow: 0 0 0 1px var(--subtle), 0 0 80px rgba(0,0,0,0.7), inset 0 0 60px rgba(0,0,0,0.2);
}
#movies thead tr { background: var(--panel); }
#movies thead th {
  font-family: var(--font-display);
  font-size: 0.76rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 1rem 1.2rem;
  text-align: left;
  border-bottom: 1px solid var(--gold-dim);
}
#movies thead th + th { border-left: 1px solid var(--border); }
#movies tbody tr { border-bottom: 1px solid var(--border); transition: background 0.2s var(--ease); }
#movies tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
#movies tbody tr:hover { background: rgba(212,168,67,0.055); }
#movies tbody tr td:first-child { border-left: 2px solid transparent; transition: border-color 0.2s var(--ease); }
#movies tbody tr:hover td:first-child { border-left-color: var(--gold-dim); }
#movies td { padding: 0.9rem 1.2rem; vertical-align: middle; color: var(--text); border-right: 1px solid rgba(255,255,255,0.025); }
#movies td:first-child { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); letter-spacing: 0.1em; width: 80px; text-align: center; }
#movies td:nth-child(2) { font-family: var(--font-title); font-style: italic; font-size: 1.05rem; font-weight: 400; color: var(--cream); }
#movies td .badge { display: inline-block; padding: 0.18rem 0.6rem; border-radius: 2px; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; border: 1px solid var(--gold-dim); color: var(--gold); background: rgba(212,168,67,0.07); }
#movies td .rating { color: var(--gold); font-size: 0.85rem; letter-spacing: 0.1em; text-shadow: 0 0 8px rgba(212,168,67,0.45); }
#movies td .rating .empty { color: var(--border-hi); text-shadow: none; }
#movies td button { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; border: 1px solid var(--border); border-radius: var(--radius); background: transparent; color: var(--muted); padding: 0.3rem 0.75rem; cursor: pointer; transition: all 0.2s var(--ease); margin-right: 0.4rem; }
#movies td button:hover { background: var(--surface); color: var(--text); border-color: var(--muted); }
#movies td button.edit:hover { color: var(--gold-light); border-color: var(--gold-dim); background: rgba(212,168,67,0.08); }
#movies td button.delete:hover { color: #e05040; border-color: var(--red-dark); background: rgba(181,48,32,0.08); }
#movies:empty::after { content: '[ AUCUN FILM EN SALLE ]'; display: block; text-align: center; font-family: var(--font-mono); font-size: 0.73rem; letter-spacing: 0.38em; color: var(--muted); padding: 4.5rem 0; }

/* ════════════════════════════════════════
    Ticket — Cinema Ticket
   ════════════════════════════════════════ */
.ticket-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(4,4,4,0.88);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.ticket-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* The ticket itself */
.ticket-ticket {
  width: min(480px, 92vw);
  background: #f5edd8;
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.4),
    0 30px 80px rgba(0,0,0,0.8),
    0 0 120px rgba(212,168,67,0.1);
  transform: translateY(24px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
  overflow: hidden;
  position: relative;
}
.ticket-overlay.open .ticket-ticket {
  transform: translateY(0) scale(1);
}

/* ── Stub (top section) ── */
.ticket-stub {
  background: #1a0a0a;
  padding: 0.9rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: none;
}
.stub-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.35em;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(212,168,67,0.4);
}
.stub-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.15em;
}

/* ── Tear line (perforation) ── */
.ticket-tear {
  height: 18px;
  background: #1a0a0a;
  position: relative;
}
.ticket-tear::before {
  content: '';
  position: absolute;
  bottom: 0; left: -8px; right: -8px;
  height: 18px;
  background: radial-gradient(circle at 50% 0%, #f5edd8 8px, transparent 8px);
  background-size: 18px 18px;
  background-repeat: repeat-x;
}

/* ── Ticket body ── */
.ticket-body {
  background: #f5edd8;
  padding: 1.8rem 2rem 1.5rem;
  position: relative;
}

/* Vertical dashed divider (left edge decoration) */
.ticket-body::before {
  content: '';
  position: absolute;
  left: 2.4rem; top: 0; bottom: 0;
  width: 1px;
  background: repeating-linear-gradient(180deg, #c8b890 0px, #c8b890 6px, transparent 6px, transparent 12px);
  opacity: 0.5;
}

/* Watermark */
.ticket-body::after {
  content: '🎬';
  position: absolute;
  right: 1.5rem; top: 50%;
  transform: translateY(-50%);
  font-size: 5rem;
  opacity: 0.04;
  pointer-events: none;
}

.ticket-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.3em;
  color: #1a0a0a;
  margin-bottom: 1.4rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px dashed #c8b890;
}

/* Fields */
.ticket-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.field-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  align-items: center;
  gap: 0.75rem;
}

.field-row label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b5220;
  text-align: right;
}

.field-row input {
  background: rgba(255,255,255,0.6);
  border: 1px solid #c8b890;
  border-bottom: 2px solid #9a7840;
  border-radius: 2px;
  padding: 0.4rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: #1a0a0a;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.field-row input:focus {
  background: rgba(255,255,255,0.9);
  border-color: var(--gold);
  border-bottom-color: var(--amber);
}
.field-row input::placeholder { color: #b0a080; font-style: italic; }

/* Actions */
.ticket-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.6rem;
  padding-top: 1rem;
  border-top: 1px dashed #c8b890;
}

.btn-cancel {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid #c8b890;
  border-radius: var(--radius);
  color: #8a7050;
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.btn-cancel:hover { background: rgba(0,0,0,0.05); border-color: #9a7840; color: #4a3010; }

.btn-confirm {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  background: linear-gradient(135deg, #8a6a10, var(--gold));
  border: none;
  border-radius: var(--radius);
  color: #0a0500;
  padding: 0.5rem 1.6rem;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(212,168,67,0.35);
  transition: all 0.2s var(--ease);
}
.btn-confirm:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(212,168,67,0.5); }
.btn-confirm:active { transform: translateY(0); }

/* ── Bottom perf ── */
.ticket-perf {
  height: 12px;
  background: #f5edd8;
  position: relative;
  border-top: 1px dashed #c8b890;
}

/* ── Filmstrip ── */
.filmstrip-bottom {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 26px;
  background: var(--panel) repeating-linear-gradient(90deg, transparent 0px, transparent 14px, rgba(255,255,255,0.05) 14px, rgba(255,255,255,0.05) 28px, transparent 28px, transparent 36px);
  border-top: 1px solid var(--border);
  z-index: 100;
  pointer-events: none;
  opacity: 0.7;
}

.poster {
  width: 90px;
  height: 120px;      /* fixed height */
  object-fit: cover; /* crop image nicely */
  border-radius: 4px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; background: var(--void); }
::-webkit-scrollbar-track { background: var(--void); border-left: 1px solid var(--border); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--gold-dim), var(--amber)); border-radius: 0; border: 1px solid var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
::selection { background: rgba(212,168,67,0.25); color: var(--cream); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  header { padding: 3.5rem 1rem 2.5rem; }
  main { padding: 2rem 1.4rem 5rem; }
  main::before, main::after { display: none; }
  #movies thead { display: none; }
  #movies td { display: block; border-right: none; padding: 0.4rem 0.8rem; }
  #movies tr { display: block; border: 1px solid var(--border); margin-bottom: 1rem; padding: 0.6rem; }
  .field-row { grid-template-columns: 1fr; }
  .field-row label { text-align: left; }
}
/* ── Nav ── */
nav {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 1.8rem;
  position: relative;
  z-index: 1;
}
nav a {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
nav a:hover {
  color: var(--gold-light);
  border-bottom-color: var(--gold-dim);
}
nav a.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ── Pages communes ── */
.page-accueil,
.page-contact {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 0;
  animation: fadeUp 0.5s var(--ease) both;
}
.page-accueil h2,
.page-contact h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.3em;
  color: var(--gold);
  margin-bottom: 1.4rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.page-accueil p {
  font-family: var(--font-body);
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.75;
}
.page-accueil a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-dim);
  transition: color 0.2s, border-color 0.2s;
}
.page-accueil a:hover {
  color: var(--gold-light);
  border-bottom-color: var(--gold);
}

/* ── Contact card ── */
.contact-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.8rem;
  outline: 1px solid var(--subtle);
  outline-offset: 4px;
}
.page-contact .field-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  align-items: center;
  gap: 0.75rem;
}
.page-contact .field-row label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
  text-align: right;
}
.page-contact .field-row span {
  font-family: var(--font-body);
  color: var(--text);
}

/* ── Liste page ── */
.page-liste {
  animation: fadeUp 0.5s var(--ease) both;
}

/* ── Page Saisie (ticket inline) ── */
.page-saisie {
  display: flex;
  justify-content: center;
  padding: 2rem 0 4rem;
  animation: fadeUp 0.5s var(--ease) both;
}
.page-saisie .ticket-ticket {
  width: min(480px, 92vw);
  transform: none;
  transition: none;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.4),
    0 30px 80px rgba(0,0,0,0.8),
    0 0 120px rgba(212,168,67,0.1);
}
