/* Base styles */
:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --bg-primary: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  --border-radius: 0.5rem;
  /* Added consistent border radius value */
}

.no-games {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50vh;
  font-size: 1.5rem;
  color: var(--text-secondary);
}

/* Search interface specific styling */
.search-interface {
  width: 100%;
  max-width: 42rem; /* Constrain search interface to reasonable width */
  margin: 0 auto; /* Center the search interface */
}

/* Search results container - full width for game grids */
.search-results-container {
  width: 100%;
  margin-top: 2rem;
}

/* Layout containers */
.container {
  width: 100%;
  max-width: 90rem; /* Increased from 72rem to accommodate 3 game cards */
  margin: 0 auto;
  padding: 1rem;
}

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

.flex-col-center {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.search-form {
  width: 100%;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  padding-right: 3rem;
  font-size: 1.125rem;
  border: 1px solid #e5e7eb;
  border-radius: var(--border-radius);
  /* Updated from 9999px */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 150ms ease-in-out;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.search-button {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  transition: color 150ms ease-in-out;
}

.search-button:hover {
  color: var(--text-primary);
}


.platform-radio-label {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background-color: var(--bg-primary);
  border-radius: var(--border-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 150ms ease-in-out;
  font-weight: 500;
  font-size: 0.875rem;
}

.platform-radio-label:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Style both radio and checkbox inputs consistently */
.platform-radio-label input[type="radio"],
.platform-radio-label input[type="checkbox"] {
  margin-right: 0.25rem;
}

/* Dropdowns */
.select-dropdown {
  padding: 0.5rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 150ms ease-in-out;
  font-weight: 500;
  font-size: 0.875rem;
}

.select-dropdown:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Dark themed select for special widgets */
.select-dark {
  display: inline-block;
  background-color: #111827;
  border: 1px solid #374151;
  border-radius: var(--border-radius);
  padding: 0.25rem 0.5rem;
  color: white;
  font-weight: 500;
  font-size: 0.875rem;
  min-width: 120px;
  transition: all 150ms ease-in-out;
}

.select-dark:focus {
  outline: none;
  ring: 2px;
  ring-color: #9333ea;
  border-color: transparent;
}

/* Dark themed input for special widgets */
.input-dark {
  display: inline-block;
  background-color: #111827;
  border: 1px solid #374151;
  border-radius: var(--border-radius);
  padding: 0.25rem 0.5rem;
  color: white;
  font-weight: 500;
  font-size: 0.875rem;
  width: 80px;
  transition: all 150ms ease-in-out;
}

.input-dark:focus {
  outline: none;
  ring: 2px;
  ring-color: #9333ea;
  border-color: transparent;
}

/* Game cards */
.games-grid-container {
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Custom scrollbar for webkit browsers */
.games-grid-container::-webkit-scrollbar {
  width: 8px;
}

.games-grid-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.games-grid-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.games-grid-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.25rem; /* Slightly increased gap for better visual separation */
  width: 100%;
  justify-items: center;
}

/* Single item centering for featured game */
.games-grid-container:has(.games-grid > :only-child),
.games-grid-container.single-game {
  max-height: none;
  overflow-y: visible;
}

.games-grid-container:has(.games-grid > :only-child) .games-grid,
.games-grid-container.single-game .games-grid {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

@media (min-width: 768px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Keep single item centered on larger screens */
  .games-grid-container:has(.games-grid > :only-child) .games-grid,
  .games-grid-container.single-game .games-grid {
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }
}

@media (min-width: 1024px) {
  .games-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  /* Keep single item centered on larger screens */
  .games-grid-container:has(.games-grid > :only-child) .games-grid,
  .games-grid-container.single-game .games-grid {
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }
}

.game-card {
  background-color: var(--bg-primary);
  padding: 1rem;
  border-radius: var(--border-radius);
  /* Already matching */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 150ms ease-in-out;
}

.game-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-title {
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.game-subtitle {
  color: var(--text-secondary);
}

.game-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.75rem;
}

.action-link {
  color: var(--primary-color);
  transition: color 150ms ease-in-out;
}

.action-link:hover {
  color: var(--primary-hover);
}

/* Game screenshot styles */
.game-screenshot-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem 0;
  min-height: 200px;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.game-screenshot {
  max-width: 100%;
  height: 200px;
  object-fit: contain;
  object-position: center;
  border-radius: var(--border-radius);
}

.screenshot-loading {
  border-radius: var(--border-radius);
}

/* ============================================
   BADGE SYSTEM
   ============================================ */

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-primary {
  background-color: #4f46e5;
  color: white;
}

.badge-secondary {
  background-color: #6b7280;
  color: #e5e7eb;
}

.badge-success {
  background-color: #10b981;
  color: white;
}

.badge-danger {
  background-color: #ef4444;
  color: white;
}

/* ============================================
   UNIFIED BUTTON SYSTEM
   ============================================ */

/* Base button styles - shared by all buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 150ms ease-in-out;
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus {
  outline: none;
  ring: 2px;
  ring-offset: 2px;
  ring-color: var(--primary-color);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button sizes */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.btn-md {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-icon {
  padding: 0.5rem;
  font-size: 1.1rem;
}

.btn-icon-lg {
  padding: 0.75rem;
  font-size: 1.25rem;
}

/* Button variants */
.btn-primary {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.btn-primary:hover:not(:disabled) {
  background-color: #2563eb;
  border-color: #2563eb;
}

.btn-secondary {
  background-color: white;
  color: #374151;
  border-color: #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #f9fafb;
  border-color: #9ca3af;
}

.btn-success {
  background-color: #10b981;
  color: white;
  border-color: #10b981;
}

.btn-success:hover:not(:disabled) {
  background-color: #059669;
  border-color: #059669;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
  border-color: #ef4444;
}

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
  border-color: #dc2626;
}

.btn-outline {
  background-color: transparent;
  color: var(--text-primary);
  border-color: #d1d5db;
}

.btn-outline:hover:not(:disabled) {
  background-color: #f9fafb;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-ghost {
  background-color: transparent;
  color: #6b7280;
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background-color: #f3f4f6;
  color: #1f2937;
}

/* Icon-only button styles */
.btn-icon-outline {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background-color: white;
  color: var(--text-primary);
  border: 1px solid #e5e7eb;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 150ms ease-in-out;
  font-size: 1.1rem;
}

.btn-icon-outline:hover:not(:disabled) {
  border-color: var(--primary-color);
  color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-icon-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon-outline.playable {
  border-color: #10b981;
  color: #10b981;
}

.btn-icon-outline.not-playable {
  border-color: #ef4444;
  color: #ef4444;
}

/* Platform button styles */
.btn-platform {
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--border-radius);
  transition: all 150ms ease-in-out;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-platform:hover:not(:disabled) {
  transform: scale(1.05);
}

.btn-platform.selected {
  background-color: #4f46e5;
  color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
  border-color: #4338ca;
}

.btn-platform:not(.selected) {
  background-color: #1f2937;
  color: #d1d5db;
  border-color: #374151;
}

.btn-platform:not(.selected):hover:not(:disabled) {
  background-color: #374151;
  color: white;
}

.btn-platform:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Timeline/Year navigation buttons */
.btn-year {
  padding: 0.5rem 1rem;
  font-weight: 700;
  font-size: 1.25rem;
  border-radius: var(--border-radius);
  transition: all 150ms ease-in-out;
  cursor: pointer;
  border: 1px solid #d1d5db;
}

.btn-year:not(:disabled) {
  background-color: white;
  color: black;
}

.btn-year:not(:disabled):hover {
  background-color: #f3f4f6;
  transform: scale(1.1);
}

.btn-year:disabled {
  background-color: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  border-color: #d1d5db;
}

/* Month button styles */
.btn-month {
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--border-radius);
  transition: all 150ms ease-in-out;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-month:hover:not(:disabled) {
  transform: scale(1.05);
}

.btn-month.selected {
  background-color: #111827;
  color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-month:not(.selected) {
  background-color: white;
  color: black;
  border-color: #d1d5db;
}

.btn-month:not(.selected):hover:not(:disabled) {
  background-color: #f3f4f6;
}

/* Gradient button (for special CTAs like Time Machine) */
.btn-gradient {
  width: 100%;
  background: linear-gradient(to right, #9333ea, #ec4899);
  color: white;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  border: none;
  transition: all 150ms ease-in-out;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-gradient:hover:not(:disabled) {
  background: linear-gradient(to right, #7e22ce, #db2777);
  transform: scale(1.02);
}

/* Legacy class names for backward compatibility */
.action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: var(--border-radius);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 150ms ease-in-out;
  font-size: 1.1rem;
}

.action-button:hover:not(:disabled) {
  border-color: var(--primary-color);
  color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-button.playable {
  border-color: #10b981;
  color: #10b981;
}

.action-button.not-playable {
  border-color: #ef4444;
  color: #ef4444;
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.modal-container {
  background-color: var(--bg-primary);
  border-radius: var(--border-radius);
  /* Already matching */
  width: 100%;
  max-width: 90rem; /* Increased to match container width */
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 1rem;
}

.modal-header {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-content {
  padding: 1rem;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-close {
  padding: 0.5rem;
  border-radius: var(--border-radius);
  /* Updated from 9999px */
  transition: background-color 150ms ease-in-out;
}

.modal-close:hover {
  background-color: #f3f4f6;
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background-color: #fff;
}

.logo {
  width: 300px;
  height: auto;
}

/* Platform filters container */
.platform-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0;   
  width: 100%;   
  max-width: 100%;   
}

/* Common styles for both radio and checkbox labels */
.platform-radio-label {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;  /* Slightly reduced horizontal padding */
  background-color: var(--bg-primary);
  border-radius: var(--border-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 150ms ease-in-out;
  white-space: nowrap;  /* Prevent label text from wrapping */
}

/* Style both radio and checkbox inputs consistently */
.platform-radio-label input[type="radio"],
.platform-radio-label input[type="checkbox"] {
  margin-right: 0.25rem;  /* Reduced from 0.5rem */
}

/* Hover effect for all labels */
.platform-radio-label:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Added media query for smaller screens */
@media (max-width: 768px) {
  .platform-filters {
    gap: 0.25rem;  /* Even smaller gap on mobile */
  }
  
  .platform-radio-label {
    padding: 0.4rem 0.6rem;  /* Smaller padding on mobile */
  }
}

/* Additional filters container */
.additional-filters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  width: 100%;
  margin-top: 1rem;
}

/* Style for the select dropdowns */
.select-dropdown {
  padding: 0.5rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 150ms ease-in-out;
  min-width: 200px; /* Ensure consistent width */
}

.select-dropdown:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Maintain responsiveness */
@media (max-width: 768px) {
  .additional-filters {
    flex-direction: column;
    align-items: center;
  }
  
  .select-dropdown {
    width: 100%;
    max-width: 300px;
  }
}

.random-game-card {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.random-game-card > div:first-child {
  width: 100%;
  display: flex;
  justify-content: center;
}

.random-game-card .game-card {
  width: 100%;
  max-width: 400px;
}

.random-game-card .game-screenshot-container {
  min-height: 250px;
  margin: 1rem 0;
}

.random-game-card .game-screenshot {
  height: 250px;
}

.random-game-card p {
  margin-top: 0.5rem;  /* Reduced vertical spacing */
}

@media (max-width: 768px) {
  .random-game-card > div:first-child {
    width: 100%;
  }
  
  .random-game-card .game-screenshot-container {
    min-height: 200px;
  }
  
  .random-game-card .game-screenshot {
    height: 200px;
  }
}

/* Inline Controls - Platform selector and filter toggle */
.inline-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  flex-wrap: nowrap;
  min-height: 3rem;
}

.platform-selector-inline {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  max-width: calc(100% - 110px); /* Adjusted for "Filters" text */
}

.platform-radio-label-inline {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background-color: var(--bg-primary);
  border-radius: var(--border-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 150ms ease-in-out;
  white-space: nowrap;
  font-weight: 500;
  font-size: 0.875rem;
}

.platform-radio-label-inline:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.platform-radio-label-inline.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.platform-radio-label-inline .platform-radio {
  margin-right: 0.4rem;
  flex-shrink: 0;
}

.platform-radio-label-inline .platform-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.filter-toggle-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background-color: var(--bg-primary);
  border: 1px solid #e5e7eb;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 150ms ease-in-out;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  flex-shrink: 0;
  min-width: 90px;
}

.filter-toggle-button:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.filter-toggle-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Inline controls buttons container */
.inline-controls-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Random game button styles */
.random-game-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background-color: var(--bg-primary);
  border: 1px solid #e5e7eb;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 150ms ease-in-out;
  color: var(--text-primary);
  flex-shrink: 0;
  font-weight: 500;
}

.random-game-button:hover:not(:disabled) {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.random-game-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.random-game-icon {
  display: flex;
  align-items: center;
  font-size: 1.2rem;
}

/* Small loading spinner for buttons */
.loading-spinner-small {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Random game header styles */
.random-game-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.random-game-header h2 {
  margin: 0;
}

.filter-toggle-text {
  font-weight: 500;
}

.filter-toggle-icon {
  display: flex;
  align-items: center;
  font-size: 1.1rem;
}

/* Responsive adjustments for inline controls */
@media (max-width: 768px) {
  .inline-controls {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .platform-selector-inline {
    gap: 0.25rem;
    max-width: 100%;
    flex-wrap: wrap;
  }
  
  .platform-radio-label-inline {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
  }
  
  .filter-toggle-button {
    padding: 0.6rem 1.2rem;
    min-width: auto;
  }
  
  .random-game-header {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* This Month page styles */
.thismonth-title {
}

.thismonth-footer-link {
  color: #2563eb;
  text-decoration: underline;
}

.thismonth-footer-link:hover {
  color: #1d4ed8;
}

/* Timeline Selector styles */
.timeline-year-display {
}

/* Masonry Grid styles */
.masonry-grid {
  column-count: auto;
  column-gap: 1.5rem;
  column-fill: balance;
}

.masonry-item {
  break-inside: avoid;
  page-break-inside: avoid;
}

@media (min-width: 640px) {
  .masonry-grid {
    column-count: 2;
  }
}

@media (min-width: 1024px) {
  .masonry-grid {
    column-count: 3;
  }
}

@media (min-width: 1536px) {
  .masonry-grid {
    column-count: 4;
  }
}

/* Collection Tile styles */
.collection-tile-name {
}

.collection-tile-scanline {
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 2px,
    transparent 2px,
    transparent 4px
  );
}