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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  color: #fff;
  min-height: 100vh;
  padding: 1rem;
  position: relative;
  overflow-x: hidden;
  transition: background 0.5s ease;
}

/* Theme Variables */
body[data-theme="butter-yellow"] {
  background: linear-gradient(135deg, #dfd192 0%, #efd377 50%, #dec78d 100%);
  color: #2c2c2c;
}

body[data-theme="olive-green"] {
  background: linear-gradient(135deg, #556b2f 0%, #6b8e23 50%, #4a5d23 100%);
  color: #fff;
}

/* Theme-specific text colors */
body[data-theme="butter-yellow"] .container,
body[data-theme="butter-yellow"] .history-sidebar {
  color: #2c2c2c;
}

body[data-theme="butter-yellow"] .filter-group label,
body[data-theme="butter-yellow"] .movie-container p,
body[data-theme="butter-yellow"] .movie-container h2,
body[data-theme="butter-yellow"] .history-item-info h4,
body[data-theme="butter-yellow"] .history-item-info p {
  color: #2c2c2c;
}

body[data-theme="butter-yellow"] select,
body[data-theme="butter-yellow"] .history-toggle-btn {
  color: #2c2c2c;
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.2);
}

body[data-theme="butter-yellow"] select:hover,
body[data-theme="butter-yellow"] .history-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.3);
}

body[data-theme="butter-yellow"] .container {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

body[data-theme="butter-yellow"] .history-sidebar {
  background: #958b62;
}

body[data-theme="butter-yellow"] .loader p {
  color: #2c2c2c;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.header h1 {
  font-size: 2rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  flex: 1;
}

.header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Theme Switcher */
.theme-switcher {
  position: relative;
}

.theme-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.theme-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.theme-menu {
  position: absolute;
  top: 110%;
  right: 0;
  background: #1e1e1e;
  border-radius: 10px;
  padding: 0.5rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 180px;
  z-index: 100;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.theme-menu.active {
  display: flex;
}

.theme-option {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  text-align: left;
}

.theme-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(5px);
}

.theme-option.active {
  background: #e50914;
  border-color: #e50914;
}

/* History Toggle Button */
.history-toggle-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.history-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.history-count {
  background: #e50914;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

/* History Sidebar */
.history-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 350px;
  height: 100vh;
  background: #1e1e1e;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
  transition: right 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
  padding: 1.5rem;
}

.history-sidebar.active {
  right: 0;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.history-header h2 {
  font-size: 1.5rem;
}

.close-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: transform 0.2s ease;
}

.close-btn:hover {
  transform: rotate(90deg);
}

.history-actions {
  margin-bottom: 1rem;
}

.clear-btn {
  background: #e50914;
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.3s ease;
  width: 100%;
}

.clear-btn:hover {
  background: #b20710;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  display: flex;
  gap: 1rem;
  align-items: center;
  position: relative;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(229, 9, 20, 0.5);
  transform: translateX(-5px);
}

.history-item img {
  width: 60px;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
}

.history-item-info {
  flex: 1;
  text-align: left;
}

.history-item-info h4 {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
  color: #fff;
}

.history-item-info p {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.remove-history-btn {
  background: rgba(229, 9, 20, 0.8);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-history-btn:hover {
  background: #e50914;
  transform: scale(1.1);
}

.empty-message {
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  padding: 2rem;
  font-style: italic;
}

/* Container */
.container {
  max-width: 800px;
  margin: 2rem auto;
  background: rgba(30, 30, 30, 0.9);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.5s ease;
}

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

/* Filters */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  color: rgba(255, 255, 255, 0.9);
}

select {
  padding: 0.75rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

select:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

select:focus {
  outline: none;
  border-color: #e50914;
  background: rgba(255, 255, 255, 0.2);
}

select option {
  background: #1e1e1e;
  color: white;
}

/* Spin Button */
.spin-btn {
  background: linear-gradient(135deg, #e50914 0%, #b20710 100%);
  border: none;
  color: white;
  padding: 1rem 2.5rem;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 20px rgba(229, 9, 20, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 auto 2rem;
  width: fit-content;
}

.spin-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(229, 9, 20, 0.6);
}

.spin-btn:active {
  transform: translateY(-1px);
}

.spin-btn .btn-icon {
  font-size: 1.5rem;
  animation: rotate 2s linear infinite;
}

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

.spin-btn:hover .btn-icon {
  animation-duration: 0.5s;
}

/* Loader */
.loader {
  text-align: center;
  padding: 3rem;
  animation: fadeIn 0.3s ease;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(255, 255, 255, 0.1);
  border-top-color: #e50914;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.loader p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Error Message */
.error-message {
  background: rgba(229, 9, 20, 0.2);
  border: 2px solid #e50914;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
  color: #fff;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* Movie Container */
.movie-container {
  animation: slideUp 0.5s ease;
}

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

.movie-container h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.movie-container p {
  margin: 0.8rem 0;
  font-size: 1rem;
  line-height: 1.6;
}

.movie-container strong {
  color: rgba(255, 255, 255, 0.9);
}

.movie-container img {
  margin: 1.5rem auto;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-width: 300px;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.movie-container img:hover {
  transform: scale(1.05);
}

a.trailer-btn {
  background: linear-gradient(135deg, #e50914 0%, #b20710 100%);
  color: white;
  padding: 12px 25px;
  text-decoration: none;
  border-radius: 50px;
  display: inline-block;
  margin-top: 1rem;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(229, 9, 20, 0.4);
}

a.trailer-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(229, 9, 20, 0.6);
}

/* Watched Badge */
.watched-badge {
  display: inline-block;
  background: #4caf50;
  color: white;
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: normal;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* Action Buttons */
.action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.action-btn span {
  font-size: 1.2rem;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.share-btn:hover {
  background: rgba(33, 150, 243, 0.2);
  border-color: #2196f3;
}

.not-interested-btn:hover {
  background: rgba(244, 67, 54, 0.2);
  border-color: #f44336;
}

.watched-active {
  background: rgba(76, 175, 80, 0.2);
  border-color: #4caf50;
}

.watched-active:hover {
  background: rgba(76, 175, 80, 0.3);
}

.spin-again-btn:hover {
  background: rgba(229, 9, 20, 0.2);
  border-color: #e50914;
}

/* Share Modal */
.share-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.share-modal-content {
  background: #1e1e1e;
  border-radius: 20px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  animation: slideUp 0.3s ease;
}

.share-modal-content h3 {
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 1.5rem;
}

.share-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.share-option-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 1rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.share-option-btn span {
  font-size: 2rem;
}

.share-option-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-3px);
}

.close-share-btn {
  width: 100%;
  background: rgba(229, 9, 20, 0.8);
  border: none;
  color: white;
  padding: 0.8rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.close-share-btn:hover {
  background: #e50914;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 0.5rem;
  }

  .container {
    padding: 1.5rem;
    margin: 1rem auto;
  }

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

  .header h1 {
    font-size: 1.5rem;
  }

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

  .history-sidebar {
    width: 100%;
    right: -100%;
  }

  .spin-btn {
    width: 100%;
    padding: 1rem;
  }

  .movie-container h2 {
    font-size: 1.5rem;
  }

  .action-buttons {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.3rem;
  }

  .history-toggle-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .spin-btn {
    font-size: 1rem;
  }

  .action-buttons {
    grid-template-columns: 1fr;
  }

  .action-btn {
    padding: 0.7rem;
    font-size: 0.9rem;
  }
}
