/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0f0f14;
  color: #e8e8ed;
  min-height: 100vh;
  line-height: 1.5;
}
a { color: #7c8aff; text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ===== HIDDEN FIX ===== */
[hidden] { display: none !important; }

/* ===== UTILITIES ===== */
.muted { color: #888; font-size: 0.875rem; }
.error { color: #ff6b6b; font-size: 0.875rem; margin-top: 0.5rem; }
.badge {
  background: #2a2a3a;
  color: #aab;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: #6366f1;
  color: #fff;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.btn-primary:hover { background: #5558e6; }

.btn-ghost {
  background: transparent;
  color: #aab;
  border: 1px solid #333;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.btn-ghost:hover { border-color: #6366f1; color: #e8e8ed; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-danger { color: #ff6b6b; border-color: #442; }
.btn-danger:hover { border-color: #ff6b6b; }

/* ===== FORMS ===== */
label { display: flex; flex-direction: column; gap: 0.3rem; }
label > span { font-size: 0.8rem; color: #999; font-weight: 500; }
input, select {
  background: #1a1a24;
  border: 1px solid #2a2a3a;
  color: #e8e8ed;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus { border-color: #6366f1; }
input[type="color"] { padding: 0.3rem; height: 42px; cursor: pointer; }
input[type="file"] { font-size: 0.8rem; }
select { cursor: pointer; }

.form-row { display: flex; gap: 1rem; }
.form-row > * { flex: 1; }

/* ===== AUTH PAGE ===== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}
.auth-card {
  background: #16161e;
  border: 1px solid #222;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}
.logo {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.5px;
}
.logo span, .logo-sm span { color: #6366f1; }
.tagline { text-align: center; color: #888; margin-bottom: 2rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-form h2 { font-size: 1.1rem; font-weight: 600; }
.auth-form button[type="submit"] {
  background: #6366f1;
  color: #fff;
  border: none;
  padding: 0.7rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}
.auth-form button[type="submit"]:hover { background: #5558e6; }
.switch { text-align: center; font-size: 0.85rem; color: #888; }

/* ===== TOPBAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  border-bottom: 1px solid #1e1e28;
  background: #13131a;
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo-sm { font-size: 1.2rem; font-weight: 800; color: #e8e8ed; }
.logo-sm:hover { text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 1rem; font-size: 0.85rem; color: #888; }

/* ===== DASHBOARD ===== */
.dash-page { max-width: 1000px; margin: 0 auto; padding: 2rem 1.5rem; }
.dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.dash-header h1 { font-size: 1.5rem; font-weight: 700; }

.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }

.event-card {
  background: #16161e;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 1.2rem;
  transition: border-color 0.2s;
}
.event-card:hover { border-color: #333; }
.event-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.event-card-header h3 { font-size: 1rem; font-weight: 600; }
.event-card-meta { display: flex; gap: 0.8rem; font-size: 0.8rem; color: #888; margin-bottom: 0.8rem; }
.event-card-actions { display: flex; gap: 0.5rem; }

.empty-state { grid-column: 1 / -1; text-align: center; padding: 3rem; color: #888; }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal {
  background: #16161e;
  border: 1px solid #2a2a3a;
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-lg { max-width: 640px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.modal-header h2 { font-size: 1.2rem; font-weight: 700; }
.modal-close {
  background: none; border: none; color: #888; font-size: 1.5rem; cursor: pointer;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.modal-close:hover { background: #222; color: #fff; }

.modal form { display: flex; flex-direction: column; gap: 1rem; }

/* Tabs */
.detail-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.2rem; }
.tab {
  background: transparent;
  border: 1px solid #2a2a3a;
  color: #888;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}
.tab.active { background: #6366f1; color: #fff; border-color: #6366f1; }

.qr-section { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.qr-section canvas { border-radius: 8px; }
.qr-section code {
  display: inline-block;
  background: #1a1a24;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  word-break: break-all;
  margin: 0.3rem 0;
}

/* ===== GALLERY GRID ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}
.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1a24;
  cursor: pointer;
}
.gallery-item img, .gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.delete-media {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: #ff6b6b;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  cursor: pointer;
}
.gallery-item:hover .delete-media { opacity: 1; }

/* ===== GUEST PAGE (invitado) ===== */
.guest-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
.guest-card {
  background: #fff;
  color: #333;
  border-radius: 24px;
  padding: 2.5rem 2rem;
  text-align: center;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.guest-welcome { color: #888; font-size: 0.9rem; margin-bottom: 0.2rem; }
.guest-title { font-size: 1.6rem; font-weight: 800; color: #1a1a2e; margin-bottom: 0.3rem; }
.guest-sub { color: #999; margin-bottom: 2rem; font-size: 0.9rem; }
.guest-name-input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid #e0e0e8;
  border-radius: 12px;
  font-size: 1rem;
  text-align: center;
  background: #f8f8fc;
  color: #333;
  margin-bottom: 0.5rem;
  outline: none;
}
.guest-name-input:focus { border-color: #6366f1; }
.guest-name-input::placeholder { color: #bbb; }

.guest-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
  padding: 1rem;
  border-radius: 16px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.8rem;
  transition: transform 0.15s, box-shadow 0.15s;
  background: #6366f1;
  color: #fff;
}
.guest-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99,102,241,0.3);
}
.guest-btn:last-of-type {
  background: #e8e8f0;
  color: #444;
}
.guest-btn:last-of-type:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.guest-btn svg { flex-shrink: 0; }

.upload-status { margin-top: 1rem; }
.progress-bar {
  height: 6px;
  background: #e8e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.progress-fill {
  height: 100%;
  background: #6366f1;
  width: 0%;
  transition: width 0.3s;
  border-radius: 3px;
}
.upload-status p { font-size: 0.8rem; color: #888; }

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  width: 100%;
  max-width: 600px;
}

.guest-gallery {
  width: 100%;
  max-width: 600px;
}
.guest-gallery .gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  z-index: 301;
}
.lightbox-content {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== PROJECTOR ===== */
.projector-body { background: #000; margin: 0; overflow: hidden; }
.projector-stage {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-color: #0a0a14;
}
.projector-slide {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.projector-slide.fade-in { animation: fadeIn 0.6s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.projector-waiting {
  font-size: 2rem;
  color: rgba(255,255,255,0.3);
  text-align: center;
}
.projector-overlay {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.projector-brand {
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255,255,255,0.3);
}
.projector-count {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.3);
}
.projector-fs {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.projector-fs:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* Author tag - top center */
.projector-author {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.5);
  color: #fff;
  padding: 0.5rem 1.5rem;
  border-radius: 999px;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  backdrop-filter: blur(8px);
  z-index: 10;
  white-space: nowrap;
}
.projector-author:empty { display: none; }
.projector-author.fade-in { animation: fadeIn 0.6s ease; }

/* QR - bottom right */
.projector-qr {
  position: absolute;
  bottom: 1.2rem;
  right: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  z-index: 10;
  cursor: grab;
  user-select: none;
  padding: 8px;
  border-radius: 10px;
  background: rgba(0,0,0,0.4);
  resize: none;
}
.projector-qr:active { cursor: grabbing; }
.projector-qr::after {
  content: "";
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  border-right: 2px solid rgba(255,255,255,0.3);
  border-bottom: 2px solid rgba(255,255,255,0.3);
  border-radius: 0 0 4px 0;
}
.projector-qr img {
  border-radius: 6px;
  pointer-events: none;
}
.projector-qr span {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  text-align: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .dash-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .event-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .qr-section { flex-direction: column; align-items: center; }
  .modal { margin: 0.5rem; padding: 1.2rem; }
}
