/* ===== 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; }
.editable-title { cursor: pointer; border-bottom: 1px dashed transparent; transition: border-color 0.2s; }
.editable-title:hover { border-bottom-color: #6366f1; }
.edit-title-input {
  font-size: 1.2rem; font-weight: 700; background: #1a1a2a; border: 1px solid #6366f1;
  border-radius: 6px; padding: 0.2rem 0.5rem; color: #e8e8ed; outline: none; width: 100%;
}
.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 {
  --primary-color: #6366f1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  background: #f5f0eb;
}
.guest-header {
  width: 100%;
  height: 48px;
  background: var(--primary-color);
}
.guest-hero {
  width: 100%;
  max-width: 480px;
}
.guest-hero img {
  width: 100%;
  max-height: 45vh;
  object-fit: cover;
  display: block;
}
.guest-card {
  background: #fff;
  color: #333;
  border-radius: 20px;
  padding: 2rem 1.5rem;
  text-align: center;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  margin-top: -1.5rem;
  position: relative;
  z-index: 1;
}
.guest-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}
.guest-description {
  color: #555;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.2rem;
  text-align: left;
  white-space: pre-line;
}
.guest-info-box {
  background: #fdf8f4;
  border: 1px solid #f0e6dc;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
  text-align: left;
}
.guest-info-row {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}
.guest-info-row svg {
  flex-shrink: 0;
  color: var(--primary-color);
  margin-top: 2px;
}
.guest-info-label {
  display: block;
  font-size: 0.8rem;
  color: #888;
}
.guest-info-row strong {
  display: block;
  font-size: 0.95rem;
  color: #333;
}
.guest-info-row a {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--primary-color);
  margin-top: 0.2rem;
  text-decoration: none;
  font-weight: 600;
}
.guest-info-row a:hover { text-decoration: underline; }
.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.8rem;
  margin-top: 0.5rem;
  outline: none;
}
.guest-name-input:focus { border-color: var(--primary-color); }
.guest-name-input::placeholder { color: #bbb; }

.guest-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.9rem;
  border-radius: 50px;
  border: 2px solid var(--primary-color);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.7rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.guest-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.guest-btn-primary {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.guest-btn-secondary {
  background: #fff;
  color: var(--primary-color);
}
.guest-btn svg { flex-shrink: 0; }

.guest-footer {
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: #999;
}
.guest-footer strong { color: var(--primary-color); }

.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: var(--primary-color);
  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; }
.hide-cursor, .hide-cursor * { cursor: none !important; }
.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;
  padding: 4rem 3rem 6rem;
}
/* Polaroid wrapper */
.polaroid-frame {
  position: relative;
  background: #fff;
  padding: 12px 12px 0;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  border-radius: 3px;
  max-width: calc(100% - 2rem);
  max-height: calc(100% - 2rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}
.polaroid-frame img,
.polaroid-frame video {
  max-width: 100%;
  max-height: calc(100vh - 12rem);
  object-fit: contain;
  display: block;
  min-height: 0;
}
.polaroid-author {
  flex-shrink: 0;
  padding: 8px 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  font-family: 'Georgia', serif;
  font-style: italic;
  text-align: center;
  width: 100%;
}
.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;
}
.cover-slide {
  max-width: 100%;
  max-height: 100vh;
  object-fit: contain;
  display: block;
}
.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; }

/* Connection indicator */
.connection-dot {
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.6);
  z-index: 30;
  transition: background 0.3s, box-shadow 0.3s;
}
.connection-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239,68,68,0.6);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Author tag - hidden, now shown inside polaroid frame */
.projector-author { display: none; }

/* QR - position presets (1=top-right, 2=bottom-left, 3=bottom-right, 0=toggle) */
.projector-qr {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  z-index: 10;
  padding: 8px;
  border-radius: 10px;
  background: rgba(0,0,0,0.4);
  cursor: grab;
  user-select: none;
  bottom: 4rem;
  right: 1.2rem;
}
.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;
}
.projector-qr span {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  text-align: center;
}

/* ===== GUEST MESSAGE FORM ===== */
.message-form {
  margin-top: 0.5rem;
  width: 100%;
}
.message-form textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid #e0e0e8;
  border-radius: 12px;
  font-size: 0.95rem;
  background: #f8f8fc;
  color: #333;
  resize: vertical;
  min-height: 80px;
  outline: none;
  font-family: inherit;
}
.message-form textarea:focus { border-color: #6366f1; }
.message-form textarea::placeholder { color: #bbb; }
.message-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}
.message-chars { font-size: 0.75rem; color: #999; }
.message-send {
  padding: 0.6rem 1.5rem !important;
  margin-bottom: 0 !important;
  width: auto !important;
  font-size: 0.85rem !important;
}
.message-status {
  font-size: 0.8rem;
  margin-top: 0.4rem;
  text-align: center;
  min-height: 1.2em;
}

/* ===== DASHBOARD MESSAGES ===== */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 400px;
  overflow-y: auto;
}
.message-card {
  background: #1a1a24;
  border: 1px solid #2a2a3a;
  border-radius: 12px;
  padding: 1rem;
}
.message-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.message-card-body {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #ccc;
  margin-bottom: 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== MARQUEE LED BAR ===== */
@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.marquee-bar {
  position: absolute;
  bottom: 2.5rem;
  left: 0;
  right: 0;
  z-index: 20;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.95) 100%);
  border-top: 2px solid var(--marquee-color, #f59e0b);
  border-bottom: 2px solid var(--marquee-color, #f59e0b);
  padding: 0.6rem 0;
  box-shadow:
    0 0 20px rgba(245,158,11,0.3),
    inset 0 0 30px rgba(0,0,0,0.5);
}
.marquee-track {
  display: flex;
  white-space: nowrap;
  animation: marqueeScroll 30s linear infinite;
  will-change: transform;
}
.marquee-content {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  padding-right: 2rem;
}
.marquee-item {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--marquee-color, #fbbf24);
  letter-spacing: 0.5px;
  text-shadow: 0 0 8px currentColor, 0 0 20px currentColor;
  padding: 0 1rem;
}
.marquee-author {
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 8px rgba(255,255,255,0.4);
}
.marquee-dot {
  font-size: 0.5rem;
  color: var(--marquee-color, #f59e0b);
  vertical-align: middle;
  margin: 0 0.2rem;
}
.marquee-sep {
  color: var(--marquee-color, #f59e0b);
  font-size: 1rem;
  padding: 0 1.5rem;
  opacity: 0.6;
  text-shadow: 0 0 10px currentColor;
}

/* ===== 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; }
}
