@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: #121212;
  color: #e0e0e0;
}

#app {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #222;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo i {
  font-size: 2rem;
  color: #e50914;
}

.logo h1 {
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: -1px;
}

.search-container {
  display: flex;
  align-items: center;
  background-color: #1f1f1f;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  border: 1px solid #333;
  transition: border-color 0.3s;
  flex-grow: 1;
  max-width: 500px;
}

.search-container:focus-within {
  border-color: #e50914;
}

.search-container i {
  color: #777;
}

#searchInput {
  background: none;
  border: none;
  outline: none;
  color: #e0e0e0;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  margin-left: 0.75rem;
  width: 100%;
}

.status-message {
    text-align: center;
    font-size: 1.2rem;
    color: #888;
    margin: 4rem 0;
}

#movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.movie-card {
  background-color: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #2a2a2a;
}

.movie-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.movie-card img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
  background-color: #222;
}

.movie-info {
  padding: 1rem;
}

.movie-info h3 {
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #888;
}

.movie-meta .rating {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: #ffc107;
}

/* Modal Styles */
.modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
  padding: 1rem;
}

.modal-container.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: #1a1a1a;
  border-radius: 10px;
  position: relative;
  width: 95%;
  max-width: 900px;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.modal-container.show .modal-content {
  transform: scale(1);
}

.close-modal {
  position: absolute;
  top: 0.8rem;
  right: 1.2rem;
  background: none;
  border: none;
  font-size: 2.5rem;
  color: #aaa;
  cursor: pointer;
  transition: color 0.3s;
  z-index: 20;
}

.close-modal:hover {
  color: #fff;
}

#modal-body {
  max-height: 90vh;
  overflow-y: auto;
}

.modal-details-view {
  display: flex;
  gap: 2rem;
  padding: 2.5rem;
}

.modal-poster img {
  width: 250px;
  height: 375px;
  object-fit: cover;
  border-radius: 8px;
  background-color: #222;
}

.modal-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.modal-details h2 {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  color: #aaa;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.modal-meta .rating {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #ffc107;
}

.modal-synopsis {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  color: #bbb;
  flex-grow: 1;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stream-btn, .download-btn {
  display: inline-block;
  background-color: #e50914;
  color: #fff;
  padding: 0.8rem 1.8rem;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1rem;
  font-family: 'Poppins', sans-serif;
  transition: background-color 0.3s;
  border: none;
  cursor: pointer;
}
.download-btn {
  background-color: #333;
}

.stream-btn:hover { background-color: #f6121D; }
.download-btn:hover { background-color: #444; }

.stream-btn i, .download-btn i {
  margin-right: 0.5rem;
}

/* Player View */
.player-view {
  background-color: #000;
  width: 100%;
  height: 100%;
  display: none; /* Hidden by default */
  flex-direction: column;
}

#video-player {
  width: 100%;
  height: 100%;
  max-height: 90vh; /* Match modal body */
  background: #000;
}

#video-player:focus { outline: none; }

.stream-status {
  padding: 1rem;
  background-color: rgba(0,0,0,0.5);
  text-align: center;
  font-size: 0.9rem;
  color: #ccc;
  width: 100%;
}

.stream-status .fa-spin { margin-right: 0.5rem; }

/* Responsive */
@media (max-width: 768px) {
  #app { padding: 1rem; }
  .modal-details-view { flex-direction: column; text-align: center; padding: 1.5rem;}
  .modal-poster { align-self: center; }
  .modal-poster img { width: 200px; height: 300px; margin-bottom: 1rem; }
  .modal-details h2 { font-size: 2rem; }
  .modal-meta, .action-buttons { justify-content: center; }
}