@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;400&display=swap');

:root {
  --primary-color: #22254b;
  --secondary-color: #373b69;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--primary-color);
  font-family: 'Poppins', sans-serif;
  margin: 0;
}

header {
  padding: 1rem;
  display: flex;
  justify-content: flex-end;
  background-color: var(--secondary-color);
}

.search {
  background-color: transparent;
  border: 2px solid var(--primary-color);
  border-radius: 50px;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  color: #fff;
}

.search::placeholder {
  color: #7378c5;
}

.search:focus {
  outline: none;
  background-color: var(--primary-color);
}

main {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.movie {
  width: 300px;
  margin: 1rem;
  background-color: var(--secondary-color);
  box-shadow: 0 4px 5px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  border-radius: 3px;
}

.movie img {
  width: 100%;
}

.movie-info {
  color: #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap:0.2rem;
  padding: 0.5rem 1rem 1rem;
  letter-spacing: 0.5px;
}

.movie-info h3 {
  margin-top: 0;
}

.movie-info span {
  background-color: var(--primary-color);
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-weight: bold;
}

.movie-info span.green {
  color: lightgreen;
}

.movie-info span.orange {
  color: orange;
}

.movie-info span.red {
  color: red;
}

.overview {
  background-color: #fff;
  padding: 2rem;
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  max-height: 100%;
  transform: translateY(101%);
  overflow-y: auto;
  transition: transform 0.3s ease-in;
}

.movie:hover .overview {
  transform: translateY(0);
}

#pagination {
    display: flex;
    justify-content: center;
    padding: 1rem;
}

#pagination button {
    background-color: var(--secondary-color);
    border: none;
    color: #fff;
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    cursor: pointer;
}

#pagination button:disabled {
    background-color: #444;
    cursor: not-allowed;
}

body.light-mode {
    background-color: #f4f4f4;
    color: #222;
}

body.light-mode header {
    background-color: #e0e0e0;
}

body.light-mode .movie {
    background-color: #fff;
}

body.light-mode .movie-info span {
    background-color: #eee;
}

#dark-mode-toggle {
    position:automaticallyhidden;
    top: 1rem;
    left: 1rem;
    background-color: var(--secondary-color);
    color:skyblue;
    border:cadetblue solid;
    padding: 0.5rem 1.5rem;
    cursor: pointer;
}

.movie {
    transition: transform 0.3s ease-in-out;
}

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

body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
    border-radius: 10px;
}

body::-webkit-scrollbar-track {
    background: var(--primary-color);
}

.search {
    transition: width 0.4s ease-in-out;
    width: 200px;
}

.search:focus {
    width: 300px;
}

#pagination button {
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

#pagination button:hover {
    background-color: #50597b;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .movie {
        width: 45%; /* Adjust the width for tablets */
    }
}

@media (max-width: 480px) {
    .movie {
        width: 100%; /* Full width on mobile devices */
        margin: 0.5rem 0; /* Adjust margin for smaller screens */
    }
}

@media (max-width: 768px) {
    .movie-info h3 {
        font-size: 1rem; /* Adjust title size */
    }

    .movie-info span {
        font-size: 0.875rem; /* Adjust rating size */
    }

    .overview {
        padding: 1rem; /* Reduce padding for overview */
    }
}

@media (max-width: 480px) {
    .movie-info h3 {
        font-size: 0.875rem;
    }

    .movie-info span {
        font-size: 0.75rem;
    }

    .search {
        width: 100%; /* Search bar full width on mobile */
    }
}

#pagination {
    flex-direction: column; /* Stack buttons on top of each other */
    align-items: center;
}

#pagination button {
    width: 100%; /* Full width buttons */
    margin-bottom: 0.5rem; /* Space between buttons */
}

@media (min-width: 481px) {
    #pagination {
        flex-direction: row; /* Horizontal layout on larger screens */
    }

    #pagination button {
        width: auto; /* Default width */
        margin-bottom: 0;
    }
}

.movie img {
    width: 100%; /* Ensure images are responsive */
    height: auto;
}

footer {
    text-align:automatically;
    padding: 1rem;
    color: blueviolet;
    font-size: 0.9rem;
    position:relative;
    width: 100%;
    bottom: 0;
    right: 70;
}

footer a {
    color: #7378c5;
    text-decoration: none;
    font-weight: bold;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    footer {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
}
