/* ============================================
   HOW OLD WERE THEY IN...?
   Blockbuster Video Theme — Blue & Yellow
   ============================================ */

:root {
  --bg: #1a3a5c;
  --bg-card: #1f4470;
  --bg-inset: #163254;
  --bg-input: #163254;
  --blue: #5a9fd4;
  --blue-hover: #7ab4e0;
  --blue-dim: rgba(90, 159, 212, 0.12);
  --blue-deep: #0e3d6e;
  --blue-light: #a8c8e8;
  --yellow: #FFD100;
  --yellow-hover: #ffe033;
  --yellow-dim: rgba(255, 209, 0, 0.12);
  --yellow-border: rgba(255, 209, 0, 0.3);
  --text: #e8f0f8;
  --text-secondary: #a0bcda;
  --text-muted: #6889aa;
  --border: #2a5280;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.25);
  --green: #4ec97a;
  --tomato: #ff6044;
  --imdb-yellow: #f5c518;
  --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-serif: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'Outfit', 'Helvetica Neue', sans-serif;
}

/* --- Reset & Base --- */

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Layout --- */

.container {
  max-width: 620px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* --- Header --- */

header {
  text-align: center;
  margin-bottom: 2.5rem;
  animation: fadeIn 0.8s ease both;
}

header::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--yellow);
  margin: 1rem auto 0;
  border-radius: 2px;
}

h1 {
  font-family: var(--font-display);
  font-size: 3.5rem;
  letter-spacing: 3px;
  color: var(--blue);
  margin-bottom: 0.5rem;
  line-height: 1;
  text-transform: uppercase;
}

.subtitle {
  font-family: var(--font-serif);
  color: var(--text-secondary);
  font-size: 1.2rem;
  font-style: italic;
  font-weight: 600;
}

/* --- Form --- */

form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 4px solid var(--blue);
  border-radius: 12px;
  padding: 2rem;
  position: relative;
  z-index: 100;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.6s ease both;
  animation-delay: 0.15s;
}

.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.autocomplete-wrapper {
  position: relative;
}

.form-group:nth-child(2) .autocomplete-wrapper {
  z-index: 20;
}

.form-group:nth-child(3) .autocomplete-wrapper {
  z-index: 10;
}

input[type="text"] {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
  background: var(--bg-card);
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

/* --- Media Type Toggle --- */

.media-type-toggle {
  display: flex;
  gap: 0.5rem;
}

.toggle-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  background: transparent;
  border: 2px solid var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.toggle-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 600;
}

/* --- Autocomplete Suggestions --- */

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 4px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: var(--shadow-lg);
}

.suggestions.active {
  display: block;
}

.suggestion-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s;
}

.suggestion-item:first-child {
  border-radius: 10px 10px 0 0;
}

.suggestion-item:last-child {
  border-radius: 0 0 10px 10px;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
  background: var(--bg-inset);
}

.suggestion-item img {
  width: 40px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 0.75rem;
  background: var(--bg-inset);
  transition: transform 0.2s;
}

#actor-suggestions .suggestion-item img,
#media-suggestions .suggestion-item img {
  cursor: pointer;
}

#actor-suggestions .suggestion-item img:hover,
#media-suggestions .suggestion-item img:hover {
  transform: scale(1.08);
}

.suggestion-item .info {
  flex: 1;
}

.suggestion-item .name {
  font-weight: 500;
  color: var(--text);
}

