/* Actor Stats Hub - Modern CSS */

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

:root {
  /* Colors */
  --primary-color: #2c3e50;
  --secondary-color: #34495e;
  --accent-color: #e74c3c;
  --accent-light: #ff6b7a;
  --gold-color: #f39c12;
  --text-primary: #2c3e50;
  --text-secondary: #5a6c7d;
  --text-muted: #95a5a6;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --bg-card: #ffffff;
  --border-color: #dee2e6;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.08);

  /* Layout */
  --border-radius: 16px;
  --border-radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:
    "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New",
    monospace;
}

/* Base Styles */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--primary-color);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-light);
  transform: translateY(-1px);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
}

nav a {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}

nav a:hover {
  color: var(--accent-color);
  background: var(--bg-secondary);
  transform: none;
}

.hero {
  text-align: center;
  padding: 80px 20px;
  background: #f5f5f5;
}

.search-wrapper {
  position: relative; /* makes the dropdown absolute relative to this wrapper */
  display: inline-block; /* keeps width minimal */
}

#actor-search {
  width: 400px; /* wider input */
  padding: 15px 12px; /* taller input with more padding */
  font-size: 1.2rem; /* larger text for readability */
  border-radius: 10px; /* slightly more rounded corners */
  border: 1px solid #ccc;
  margin-top: 20px;
  box-sizing: border-box; /* ensures padding doesn’t break width */
}

#search-results {
  list-style: none;
  padding: 0;
  margin: 5px 0 0 0;
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  text-align: left;
  position: absolute; /* float over page */
  top: 100%; /* directly below the input */
  left: 0;
  z-index: 1000; /* ensures it stays above other content */
  display: none; /* hide when empty */
}

#search-results li {
  padding: 8px 10px;
}

#search-results li:hover {
  background: #f0f0f0;
}

#search-results a {
  text-decoration: none;
  color: #333;
  display: block;
}

/* Main Content */
main {
  min-height: 80vh;
  padding: 2rem 0;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto 2rem;
  color: var(--text-secondary);
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

/* Actors Grid */
.actors-section {
  margin: 4rem 0;
}

.actors-section h2 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.actors-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

.other-actors-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

.actor-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  position: relative;
  aspect-ratio: 3/4;
}

.actor-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}

.actor-link {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
  width: 100%;
  position: relative;
  z-index: 1;
}

.actor-image {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background: linear-gradient(45deg, var(--bg-secondary), var(--bg-tertiary));
}

.actor-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.actor-card:hover .actor-image img {
  transform: scale(1.03);
}

.actor-name-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.9),
    rgba(0, 0, 0, 0.7) 60%,
    transparent
  );
  padding: 3rem 1rem 0.75rem;
  z-index: 1;
}

.actor-name-overlay h3 {
  margin: 0;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.actor-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 2rem 1rem 1rem;
  color: white;
}

.actor-info h3 {
  margin: 0 0 0.5rem 0;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
}

.actor-rating {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius);
  margin: 0;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.rating-score {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-color);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Actor Detail Page */
.actor-detail {
  max-width: 1200px;
  margin: 0 auto;
}

.actor-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3rem;
  margin-bottom: 4rem;
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
}

.actor-portrait {
  position: relative;
  display: inline-block;
  max-width: 250px;
}

.actor-portrait img {
  width: 100%;
  max-width: 250px;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

.actor-details h1 {
  margin-bottom: 1rem;
}

.actor-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.overview-item {
  text-align: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius-sm);
}

.overview-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 0.25rem;
}

.overview-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Movies Lists */
.movies-section {
  margin: 3rem 0;
}

.movies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.movies-list {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
}

.movies-list h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-color);
}

.movie-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.movie-item:last-child {
  border-bottom: none;
}

.movie-title {
  color: var(--text-primary);
  font-weight: 500;
}

.movie-rating {
  color: var(--gold-color);
  font-weight: 600;
  font-family: var(--font-mono);
}

/* Rating Distribution */
.rating-distribution {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  margin: 2rem 0;
}

.distribution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.distribution-item {
  text-align: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius-sm);
}

.distribution-range {
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.distribution-count {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Genres Section */
.genres-section {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  margin: 2rem 0;
}

.genres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.genre-item {
  text-align: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius-sm);
}

.genre-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1rem;
}

