/* =====================================================
   TheEnd — Stylesheet
   Cinema-inspired dark theme
   ===================================================== */

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

:root {
  --bg: #0a0a0a;
  --bg-elevated: #161616;
  --bg-hover: #1f1f1f;
  --border: #2a2a2a;
  --text: #f5f5f5;
  --text-muted: #999;
  --text-faint: #666;
  --accent: #e50914;
  --accent-hover: #f6121d;
  --success: #46d369;
  --radius: 8px;
  --radius-lg: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ============ LOGIN ============ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
}

.logo {
  font-size: 36px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.logo-small {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.dot { color: var(--accent); }

.tagline {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 2rem;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover:not(.active) { color: var(--text); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  padding: 12px 14px;
  font-family: inherit;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 60px; }

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  padding: 12px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }

.error-msg {
  color: var(--accent);
  font-size: 13px;
  text-align: center;
  margin-top: 8px;
  min-height: 18px;
}

/* ============ APP HEADER ============ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

/* ============ SEARCH ============ */
.search-bar {
  display: flex;
  gap: 8px;
  padding: 1rem 1.25rem 0.5rem;
}

.search-bar input { margin: 0; }
.search-bar .btn-primary { width: auto; padding: 12px 20px; }

#search-results {
  padding: 0 1.25rem;
}

.search-result {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  align-items: center;
}

.search-result img, .search-result .no-poster {
  width: 50px;
  height: 75px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-hover);
}

.search-result-info { flex: 1; min-width: 0; }
.search-result-info p { margin: 0; }
.search-result-title { font-size: 14px; font-weight: 500; }
.search-result-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.search-result-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.btn-compact {
  width: auto;
  font-size: 12px;
  padding: 6px 12px;
  white-space: nowrap;
}

/* ============ NAV TABS ============ */
.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  overflow-x: auto;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.15s;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { background: var(--bg-elevated); color: var(--text); }

/* ============ LIBRARY ============ */
#library { padding: 0 1.25rem 2rem; }

.empty-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 3rem 1rem;
}

.library-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.library-item img, .library-item .no-poster {
  width: 70px;
  height: 105px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-hover);
}

.no-poster {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-faint);
  text-align: center;
}

.library-item-body { flex: 1; min-width: 0; }
.library-item-title { font-size: 15px; font-weight: 500; margin: 0 0 2px; }
.library-item-meta { font-size: 12px; color: var(--text-muted); margin: 0 0 8px; }

.progress-row {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 0;
  flex-wrap: wrap;
}

.progress-row input[type="number"] {
  width: 60px;
  padding: 6px 8px;
  font-size: 13px;
  margin: 0;
}

.progress-row select, .library-item-body textarea {
  font-size: 12px;
  padding: 6px 8px;
  margin: 4px 0 0;
}

.actions-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.actions-row button {
  font-size: 12px;
  padding: 6px 12px;
}

.btn-success { background: var(--success); color: #003812; }
.btn-success:hover { background: #5ee082; }

.review-text {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin: 4px 0 0;
}

.companions-text {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.rating-display {
  display: inline-flex;
  align-items: center;
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
}

/* ============ MODAL ============ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.modal-content p.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.modal-actions button { width: auto; padding: 10px 16px; }

label.field-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============ MOBILE ============ */
@media (max-width: 480px) {
  .login-box { padding: 2rem 1.5rem; }
  .search-bar { flex-direction: column; }
  .search-bar .btn-primary { width: 100%; }
  .library-item img, .library-item .no-poster { width: 60px; height: 90px; }
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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