.suggestion-item .year {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.suggestion-item .character {
  color: var(--blue);
  font-size: 0.8rem;
  font-style: italic;
}

.suggestion-item .episode-count {
  color: var(--green);
  font-size: 0.8rem;
}

/* --- Form Buttons --- */

.form-buttons {
  display: flex;
  gap: 0.5rem;
}

button[type="submit"] {
  flex: 1;
  padding: 1rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 2px;
  color: #0e2a47;
  background: var(--yellow);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-transform: uppercase;
  box-shadow: 0 2px 12px rgba(255, 209, 0, 0.25);
}

button[type="submit"]:hover {
  background: var(--yellow-hover);
}

button[type="submit"]:active {
  transform: scale(0.98);
}

button[type="submit"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.clear-btn {
  padding: 1rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* --- Loading --- */

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

/* --- Error --- */

.error {
  background: rgba(255, 96, 68, 0.1);
  border: 1px solid rgba(255, 96, 68, 0.25);
  color: var(--tomato);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.95rem;
}

/* --- Results --- */

.result {
  margin-top: 2rem;
  animation: slideUp 0.4s ease both;
  position: relative;
  z-index: 1;
}

.result-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

/* --- Answer Statement --- */

.answer-statement {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 400;
  text-align: center;
  margin-bottom: 1.25rem;
  line-height: 1.5;
  color: var(--text);
}

.answer-statement .age-highlight {
  font-family: var(--font-display);
  color: var(--blue);
  font-size: 1.7rem;
  letter-spacing: 1px;
}

.answer-statement .name-highlight {
  color: var(--text);
  font-weight: 600;
}

/* --- Actor & Media Info --- */

.actor-links {
  margin-top: 0.5rem;
}

.actor-info,
.media-info {
  display: flex;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.actor-info img,
.media-info img {
  border-radius: 6px;
  margin-right: 1rem;
  background: var(--bg-inset);
}

.actor-info img {
  width: 56px;
  height: 84px;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.3s;
}

.actor-info img:hover {
  transform: scale(1.05);
}

.media-info img {
  width: 56px;
  height: 84px;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.3s;
}

.media-info img:hover {
  transform: scale(1.05);
}

.actor-details h2,
.media-details h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
  color: var(--text);
}

.actor-details p,
.media-details p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

#actor-role {
  color: var(--blue);
  font-style: italic;
}

.media-extra {
  color: var(--green);
  font-size: 0.85rem;
}

/* --- Media Links --- */

.media-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  align-items: center;
}

.trailer-link {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: var(--blue);
  border-radius: 5px;
  text-decoration: none;
  transition: background-color 0.2s;
}

.trailer-link:hover {
  background: var(--blue-hover);
}

.trailer-link::before {
  content: '\25B6';
  margin-right: 0.35rem;
  font-size: 0.65rem;
}

.trailer-link-inline {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.2s;
}

.trailer-link-inline:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

.trailer-link-inline::before {
  content: '\25B6';
  margin-right: 0.2rem;
  font-size: 0.6rem;
}

.rt-link {
  color: var(--tomato);
  text-decoration: none;
  transition: color 0.2s;
}

.rt-link:hover {
  color: #ff5733;
  text-decoration: underline;
}

.rt-icon {
  margin-right: 0.2rem;
  font-size: 0.85rem;
  line-height: 1;
}

#rt-link {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  background: var(--tomato);
  color: white;
  border-radius: 5px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background 0.2s;
}

#rt-link:hover {
  background: #ff5733;
  text-decoration: none;
  color: white;
}

.imdb-link {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  background: var(--imdb-yellow);
  color: #000;
  border-radius: 5px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background 0.2s;
}

.imdb-link:hover {
  background: #e0b000;
  text-decoration: none;
  color: #000;
}

.wiki-link {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  line-height: 1.2rem;
  text-align: center;
  background: var(--bg-inset);
  color: var(--text-secondary);
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  text-decoration: none;
  margin-left: 0.4rem;
  vertical-align: middle;
  transition: background 0.2s, color 0.2s;
}

.wiki-link:hover {
  background: var(--blue);
  color: #fff;
  text-decoration: none;
}

.wiki-link-inline {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  background: var(--bg-inset);
  color: var(--text-secondary);
  border-radius: 5px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: all 0.2s;
}

.wiki-link-inline:hover {
  background: var(--border);
  text-decoration: none;
  color: var(--text);
}

/* --- Age Display --- */

.age-result {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.age-box {
  flex: 1;
  text-align: center;
  padding: 1rem 0.5rem;
  border-radius: 8px;
  background: var(--bg);
}

.age-box.filming {
  border: 2px solid var(--blue);
}

.age-box.last-appearance {
  border: 2px solid var(--green);
}

.age-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.age-value {
  display: block;
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1;
}

.filming .age-value {
  color: var(--blue);
}

.last-appearance .age-value {
  color: var(--green);
}

.age-note {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* --- Button Row --- */

.button-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.secondary-btn {
  flex: 1;
  padding: 0.7rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: #0e2a47;
  background: var(--yellow);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(255, 209, 0, 0.2);
}

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

.secondary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- Gallery --- */

.gallery-section {
  margin: 1.5rem 0;
}

.gallery-title {
  font-family: var(--font-body);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.gallery-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.gallery-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.3s, opacity 0.3s;
}

.gallery-image:hover {
  transform: scale(1.03);
  opacity: 0.85;
}

.gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Lightbox --- */

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(14, 42, 71, 0.94);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.lightbox.hidden {
  display: none;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  padding: 1rem;
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
  font-size: 2.5rem;
  line-height: 1;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  line-height: 1;
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  color: var(--yellow);
}

.lightbox-prev:hover,
.lightbox-next:hover {
  transform: translateY(-50%) scale(1.1);
}

/* --- Awards --- */

.awards-section {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--yellow-dim);
  border: 1px solid var(--yellow-border);
  border-radius: 8px;
}

.awards-title {
  font-family: var(--font-display);
  text-align: center;
  color: #ffd540;
  font-size: 1.2rem;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
}

.awards-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.award-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 209, 0, 0.15);
  border: 1px solid var(--yellow-border);
  border-radius: 5px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: #ffd540;
  font-weight: 500;
}

