/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */

:root {
  /* Colors - centralized for easy theming */
  --color-link: #2563eb; /* blue-600 */
  --color-link-hover: #1e40af; /* blue-800 */
  --color-text: #374151; /* gray-700 */
  --color-text-dark: #111827; /* gray-900 */
  --color-text-light: #6b7280; /* gray-500 */
  --color-nav-link: #374151; /* gray-700 */
  --color-nav-link-hover: #1e40af; /* blue-800 */
  --color-bg-gray-50: #f9fafb;
  --color-bg-gray-100: #f3f4f6;
  --color-bg-gray-200: #e5e7eb;
  --color-border-gray: #d1d5db; /* gray-300 */
}

/* ============================================
   Base Styles (Minimal Global Styles)
   ============================================ */

/* Prevent horizontal scrolling */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

/* Base typography - minimal, let Tailwind handle most styling */
p {
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 1rem;
  line-height: 1.6;
}

ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

ul {
  list-style-type: disc;
}

ol {
  list-style-type: decimal;
}

li {
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

strong {
  font-weight: 600;
  color: var(--color-text-dark);
}

em {
  font-style: italic;
}

code {
  background-color: var(--color-bg-gray-100);
  color: #1f2937;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

blockquote {
  border-left: 4px solid var(--color-border-gray);
  padding-left: 1rem;
  font-style: italic;
  color: var(--color-text-light);
  margin: 1rem 0;
}

/* ============================================
   Layout Components
   ============================================ */

/* Poster sidebar - responsive styling */
#poster-sidebar {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#poster-sidebar img {
  width: 100%;
  max-width: 200px;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

@media (min-width: 640px) {
  #poster-sidebar {
    justify-content: flex-start;
    align-items: flex-start;
  }
  
  #poster-sidebar img {
    max-width: 100%;
    margin: 0;
  }
}

/* Main content area - prevent horizontal expansion */
#content,
main#content {
  max-width: 100%;
  width: 100%;
  min-width: 0;
}

/* Main wrapper - prevent horizontal expansion */
#main-wrapper {
  max-width: 100%;
  min-width: 0;
}

/* Main container - prevent horizontal expansion on mobile */
@media (max-width: 1023px) {
  .max-w-7xl {
    max-width: 100vw;
    overflow-x: hidden;
  }
}

/* ============================================
   Link Styles (Opt-in System)
   ============================================ */

/* Default content links - OPT-IN by adding .content-link class */
/* This allows flexibility - links without this class won't be styled */
.content-link {
  color: var(--color-link);
  text-decoration: underline;
}

.content-link:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

/* If you want ALL links in content areas to have default styling, uncomment below */
/* This is more aggressive but matches your current behavior */
/*
.content a:not([class*="no-link"]),
#content a:not([class*="no-link"]),
main a:not([class*="no-link"]) {
  color: var(--color-link);
  text-decoration: underline;
}

.content a:not([class*="no-link"]):hover,
#content a:not([class*="no-link"]):hover,
main a:not([class*="no-link"]):hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}
*/

/* ============================================
   Component Styles (Reusable Components)
   ============================================ */

/* Genre pills - for individual movie pages */
.genre-pill {
  color: #ffffff;
  text-decoration: none;
}

.genre-pill:hover {
  color: #ffffff;
}

/* Movie listing genre links - match nav link styling */
.movie-genre-link {
  color: #4b5563; /* text-gray-600 - match tagline color */
  text-decoration: none;
  font-weight: 400;
}

.movie-genre-link:hover {
  color: var(--color-nav-link-hover);
  text-decoration: none;
}

/* Navigation components */
.nav-logo {
  color: var(--color-nav-link-hover);
  text-decoration: none;
  font-weight: 700;
  line-height: 1.2;
}

.nav-logo:hover {
  color: var(--color-nav-link-hover);
  font-weight: 700;
}

.nav-links-container a,
.nav-links-container button,
.nav-dropdown-button {
  color: var(--color-nav-link);
  text-decoration: none;
  font-weight: 400;
  line-height: 1.2;
}

.nav-links-container a:hover,
.nav-links-container button:hover,
.nav-dropdown-button:hover {
  color: var(--color-nav-link-hover);
}

.nav-links-container a.nav-active {
  font-weight: 400;
}

#mobile-menu a {
  color: var(--color-nav-link);
  text-decoration: none;
  font-weight: 400;
  border-radius: 0.375rem;
  transition: background-color 0.2s;
}

#mobile-menu a:hover {
  background-color: var(--color-bg-gray-50);
  color: var(--color-nav-link-hover);
}

/* ============================================
   Utility Classes
   ============================================ */

.hidden-initially {
  display: none;
}

/* Navigation dropdown - remove margin from list items */
.nav-dropdown-menu ul li {
  margin-bottom: 0;
}

/* Sidebar list items - remove margins for tighter spacing */
.sidebar-section ul li {
  margin-bottom: 0;
}

/* ============================================
   Admin Tools Styles
   ============================================ */

