/* Swiperboxd styles */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --bg-card: #222222;
  --text-primary: #ffffff;
  --text-secondary: #888888;
  --accent-pink: #e94560;
  --accent-green: #00d26a;
  --accent-red: #ff4757;
  --accent-blue: #3498db;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  height: 100%;
  flex-direction: column;
}
.screen.active { display: flex; }

.hidden { display: none !important; }


/* ==================== AUTH SCREEN ==================== */

#setup-screen {
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
  overflow-y: auto;
  gap: 1.5rem;
}

#auth-screen {
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
  overflow-y: auto;
  gap: 1.5rem;
}

.logo {
  text-align: center;
}

.logo-img {
  width: 64px;
  height: 64px;
  margin-bottom: 0.75rem;
}

.logo h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-pink), #ff6b8a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.25rem;
}

.logo p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Setup steps */
.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 420px;
  width: 100%;
}

.setup-step {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.step-num {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  background: var(--accent-pink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 0.05rem;
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.step-body strong {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.step-body span {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.step-body a {
  color: var(--accent-pink);
  text-decoration: none;
}

.step-body code {
  font-family: 'Courier New', monospace;
  background: rgba(255,255,255,0.09);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.85em;
  color: #ccc;
}

/* Auth form */
.auth-form {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-form input,
.auth-form textarea {
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255,255,255,0.1);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  transition: border-color 0.2s;
  font-family: inherit;
  resize: none;
}

.auth-form textarea {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.4;
}

.auth-form input:focus,
.auth-form textarea:focus {
  outline: none;
  border-color: var(--accent-pink);
}

.btn-primary {
  padding: 0.9rem;
  background: var(--accent-pink);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.btn-primary:hover { background: #d63850; transform: translateY(-1px); }
.btn-primary:disabled { background: #444; cursor: not-allowed; transform: none; }

.btn-secondary {
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--accent-pink);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-secondary:hover { background: var(--accent-pink); }

.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  cursor: pointer;
  transition: color 0.2s;
}
.btn-text:hover { color: var(--text-primary); }

.error-msg, .success-msg {
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  text-align: center;
}

.error-msg {
  background: rgba(255, 71, 87, 0.15);
  color: var(--accent-red);
  border: 1px solid var(--accent-red);
}

.success-msg {
  background: rgba(0, 210, 106, 0.15);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
}


/* ==================== DISCOVERY SCREEN ==================== */

#discovery-screen {
  background: var(--bg-primary);
  position: relative;
}

.header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.6rem 1rem;
  background: rgba(10,10,10,0.9);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.header-logo {
  width: 28px;
  height: 28px;
}

.profile-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  transition: background 0.2s;
}
.profile-btn:hover { background: rgba(255,255,255,0.12); }

.chevron { font-size: 0.65rem; opacity: 0.6; }

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.sync-badge {
  display: none !important;
  align-items: center;
  border-radius: 999px;
  padding: 0.22rem 0.56rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.sync-badge.sync-badge-idle {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.85);
}

.sync-badge.sync-badge-running {
  background: rgba(52,152,219,0.18);
  border-color: rgba(52,152,219,0.45);
  color: #9ed7ff;
}

.sync-badge.sync-badge-success {
  background: rgba(0,210,106,0.16);
  border-color: rgba(0,210,106,0.45);
  color: #7dffc0;
}

.sync-badge.sync-badge-error {
  background: rgba(255,71,87,0.18);
  border-color: rgba(255,71,87,0.45);
  color: #ffb3bc;
}

/* List dropdown */
.profile-dropdown {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  min-width: 300px;
  max-width: 90vw;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  z-index: 200;
  border: 1px solid rgba(255,255,255,0.08);
}

.list-search-shell { padding: 0.5rem 0.5rem 0.6rem; }

.list-search-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.9rem;
}
.list-search-input:focus { outline: none; border-color: var(--accent-pink); }

.profile-option {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.profile-option:hover, .profile-option.active { background: var(--accent-pink); }

.list-option-title { font-weight: 600; font-size: 0.9rem; }
.list-option-meta { margin-top: 0.15rem; color: rgba(255,255,255,0.65); font-size: 0.78rem; }


/* ==================== FULLSCREEN POSTER ==================== */

.deck-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.card-stack {
  position: absolute;
  inset: 0;
}

.movie-card {
  position: absolute;
  inset: 0;
  background: var(--bg-card);
  overflow: hidden;
  user-select: none;
}

.movie-card.swiping-right { animation: swipeRight 0.4s ease-out forwards; }
.movie-card.swiping-left  { animation: swipeLeft  0.4s ease-out forwards; }
.movie-card.swiping-up    { animation: swipeUp    0.4s ease-out forwards; }

@keyframes swipeRight { to { transform: translateX(110%) rotate(10deg); opacity: 0; } }
@keyframes swipeLeft  { to { transform: translateX(-110%) rotate(-10deg); opacity: 0; } }
@keyframes swipeUp    { to { transform: translateY(-110%); opacity: 0; } }

.card-backdrop {
  position: absolute;
  inset: -6%;
  background-image: var(--poster-backdrop);
  background-size: cover;
  background-position: center;
  filter: blur(26px) saturate(0.9) brightness(0.55);
  transform: scale(1.06);
  pointer-events: none;
  z-index: 0;
}

.card-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  display: block;
  z-index: 1;
  background: radial-gradient(circle at center, rgba(0,0,0,0.08), rgba(0,0,0,0.55));
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(0,0,0,0.88) 0%,
    rgba(0,0,0,0.3) 35%,
    transparent 65%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem 2rem 6.5rem;
  pointer-events: none;
  z-index: 2;
}

.card-title {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.3rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.card-meta {
  color: rgba(255,255,255,0.75);
  font-size: 0.95rem;
}


/* ==================== FLOATING ACTION BAR ==================== */

.action-bar {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 0.75rem;
  background: rgba(8,8,8,0.7);
  backdrop-filter: blur(16px);
  border-radius: 3rem;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(255,255,255,0.1);
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.6rem 1rem;
  border-radius: 2rem;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  background: transparent;
  color: white;
  min-width: 56px;
}

.action-btn:hover { transform: scale(1.08); }
.action-btn:active { transform: scale(0.94); }
.action-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

.action-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  opacity: 0.75;
  text-transform: uppercase;
}

.action-btn.dismiss { color: var(--accent-red); }
.action-btn.dismiss:hover { background: rgba(255,71,87,0.2); }

.action-btn.info { color: rgba(255,255,255,0.7); }
.action-btn.info:hover { background: rgba(255,255,255,0.1); color: white; }

.action-btn.watchlist { color: var(--accent-pink); }
.action-btn.watchlist:hover { background: rgba(233,69,96,0.2); }

.action-btn.log { color: #f6c90e; }
.action-btn.log:hover { background: rgba(246,201,14,0.15); }

/* Keyboard hint */
.key-hint {
  position: absolute;
  bottom: 0.4rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.22);
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  letter-spacing: 0.02em;
}


/* ==================== INFO PILL OVERLAY ==================== */

.info-pill-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.info-pill {
  background: rgba(18,18,18,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 1.25rem;
  padding: 1.75rem 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 75vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  animation: slideUp 0.18s ease-out;
}

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

.info-pill-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.info-pill-meta {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 0.9rem;
}

.info-pill-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.genre-tag {
  background: rgba(233,69,96,0.2);
  color: var(--accent-pink);
  padding: 0.2rem 0.65rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.info-pill-synopsis {
  color: rgba(255,255,255,0.78);
  font-size: 0.88rem;
  line-height: 1.65;
  margin-bottom: 0.85rem;
}

.info-pill-cast {
  color: var(--text-secondary);
  font-size: 0.8rem;
}


/* ==================== LOADING & EMPTY ==================== */

.skeleton-stack {
  position: absolute;
  inset: 0;
}

.skeleton-card {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--bg-secondary) 0%, #2a2a2a 50%, var(--bg-secondary) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: var(--bg-primary);
  gap: 0.75rem;
  z-index: 5;
}

.empty-icon { font-size: 3.5rem; }
.empty-state h2 { font-size: 1.3rem; }
.empty-state p { color: var(--text-secondary); font-size: 0.9rem; max-width: 340px; line-height: 1.5; }


/* ==================== TOAST ==================== */

.toast {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,20,0.95);
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 0.5rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.09);
  backdrop-filter: blur(12px);
  z-index: 400;
  pointer-events: none;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.toast.hidden {
  opacity: 0;
}

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