.award-badge.oscar {
  background: rgba(255, 209, 0, 0.25);
  border-color: rgba(255, 209, 0, 0.5);
}

.award-badge-icon {
  font-size: 1rem;
}

.awards-summary {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.awards-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
}

.no-awards {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Top Content & Cast Lists --- */

.section-title {
  font-family: var(--font-display);
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text);
  font-size: 1.4rem;
  letter-spacing: 1px;
}

.top-movies-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.top-movie-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.top-movie-item:hover {
  border-color: rgba(0, 73, 144, 0.25);
  box-shadow: var(--shadow-sm);
}

.top-movie-rank {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--blue);
  width: 2.5rem;
  text-align: center;
  flex-shrink: 0;
}

.top-movie-poster {
  width: 60px;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  margin: 0 1rem;
  background: var(--bg-inset);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.3s;
}

.top-movie-poster:hover {
  transform: scale(1.06);
}

.top-movie-info {
  flex: 1;
  min-width: 0;
}

.top-movie-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.top-movie-character {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 0.25rem;
}

.top-movie-revenue {
  font-size: 0.85rem;
  color: var(--green);
  font-weight: 500;
}

.top-movie-ages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.top-movie-age {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--blue);
}

.top-movie-age-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.posthumous-label {
  opacity: 0.7;
}

.cast-current-age {
  font-size: 0.85rem;
  color: var(--green);
  margin-bottom: 0.25rem;
}

.cast-item .top-movie-poster {
  cursor: pointer;
  transition: transform 0.3s;
}

.cast-item .top-movie-poster:hover {
  transform: scale(1.05);
}

.cast-name-link,
.media-title-link,
.album-title-link {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.cast-name-link:hover,
.media-title-link:hover,
.album-title-link:hover {
  color: var(--blue);
  text-decoration: underline;
}

.cast-name-link:visited,
.media-title-link:visited,
.album-title-link:visited {
  color: var(--text);
}

/* --- Photo Popup --- */

.photo-popup {
  position: fixed;
  z-index: 3000;
  pointer-events: none;
  padding: 4px;
  background: var(--bg-card);
  border-radius: 8px;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.photo-popup.visible {
  opacity: 1;
  transform: scale(1);
}

.photo-popup.hidden {
  display: none;
}

.photo-popup img {
  display: block;
  width: 200px;
  height: 300px;
  object-fit: cover;
  border-radius: 6px;
}

/* --- Footer --- */

footer {
  text-align: center;
  margin-top: 3rem;
  padding-bottom: 2rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

footer a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

.footer-notice {
  margin-top: 0.5rem;
  font-style: italic;
  opacity: 0.8;
}

h1 a,
h1 a:visited,
h1 a:hover,
h1 a:active {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

/* --- Utilities --- */

.hidden {
  display: none !important;
}

.disclaimer {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  margin-top: 0.5rem;
}

/* --- Animations --- */

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

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

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

/* --- Responsive --- */

@media (max-width: 480px) {
  h1 {
    font-size: 2.25rem;
    letter-spacing: 2px;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  form {
    padding: 1.5rem;
  }

  .answer-statement {
    font-size: 1.2rem;
  }

  .answer-statement .age-highlight {
    font-size: 1.45rem;
  }

  .age-result {
    flex-wrap: wrap;
  }

  .age-box {
    min-width: calc(50% - 0.375rem);
  }

  .age-value {
    font-size: 2rem;
  }

  .media-type-toggle {
    flex-direction: row;
  }

  .gallery-images {
    grid-template-columns: repeat(2, 1fr);
  }

  .photo-popup img {
    width: 150px;
    height: 225px;
  }
}
