/* POSTAL — Estilos Oficiales
   Paleta: Cálida, nostálgica y moderna (Warm Dark + Ámbar Nostálgico)
   Tipografía: Outfit + Inter
*/

:root {
  --bg-dark: #0D0F12;
  --bg-card: #16191F;
  --bg-card-hover: #1E222B;
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --accent-gold: #F5A623;
  --accent-warm: #E26A45;
  --accent-gradient: linear-gradient(135deg, #F5A623 0%, #E26A45 100%);
  --accent-glow: rgba(245, 166, 35, 0.25);
  --text-main: #F4F5F7;
  --text-muted: #959AA6;
  --text-dim: #5E6473;
  --success: #2ECC71;
  --danger: #E74C3C;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.5);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Background Atmosphere Glow */
body::before {
  content: '';
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(circle, rgba(245, 166, 35, 0.12) 0%, rgba(226, 106, 69, 0.04) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(13, 15, 18, 0.85);
  border-bottom: 1px solid var(--bg-card-border);
  padding: 16px 20px;
}

.header-container {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-stamp {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.2rem;
  color: #000;
  box-shadow: 0 2px 10px var(--accent-glow);
  transform: rotate(-3deg);
}

.brand-titles h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-titles p {
  font-size: 0.72rem;
  color: var(--accent-gold);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Main Container */
.main-wrapper {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px calc(env(safe-area-inset-bottom, 24px) + 90px);
  position: relative;
  z-index: 1;
}

/* Stepper Progress Bar */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  position: relative;
}

.stepper::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 30px;
  right: 30px;
  height: 2px;
  background: var(--bg-card-border);
  transform: translateY(-50%);
  z-index: 0;
}

.step-node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--bg-card-border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-heading);
  transition: var(--transition);
}

.step-node.active .step-circle {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #000;
  box-shadow: 0 0 16px var(--accent-glow);
}

.step-node.completed .step-circle {
  background: var(--success);
  border-color: transparent;
  color: #fff;
}

.step-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
}

.step-node.active .step-label {
  color: var(--text-main);
  font-weight: 600;
}

/* Cards & Step Panels */
.step-panel {
  display: none;
  animation: fadeIn 0.35s ease;
}

.step-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Step 1: Upload Dropzone */
.dropzone {
  border: 2px dashed rgba(245, 166, 35, 0.35);
  border-radius: var(--radius-lg);
  background: rgba(22, 25, 31, 0.7);
  backdrop-filter: blur(10px);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-gold);
  background: rgba(245, 166, 35, 0.05);
  transform: translateY(-2px);
}

.dropzone-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.dropzone-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.dropzone-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.dropzone-meta {
  display: inline-flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.file-input {
  display: none;
}

/* Selected Files Grid Preview */
.files-preview {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}

.file-thumb {
  position: relative;
  aspect-ratio: 9/16;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--bg-card-border);
  background: #15181F;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.file-thumb.loading {
  animation: pulseBg 1.5s infinite ease-in-out;
}

@keyframes pulseBg {
  0%, 100% { background-color: #15181F; }
  50% { background-color: #262B36; }
}

.file-thumb img, .file-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.file-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.15s ease, background 0.15s ease;
}

.file-thumb-remove:hover {
  background: var(--danger);
  transform: scale(1.1);
}

.file-thumb-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  z-index: 5;
}

.reading-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(245, 166, 35, 0.1);
  border: 1px solid rgba(245, 166, 35, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--accent-gold);
  animation: fadeIn 0.3s ease;
}

.reading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(245, 166, 35, 0.3);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: var(--accent-gradient);
  color: #000;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 15px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: var(--transition);
  margin-top: 24px;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(245, 166, 35, 0.4);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Processing State */
.loading-box {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  margin-top: 20px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(245, 166, 35, 0.2);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 14px auto 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.live-activity-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.3);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: #2ecc71;
  font-weight: 600;
  margin-bottom: 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 8px #2ecc71;
  animation: livePulse 1.5s infinite ease-in-out;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 18px 0 8px;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f5a623 0%, #ffd066 50%, #f5a623 100%);
  background-size: 200% 100%;
  width: 0%;
  transition: width 0.35s ease;
  animation: shimmerProgress 2s linear infinite;
}

@keyframes shimmerProgress {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.progress-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.loading-timer {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.reassurance-ticker {
  background: rgba(245, 166, 35, 0.06);
  border: 1px solid rgba(245, 166, 35, 0.18);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--text-main);
  line-height: 1.4;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: opacity 0.3s ease;
}

/* Step 2: Vibe Selector */
.vibe-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.vibe-card {
  background: var(--bg-card);
  border: 2px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.vibe-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(245, 166, 35, 0.4);
}

.vibe-card.selected {
  border-color: var(--accent-gold);
  background: rgba(245, 166, 35, 0.08);
  box-shadow: 0 4px 18px var(--accent-glow);
}

.vibe-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.vibe-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vibe-duration {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  color: var(--accent-gold);
}

.vibe-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.vibe-quote {
  font-size: 0.8rem;
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 12px;
  border-left: 3px solid var(--accent-gold);
  border-radius: 4px;
  font-style: italic;
}

/* Step 3: Final Postal Preview */
.postal-frame-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 16px 0 24px;
}

.postal-frame {
  width: 270px;
  aspect-ratio: 9/16;
  background: #000;
  border: 4px solid #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 30px rgba(245, 166, 35, 0.2);
  position: relative;
}

.postal-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.postal-meta-badge {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  margin-top: 14px;
  font-size: 0.8rem;
}

.btn-whatsapp {
  background: #25D366;
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 15px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  width: 100%;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.35);
  transition: var(--transition);
  margin-top: 12px;
}

.btn-whatsapp:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(37, 211, 102, 0.5);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

/* Concierge Floating Chat */
.concierge-toggle {
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: none;
  color: #000;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--accent-glow);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.concierge-toggle:hover {
  transform: scale(1.08) rotate(-5deg);
}

.chat-modal {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 340px;
  height: 460px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  backdrop-filter: blur(20px);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-modal.open {
  display: flex;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-header {
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--bg-card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h3 {
  font-size: 0.95rem;
  font-family: var(--font-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.4;
}

.chat-bubble.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 4px;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent-gradient);
  color: #000;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

.chat-input-row {
  display: flex;
  padding: 10px;
  border-top: 1px solid var(--bg-card-border);
  background: rgba(0, 0, 0, 0.2);
  gap: 8px;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
}

.chat-send-btn {
  background: var(--accent-gold);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Modal Simple (Login & Library) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.25s ease;
  position: relative;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  margin-bottom: 12px;
}

.modal-input:focus {
  border-color: var(--accent-gold);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  cursor: pointer;
}

/* Banner de recuperación de postal reciente */
.recent-postal-banner {
  background: rgba(245, 166, 35, 0.1);
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}

.recent-banner-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recent-banner-icon {
  font-size: 1.5rem;
}

.btn-sm-primary {
  background: var(--accent-gradient);
  color: #000;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--accent-glow);
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 480px) {
  .chat-modal {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 86px;
  }
}
