/* Light mode variables */
:root {
  --background-color: linear-gradient(to bottom, #a6c1ee, #fbc2eb);
  --text-color: #222;
  --secondary-text-color: #555;
  --container-bg: rgba(255, 255, 255, 0.8);
  --card-bg: rgba(255, 255, 255, 0.75);
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-border: #d1d8e0;
  --input-focus: #6b48ff;
  --button-bg: linear-gradient(135deg, rgba(107, 72, 255, 0.8), rgba(0, 212, 255, 0.8));
  --button-hover-bg: linear-gradient(135deg, rgba(0, 212, 255, 0.9), rgba(107, 72, 255, 0.9));
  --button-text: #ffffff;
  --shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  --glow-color: rgba(107, 72, 255, 0.7);
  --scrollbar-track: #e0e0e0;
  --scrollbar-thumb: #6b48ff;
  --scrollbar-thumb-hover: #00d4ff;
  --category-bg: rgba(255, 255, 255, 0.6);
  --category-hover: rgba(107, 72, 255, 0.15);
  --category-active: linear-gradient(135deg, rgba(107, 72, 255, 0.9), rgba(0, 212, 255, 0.9));
}

/* Dark mode variables */
body.dark-mode {
  --background-color: linear-gradient(to bottom, #1a1a2e, #16213e);
  --text-color: #f0f0f0;
  --secondary-text-color: #d0d0d0;
  --container-bg: rgba(0, 0, 0, 0.6);
  --card-bg: rgba(44, 44, 44, 0.65);
  --input-bg: rgba(58, 58, 58, 0.8);
  --input-border: #4a4a4a;
  --input-focus: #ff6f61;
  --button-bg: linear-gradient(135deg, rgba(42, 82, 152, 0.8), rgba(255, 111, 97, 0.8));
  --button-hover-bg: linear-gradient(135deg, rgba(255, 111, 97, 0.9), rgba(42, 82, 152, 0.9));
  --button-text: #f0f0f0;
  --shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  --glow-color: rgba(255, 111, 97, 0.7);
  --scrollbar-track: #2a2a2a;
  --scrollbar-thumb: #2a5298;
  --scrollbar-thumb-hover: #ff6f61;
  --category-bg: rgba(44, 44, 44, 0.5);
  --category-hover: rgba(255, 111, 97, 0.15);
  --category-active: linear-gradient(135deg, rgba(255, 111, 97, 0.9), rgba(42, 82, 152, 0.9));
}

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

body {
  font-family: "Poppins", sans-serif;
  min-height: 100vh;
  padding: 20px;
  background: var(--background-color);
  color: var(--text-color);
  transition: background-color 0.5s ease, color 0.5s ease;
}

.container {
  background: var(--container-bg);
  padding: 20px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  backdrop-filter: blur(10px);
  transition: background-color 0.5s ease;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.header-container h2 {
    color: var(--text-color);
    font-size: 2rem;
    transition: text-shadow 0.3s ease;
}

.header-container h2:hover {
    text-shadow: 0 0 5px var(--glow-color), 0 0 15px var(--glow-color);
}

/* Header buttons container */
.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-btn {
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.header-btn:hover {
    background: var(--button-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Toggle container for Movies/TV Shows */
.toggle-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.toggle-btn {
    padding: 10px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--category-bg);
    color: var(--text-color);
    border: 2px solid var(--input-border);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-btn:hover {
    background: var(--category-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.toggle-btn.active {
    background: var(--category-active);
    color: var(--button-text);
    border-color: transparent;
    box-shadow: 0 0 15px var(--glow-color);
}

.search-container {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

#search-input {
  flex-grow: 1;
  min-width: 200px;
  padding: 12px 16px;
  font-size: 1.1rem;
  border: 2px solid var(--input-border);
  border-radius: 8px;
  outline: none;
  background: var(--input-bg);
  color: var(--text-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#search-input:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 8px var(--input-focus);
}

#search-button,
#theme-toggle {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--button-bg);
  color: var(--button-text);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

#search-button:hover,
#theme-toggle:hover {
  background: var(--button-hover-bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#search-button:active,
#theme-toggle:active {
  transform: translateY(0);
}

/* Loading Spinner */
.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--input-border);
  border-top: 4px solid var(--input-focus);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Categories Section */
.categories-section {
    margin-bottom: 30px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.category-btn {
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    background: var(--category-bg);
    color: var(--text-color);
    border: 2px solid var(--input-border);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.category-btn:hover {
    background: var(--category-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-color: var(--input-focus);
}

.category-btn.active {
    background: var(--category-active);
    color: var(--button-text);
    border-color: transparent;
    box-shadow: 0 0 15px var(--glow-color);
    transform: scale(1.05);
}

.category-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Movie Grid and Card Styles */
.results-section {
    margin-top: 20px;
}

.section-title {
    color: var(--text-color);
    margin-bottom: 15px;
    font-size: 1.5rem;
    text-align: left;
}

.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

@media (min-width: 768px) {
    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

@media (max-width: 480px) {
    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }
    
    .category-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

.movie-card {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.movie-card:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 8px 25px var(--glow-color);
}

.movie-card img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

@media (max-width: 480px) {
    .movie-card img {
        height: 250px;
    }
}

.movie-info {
    padding: 15px;
    text-align: left;
}

.movie-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-info span {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--secondary-text-color);
}

/* Rating colors */
.movie-info span.green { color: #2ecc71; }
.movie-info span.orange { color: #e67e22; }
.movie-info span.red { color: #e74c3c; }

/* Modal (Popup) Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--container-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    color: var(--text-color);
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-color);
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    transform: scale(1.2);
    color: var(--glow-color);
}

#modal-body {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

#modal-body img {
    width: 300px;
    height: auto;
    border-radius: 10px;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.modal-details {
    flex: 1;
    min-width: 250px;
}

.modal-details h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    line-height: 1.2;
}

.modal-details p {
    font-size: 1rem;
    color: var(--text-color);
    opacity: 0.9;
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-details .info-item {
    font-size: 1rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.modal-details .info-item strong {
    color: var(--text-color);
}

/* Watchlist button in modal */
.watchlist-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.8), rgba(192, 57, 43, 0.8));
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.watchlist-btn:hover {
    background: linear-gradient(135deg, rgba(192, 57, 43, 0.9), rgba(231, 76, 60, 0.9));
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.watchlist-btn.in-watchlist {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.8), rgba(39, 174, 96, 0.8));
}

.watchlist-btn.in-watchlist:hover {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.9), rgba(46, 204, 113, 0.9));
}

.modal-trailer {
    margin-top: 20px;
    width: 100%;
}

.modal-trailer h3 {
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.modal-trailer iframe {
    width: 100%;
    height: 315px;
    border: none;
    border-radius: 8px;
}

/* --- CodePen Slider Styles --- */

.slider-container {
  width: 100%;
  max-width: 600px;
  height: 350px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.slider-container .slide {
  width: 100%;
  height: 100%;
  position: relative;
}

.slider-container .slide .item {
  width: 200px;
  height: 300px;
  position: absolute;
  top: 50%;
  transform: translate(0, -50%);
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  background-position: 50% 50%;
  background-size: cover;
  display: inline-block;
  transition: all 0.5s ease-in-out;
  z-index: 1;
}

/* Item positioning */
.slide .item:nth-child(1),
.slide .item:nth-child(2) {
  top: 0;
  left: 0;
  transform: translate(0, 0);
  border-radius: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.slide .item:nth-child(3) {
  left: 50%;
  z-index: 3;
}
.slide .item:nth-child(4) {
  left: calc(50% + 110px);
  z-index: 4;
}
.slide .item:nth-child(5) {
  left: calc(50% + 220px);
  z-index: 5;
}
.slide .item:nth-child(n + 6) {
  left: calc(50% + 330px);
  opacity: 0;
}

/* Content inside the item */
.item .content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 20px;
  text-align: left;
  color: #eee;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
  border-radius: 0 0 10px 10px;
  transform: translateY(50px);
  opacity: 0;
  transition: all 0.5s ease;
  z-index: 3;
}

.item .content .name {
  font-size: 1.5rem;
  font-weight: bold;
}
.item .content .des {
  font-size: 0.9rem;
  margin-top: 5px;
}

/* Show content only for the active item */
.slide .item:nth-child(2) .content {
  display: block;
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.3s;
}

/* Slider buttons */
.slider-container .button {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 15px;
}

.slider-container .button button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
  background: var(--button-bg);
  color: var(--button-text);
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.slider-container .button button:hover {
  background: var(--button-hover-bg);
  transform: scale(1.1);
}

/* Adjust modal h3 margin */
.modal-cast h3,
.modal-similar h3 {
    margin-bottom: 15px;
}

/* Cast section in modal */
.modal-cast {
    margin-top: 30px;
    width: 100%;
}

/* Similar section in modal */
.modal-similar {
    margin-top: 30px;
    width: 100%;
}

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

/* Responsive modal for small screens */
@media (max-width: 768px) {
    .modal-content {
        padding: 20px;
    }
    
    #modal-body {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    #modal-body img {
        width: 100%;
        max-width: 300px;
    }
    
    .modal-details h2 {
        font-size: 1.8rem;
    }
    
    .modal-trailer iframe {
        height: 250px;
    }
    
    .header-buttons {
        flex-direction: row;
        width: 100%;
        justify-content: center;
    }
    
    .toggle-container {
        flex-wrap: wrap;
    }
    
    .slider-container {
        max-width: 100%;
        height: 300px;
    }
    
    .slider-container .slide .item {
        width: 150px;
        height: 225px;
    }
}

@media (max-width: 480px) {
    .header-container h2 {
        font-size: 1.5rem;
    }
    
    #search-input {
        font-size: 1rem;
    }
    
    .modal-details h2 {
        font-size: 1.5rem;
    }
    
    .modal-trailer iframe {
        height: 200px;
    }
    
    .header-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .toggle-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .slider-container {
        height: 250px;
    }
    
    .slider-container .slide .item {
        width: 120px;
        height: 180px;
    }
    
    .slider-container .button button {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* Scrollbar styling */
body::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 4px;
}

body::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

body::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Footer styles */
footer {
    text-align: center;
    margin-top: 20px;
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.blinking-heart {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}
/* Static Cast List Styles */
.static-cast-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: flex-start;
}

.static-cast-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    text-align: center;
}

.static-cast-item img {
    width: 100px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    margin-bottom: 5px;
}

.static-cast-info .name {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-color);
}

.static-cast-info .character {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
}
