/* ============================================================
   OPUS STUDIO QR — Main Stylesheet
   ============================================================ */

:root {
  --bg:          #0f0f1a;
  --bg-card:     #1a1a2e;
  --bg-card2:    #16213e;
  --gold:        #c9a84c;
  --gold-light:  #e4c87a;
  --text:        #e8e8f0;
  --text-muted:  #9090a8;
  --success:     #2ecc71;
  --danger:      #e74c3c;
  --warning:     #f39c12;
  --border:      rgba(201,168,76,0.18);
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 8px 32px rgba(0,0,0,0.4);
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────────────── */
.center-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero { max-width: 480px; }
.logo-wrap { margin-bottom: 1.5rem; }
.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.subtitle { color: var(--text-muted); margin-bottom: 2.5rem; }
.cta-wrap { display: flex; gap: 1rem; justify-content: center; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary  { background: var(--gold); color: #1a1a2e; }
.btn-primary:hover:not(:disabled) { background: var(--gold-light); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled)  { filter: brightness(1.1); }
.btn-outline  { background: transparent; border: 1.5px solid var(--gold); color: var(--gold); }
.btn-outline:hover:not(:disabled) { background: var(--gold); color: #1a1a2e; }
.btn-ghost    { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled)   { color: var(--text); }
.btn-full     { width: 100%; }
.btn-lg       { padding: 0.85rem 1.6rem; font-size: 1rem; }
.btn-sm       { padding: 0.35rem 0.9rem; font-size: 0.8rem; }
.btn-group    { display: flex; gap: 0.5rem; align-items: center; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  width: 100%;
}
.card-sm { max-width: 420px; }
.card-header { text-align: center; margin-bottom: 2rem; }
.card-header h2 { color: var(--gold); font-size: 1.5rem; }
.card-header p  { color: var(--text-muted); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group    { margin-bottom: 1.25rem; }
.form-row      { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label          { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.4rem; font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="search"],
textarea, select {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  font-family: var(--font);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
}
textarea { resize: vertical; }
.input-search { flex: 1; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; color: var(--text); cursor: pointer; font-size: 0.9rem; }
input[type="checkbox"] { accent-color: var(--gold); width: 16px; height: 16px; }
.form-group-check { display: flex; align-items: flex-end; padding-bottom: 0.2rem; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert-error   { background: rgba(231,76,60,0.12); border: 1px solid rgba(231,76,60,0.3); color: #ff6b6b; }
.alert-success { background: rgba(46,204,113,0.12); border: 1px solid rgba(46,204,113,0.3); color: #2ecc71; }

/* ── Spinners ───────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-lg {
  width: 48px; height: 48px;
  border: 3px solid rgba(201,168,76,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc ───────────────────────────────────────────────────── */
.hidden       { display: none !important; }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 0.85rem; }
.badge {
  display: inline-block;
  background: var(--gold);
  color: #1a1a2e;
  border-radius: 99px;
  padding: 0.15rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}
.icon-wrap {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
}
.icon-error { background: rgba(231,76,60,0.2); color: var(--danger); }

/* ── Upload page ────────────────────────────────────────────── */
.upload-page { display: flex; flex-direction: column; min-height: 100vh; }
.upload-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.logo-sm {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 700; color: var(--gold); font-size: 0.9rem;
  white-space: nowrap;
}
.event-info { flex: 1; }
.event-info h1 { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.event-info p  { font-size: 0.8rem; color: var(--text-muted); }
.fotos-counter { text-align: right; font-size: 0.85rem; white-space: nowrap; }
.progress-bar  { background: rgba(255,255,255,0.08); border-radius: 99px; height: 4px; margin-top: 4px; width: 120px; }
.progress-fill { background: var(--gold); border-radius: 99px; height: 100%; transition: width 0.3s; }
.upload-main   { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 1.5rem; gap: 1.5rem; }
.uploader-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 560px; }
.drop-zone     { border: 2px dashed var(--border); border-radius: var(--radius); padding: 2.5rem 1.5rem; text-align: center; transition: all 0.2s; cursor: pointer; }
.drop-zone.drag-over { border-color: var(--gold); background: rgba(201,168,76,0.06); }
.drop-icon     { font-size: 3rem; margin-bottom: 0.75rem; }
.drop-title    { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.4rem; }
.drop-sub      { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.file-input-hidden { display: none; }
.nombre-wrap   { margin-top: 1.25rem; }
.file-queue    { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.file-item     { display: flex; align-items: center; gap: 0.75rem; background: rgba(255,255,255,0.04); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; }
.file-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
.file-item-info { flex: 1; font-size: 0.85rem; }
.file-item-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.file-item-size { color: var(--text-muted); font-size: 0.75rem; }
.file-item-status { font-size: 0.8rem; }
.status-ok      { color: var(--success); }
.status-error   { color: var(--danger); }
.status-loading { color: var(--gold); }
.upload-results { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 560px; }
.upload-results h3 { margin-bottom: 1rem; }
.result-item   { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 0.9rem; }

/* ── Gallery page ───────────────────────────────────────────── */
.gallery-page { min-height: 100vh; }
.gallery-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
}
.gallery-header h1 { font-size: 1.1rem; }
.gallery-main { padding: 1.5rem; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}
.gallery-item { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--radius-sm); cursor: pointer; background: var(--bg-card2); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.gallery-item:hover img { transform: scale(1.05); }
.load-more-wrap { text-align: center; margin-top: 2rem; }
.gallery-hint   { text-align: center; margin-bottom: 1rem; }
.foto-badge-pending {
  position: absolute; top: 0.4rem; right: 0.4rem;
  background: rgba(0,0,0,0.6); border-radius: 99px;
  font-size: 0.75rem; padding: 0.1rem 0.4rem;
}

/* ── Lightbox ───────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.95);
  display: flex; align-items: center; justify-content: center;
}
.lb-img-wrap { max-width: 90vw; max-height: 85vh; }
.lb-img-wrap img { max-width: 100%; max-height: 85vh; object-fit: contain; border-radius: 4px; }
.lb-close { position: absolute; top: 1rem; right: 1rem; background: rgba(255,255,255,0.1); border: none; color: #fff; font-size: 1.5rem; cursor: pointer; border-radius: 50%; width: 40px; height: 40px; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.1); border: none; color: #fff; font-size: 2rem; cursor: pointer; border-radius: 50%; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }
.lb-caption { position: absolute; bottom: 1rem; left: 0; right: 0; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* ── Admin ──────────────────────────────────────────────────── */
.admin-page { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; color: var(--gold); margin-bottom: 2rem; font-size: 0.95rem; }
.sidebar-nav  { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.nav-item     { display: flex; align-items: center; gap: 0.5rem; padding: 0.65rem 0.75rem; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none; font-size: 0.9rem; cursor: pointer; transition: all 0.2s; }
.nav-item:hover, .nav-item.active { background: rgba(201,168,76,0.12); color: var(--gold); }
.sidebar-footer { padding-top: 1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.5rem; }
.admin-main  { margin-left: 220px; flex: 1; padding: 2rem; }
.admin-section { max-width: 1100px; }
.section-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section-header h2 { font-size: 1.5rem; flex: 1; }
.filters-row { display: flex; gap: 0.75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

/* Eventos list */
.eventos-list { display: flex; flex-direction: column; gap: 0.75rem; }
.evento-card  { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.evento-card:hover { border-color: var(--gold); }
.evento-info  { flex: 1; }
.evento-nombre { font-size: 1rem; font-weight: 600; }
.evento-meta  { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.evento-estado {
  display: inline-block; border-radius: 99px; padding: 0.15rem 0.7rem;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
}
.estado-activo    { background: rgba(46,204,113,0.15); color: var(--success); }
.estado-cerrado   { background: rgba(243,156,18,0.15); color: var(--warning); }
.estado-archivado { background: rgba(144,144,168,0.1); color: var(--text-muted); }
.evento-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Fotos admin grid */
.fotos-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; }
.foto-admin-item  { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--radius-sm); background: var(--bg-card2); border: 2px solid transparent; transition: border-color 0.2s; }
.foto-admin-item.selected { border-color: var(--gold); }
.foto-admin-item img { width: 100%; height: 100%; object-fit: cover; }
.foto-admin-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; opacity: 0; transition: opacity 0.2s; }
.foto-admin-item:hover .foto-admin-overlay { opacity: 1; }
.foto-check { position: absolute; top: 0.5rem; left: 0.5rem; z-index: 2; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.modal-content { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal-content-sm { max-width: 400px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-close  { background: none; border: none; color: var(--text-muted); font-size: 1.25rem; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; }

/* QR */
.qr-wrap  { text-align: center; padding: 1.5rem 0; }
.qr-image { max-width: 240px; border-radius: var(--radius-sm); background: #fff; padding: 12px; }
.qr-url   { margin-top: 0.75rem; word-break: break-all; }

/* Pagination */
.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1.5rem; align-items: center; }
.page-btn   { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 0.4rem 0.8rem; cursor: pointer; }
.page-btn.active  { background: var(--gold); color: #1a1a2e; border-color: var(--gold); }
.page-btn:hover:not(.active) { border-color: var(--gold); }

/* Loading row */
.loading-row { display: flex; justify-content: center; padding: 3rem; color: var(--text-muted); }

/* ── Name gate (paso 1 upload) ──────────────────────────────── */
.name-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1rem;
}
.name-gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow);
}
.name-gate-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: wave 1.2s ease-in-out;
}
@keyframes wave {
  0%   { transform: rotate(0deg); }
  20%  { transform: rotate(20deg); }
  40%  { transform: rotate(-10deg); }
  60%  { transform: rotate(14deg); }
  80%  { transform: rotate(-4deg); }
  100% { transform: rotate(0deg); }
}
.name-gate-card h2 {
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.name-gate-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
  line-height: 1.5;
}
.name-gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.name-gate-form input {
  font-size: 1.05rem;
  text-align: center;
  padding: 0.8rem 1rem;
}
.name-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0;
}
.uploader-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 1.5rem;
}
.guest-greeting {
  font-size: 0.85rem;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
}
.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .admin-main { margin-left: 0; padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