.admin-layout {
  margin-top: 1rem;
}

.admin-form-container {
  width: 100%;
}

.admin-results {
  width: 100%;
  margin-top: 2rem;
}

.admin-results-container {
  background-color: #ffffff;
  min-height: 200px;
  padding: 1rem;
}

.admin-progress {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background-color: var(--color-bg-gray-100);
  border-radius: 0.25rem;
  font-weight: 600;
  font-size: 1rem;
}

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

.admin-form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--color-text-dark);
}

.admin-form-group input,
.admin-form-group textarea,
.admin-form-group select {
  width: 100%;
  padding: 0.5rem;
  font-family: inherit;
  border: 1px solid var(--color-border-gray);
  border-radius: 0.25rem;
  font-size: 1rem;
}

.admin-form-group small {
  display: block;
  margin-top: 0.25rem;
  color: var(--color-text-light);
  font-size: 0.875rem;
}

.admin-form-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  max-width: 100%;
}

.admin-form-row small {
  flex: 1;
  margin: 0;
  min-width: 0;
}

.admin-form-row .admin-btn {
  white-space: nowrap;
  flex-shrink: 0;
  max-width: fit-content;
}

.admin-btn {
  padding: 0.75rem 1.5rem;
  background-color: var(--color-link);
  color: #ffffff;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  width: auto;
  transition: background-color 0.2s;
}

.admin-btn:hover:not(:disabled) {
  background-color: #1d4ed8;
}

.admin-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.admin-result {
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 0.25rem;
  font-size: 1rem;
}

.admin-result strong {
  font-size: 1rem;
  font-weight: 600;
}

.admin-result.success {
  background-color: #d1fae5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}

.admin-result.error {
  background-color: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.admin-form p,
.admin-results-container strong,
.admin-results-container p {
  font-size: 1rem;
}

.admin-tools-section {
  width: 100%;
  padding: 2rem;
  background-color: #ffffff;
  border: 1px solid var(--color-bg-gray-200);
  border-radius: 0.5rem;
}

.admin-tools-section h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text-dark);
}

.admin-tools-section h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-dark);
}

.admin-tools-meta {
  margin-bottom: 1rem;
  color: var(--color-text-light);
  font-size: 0.95rem;
}

.admin-tools-note {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text-light);
}

.admin-message {
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 0.25rem;
  border: 1px solid;
}

.admin-message-success {
  background-color: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

.admin-message-error {
  background-color: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.admin-message-info {
  background-color: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}

.admin-btn-secondary {
  background-color: #6b7280;
  color: #ffffff;
}

.admin-btn-secondary:hover:not(:disabled) {
  background-color: #4b5563;
}

.admin-preview {
  margin-top: 1rem;
}

.admin-preview table {
  border-collapse: collapse;
}

.admin-preview table th {
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-preview .movie-checkbox {
  cursor: pointer;
}

.admin-preview tbody tr {
  transition: background-color 0.15s;
}

.admin-tools-section textarea {
  width: 100%;
  min-height: 200px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border-gray);
  border-radius: 0.25rem;
  background-color: var(--color-bg-gray-50);
}

@media (max-width: 768px) {
  .admin-form-row {
    flex-direction: column;
  }
  
  .admin-form-row .admin-btn {
    align-self: stretch;
    width: 100%;
  }

  .admin-tools-section {
    padding: 1rem;
  }
}

/* Range slider styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #2563eb; /* blue-600 */
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #1e40af; /* blue-800 */
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #2563eb; /* blue-600 */
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

input[type="range"]::-moz-range-thumb:hover {
  background: #1e40af; /* blue-800 */
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: #e5e7eb; /* gray-200 */
  border-radius: 4px;
}

input[type="range"]::-moz-range-track {
  height: 8px;
  background: #e5e7eb; /* gray-200 */
  border-radius: 4px;
}

/* Movie filters aside - visible on all screen sizes, responsive width handled by Tailwind classes */
.movie-filters-aside {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  min-width: 0; /* Allow flex item to shrink below content size */
}

#movie-filters-container {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  min-width: 0; /* Allow container to shrink */
}

#movie-filters-container input[type="number"],
#movie-filters-container input[type="text"] {
  max-width: 100%;
  box-sizing: border-box;
  width: 100%;
  min-width: 0; /* Allow inputs to shrink */
}

/* Prevent horizontal overflow on mobile when inputs are focused */
#movie-filters-container input[type="number"]:focus,
#movie-filters-container input[type="text"]:focus {
  width: 100%;
  min-width: 0; /* Ensure inputs stay within bounds when focused */
}

/* Prevent auto-zoom on mobile when focusing inputs (iOS Safari zooms if font-size < 16px) */
@media screen and (max-width: 768px) {
  #movie-filters-container input[type="number"],
  #movie-filters-container input[type="text"] {
    font-size: 16px; /* Prevent auto-zoom on mobile */
  }
  
  #search {
    font-size: 16px; /* Prevent auto-zoom on mobile */
  }
}