/* Roles Distribution */
.roles-distribution {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  margin: 2rem 0;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.role-item {
  text-align: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius-sm);
}

.role-type {
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.role-percentage {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
  color: white;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-outline {
  background: transparent;
  color: var(--accent-color);
  border: 2px solid var(--accent-color);
}

.btn-outline:hover {
  background: var(--accent-color);
  color: white;
}

.view-all-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-color);
  font-weight: 500;
  font-size: 1.1rem;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--accent-color);
  border-radius: var(--border-radius);
  transition: var(--transition);
  margin: 2rem auto;
  display: block;
  text-align: center;
  max-width: fit-content;
}

.view-all-link:hover {
  background: var(--accent-color);
  color: white;
  transform: translateY(-2px);
}

/* Footer */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-align: center;
  padding: 3rem 0;
  margin-top: 4rem;
}

footer p {
  margin: 0;
  opacity: 0.9;
}

footer small {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .actor-header {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .actor-portrait {
    max-width: 200px;
    margin: 0 auto;
  }

  .movies-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  nav ul {
    gap: 1rem;
  }

  .hero {
    padding: 3rem 1.5rem;
    margin-bottom: 3rem;
  }

  #actor-search {
    width: 100%; /* full width */
    padding: 18px 14px; /* taller input with more padding */
    font-size: 1.4rem; /* bigger text for readability */
  }

  #search-results {
    width: 100%; /* match input width */
  }

  #search-results li {
    padding: 12px 14px; /* slightly bigger clickable area */
    font-size: 1.2rem; /* match bigger input text */
  }

  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .actors-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .other-actors-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .nav-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .actor-header {
    padding: 1.5rem;
    gap: 1.5rem;
  }

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

  .distribution-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .roles-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .genres-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 2rem 1rem;
  }

  .stats-overview {
    grid-template-columns: 1fr;
  }

  .actors-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .actor-header {
    padding: 1rem;
  }

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

  .roles-grid {
    grid-template-columns: 1fr;
  }

  .role-item {
    padding: 1rem 1.25rem;
  }

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

  .genre-name {
    font-size: 0.9rem;
  }

  .btn {
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
  }

  .actor-info h3 {
    font-size: 1rem;
  }

  .actor-name-overlay h3 {
    font-size: 0.9rem;
  }

  .rating-score {
    font-size: 1rem;
  }
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  border-top-color: var(--accent-color);
  animation: spin 1s ease-in-out infinite;
}

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

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus states */
*:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.movie-year {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.career-highlights {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  margin: 2rem 0;
}

.highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.highlight-item {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: var(--border-radius-sm);
}

.highlight-item h4 {
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.awards-section {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  margin: 2rem 0;
}

.awards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.award-item {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--border-radius-sm);
  text-align: center;
  border-left: 3px solid var(--gold-color);
}

.award-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.award-category {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.award-year {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.actor-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 3rem 0;
}

.actor-bio p {
  font-size: 1rem;
  line-height: 1.7;
  margin-top: 1rem;
}

/* Index Page Specific Styles */
.no-actors {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
}

.no-actors h3 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.features-section {
  margin: 4rem 0;
}

.features-section h2 {
  text-align: center;
  margin-bottom: 3rem;
  color: var(--text-primary);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.feature-card {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--border-radius);
  text-align: center;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: block;
}

.feature-card h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.feature-card p {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* All Actors Page Specific Styles */
.page-header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem 0;
}

.page-header h1 {
  margin-bottom: 1rem;
}

.page-header p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.actors-filters {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.filter-group select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 0.5rem 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.filter-group select:hover,
.filter-group select:focus {
  border-color: var(--accent-color);
  outline: none;
}

.actor-preview {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.actor-preview p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.pagination-info {
  text-align: center;
  margin: 3rem 0;
  color: var(--text-secondary);
}

/* Additional responsive breakpoints for actor layout */
@media (max-width: 768px) {
  .actor-nav {
    flex-direction: column;
    align-items: center;
  }

  .highlights-grid,
  .awards-grid {
    grid-template-columns: 1fr;
  }

  .actors-filters {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .filter-group {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .page-header {
    padding: 1rem 0;
  }

  .placeholder-image {
    height: 200px;
  }

  .placeholder-icon {
    font-size: 3rem;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --text-primary: #000000;
    --text-secondary: #333333;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --accent-color: #cc0000;
  }
}
