@import url('https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap');

:root {
  --neon: #ece9e7ff;
  --neon2: #00C3FF;
  --dark-bg: #181A20;
  --card-bg: rgba(30,30,40,0.95);
  --muted: #b9ffe9cc;
}

/* Basic layout */
* { box-sizing: border-box; }
html,body { height: 100%; }
body {
  background: var(--dark-bg);
  color: var(--neon);
  font-family: 'Roboto', sans-serif;
  margin: 0;
  padding-top: 68px; /* Must match .header's height! */
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  padding: 18px 14px 8px 14px;
  height: 68px;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  box-shadow: 0 4px 12px rgba(236,233,231,0.13);
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  margin-right: 10px;
  border: 1.2px solid var(--neon);
  object-fit: cover;
}

.header-text {
  flex: 1;
  min-width: 0;
}

.title {
  display: block;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 0 7px var(--neon);
  line-height: 1;
}

.title-neon { color: var(--neon); }

.subtitle {
  display: block;
  font-size: 11px;
  color: #B9FFE9;
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 2px;
}

.subtitle-neon { color: var(--neon2); }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--neon2);
  margin-left: 8px;
  font-size: 24px;
  padding: 6px;
}

/* Modal for categories */
.modal-category {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10,16,24,0.82);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.23s;
}
.modal-category.hidden {
  display: none !important;
  opacity: 0;
}
.modal-category-content {
  background: var(--card-bg);
  padding: 36px 22px 24px 22px;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  min-width: 280px;
  max-width: 92vw;
  min-height: 180px;
  position: relative;
  text-align: center;
}
.helo{
    display: flex;
    flex-direction: column;
}
.close-modal-btn {
  position: absolute;
  top: 14px;
  right: 12px;
  background: none;
  border: none;
  color: var(--neon2);
  font-size: 28px;
  cursor: pointer;
  outline: none;
}
.modal-category-title {
  margin-top: 0;
  font-size: 20px;
  color: var(--neon2);
  letter-spacing: 1px;
  font-weight: 700;
  margin-bottom: 18px;
}
.modal-category-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.modal-category-list li {
  margin-bottom: 8px;
}
.modal-category-list a {
  display: block;
  color: var(--neon);
  text-decoration: none;
  font-size: 17px;
  padding: 8px 0;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.modal-category-list a:hover,
.modal-category-list a:focus {
  color: var(--dark-bg);
  background: var(--neon2);
  outline: none;
}

.hidden { display: none !important; }

/* The rest of your CSS (movie grid, cards, etc.) goes below... */

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--dark-bg);
  border-radius: 10px;
  border: 1px solid rgba(0,255,198,0.08);
  padding: 10px;
  margin: 12px 14px 0 14px;
}

.search-bar input {
  background: transparent;
  color: var(--neon);
  font-weight: 700;
  font-size: 15px;
  border: none;
  outline: none;
  flex: 1;
  padding: 6px;
}

.search-icon { color: var(--neon2); margin-right: 8px; }

/* Movie grid
   Desktop: 4 columns
   Mobile (<=900px): 2 columns on all mobile screens per request
*/
.movie-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  padding: 12px;
  margin-top: 10px;
  align-items: start;
}

/* 2 columns for tablets & mobile (covers phones of all sizes) */
@media (max-width: 900px) {
  .movie-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 10px;
  }
}

/* Slightly tighter gap on very small phones */
@media (max-width: 420px) {
  .movie-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    padding: 8px;
  }
}

/* Movie card */
.movie-card {
  background: var(--card-bg);
  border-radius: 14px;
  min-height: 240px;
  position: relative;
  overflow: visible;
  box-shadow: 0 3px 10px rgba(236,233,231,0.06);
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  will-change: transform;
  padding-top: 12px;
}

@media (hover: hover) and (pointer: fine) {
  .movie-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  }
}

.movie-card img {
  width: 86%;
  max-width: 340px;
  height: 300px;
  object-fit: cover;
  display: block;
  margin: 0 auto;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
@media (max-width: 900px) {
  .movie-card img {
    width: 92%;
    max-width: none;
    height: 250px;
  }
}
@media (max-width: 420px) {
  .movie-card img {
    width: 94%;
    height: 250px;
  }
}
@media (max-width: 375px) {
  .movie-card img {
    width: 94%;
    height: 250px;
  }
}

/* Card content */
.card-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.movie-title.clickable {
  color: var(--neon);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 0;
  cursor: pointer;
  text-decoration: underline;
  line-height: 1.15;
  transition: color 0.16s ease;
  word-break: break-word;
}
.movie-title.clickable:hover { color: var(--neon2); }

.movie-subtitle {
  color: #B9FFE9;
  font-size: 13px;
  line-height: 1.15;
  font-weight: 600;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-date {
  color: #9aa6aaff;
  font-size: 12px;
  margin-top: auto;
}

.download-btn,
.share-btn {
  position: absolute;
  top: 10px;
  background: rgba(0,0,0,0.6);
  border-radius: 18px;
  padding: 8px;
  border: none;
  cursor: pointer;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.download-btn { right: 10px; }
.share-btn { right: 46px; }

.download-btn span,
.share-btn span {
  color: var(--neon2);
  font-size: 20px;
}

.empty-state {
  text-align: center;
  margin: 28px auto;
  color: var(--neon2);
  font-size: 18px;
  padding: 8px 14px;
  max-width: 720px;
}

.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10,16,24,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 120;
  padding: 20px;
}

.modal-card {
  width: 92vw;
  max-width: 520px;
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  overflow: hidden;
  position: relative;
}

.modal-hero {
  width: 100%;
  height: 220px;
  background: #111;
  position: relative;
}

.modal-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,0.45);
  border-radius: 14px;
  padding: 6px;
  border: none;
  cursor: pointer;
  z-index: 6;
}

.modal-content {
  max-height: 66vh;
  overflow-y: auto;
  align-items: center;
  padding: 18px;
  padding-bottom: 72px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-info {
  width: 100%;
  background: rgba(24,26,32,0.92);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(236,233,231,0.06);
  text-align: center;
}

.modal-title {
  color: var(--neon);
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 6px;
  text-shadow: 0 0 6px var(--neon);
}

.modal-subtitle {
  color: #B9FFE9;
  font-size: 14px;
  margin-bottom: 6px;
  font-weight: 600;
}

.modal-meta-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.modal-divider {
  width: 80%;
  height: 1px;
  background: rgba(0,255,198,0.08);
  margin: 8px auto;
  border-radius: 1px;
}

.modal-desc {
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}

.modal-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--dark-bg);
  border-radius: 12px;
  border: 1px solid var(--neon2);
  padding: 8px 16px;
  cursor: pointer;
  gap: 8px;
}

.modal-share span { color: var(--neon2); font-size: 20px; }

.modal-download {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: var(--neon2);
  border-radius: 20px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,195,255,0.12);
  cursor: pointer;
  border: none;
}

.modal-download span { color: var(--dark-bg); font-size: 20px; }

.hidden { display: none !important; }

/* Accessibility and focus */
.icon-btn:focus,
.download-btn:focus,
.share-btn:focus,
.modal-close:focus,
.modal-share:focus,
.modal-download:focus,
.movie-title.clickable:focus {
  outline: 3px solid rgba(0,195,255,0.18);
  outline-offset: 2px;
}

.movie-title.clickable,
.modal-title {
  word-wrap: break-word;
  hyphens: auto;
}

.movie-grid > .movie-card {
  display: flex;
  flex-direction: column;
}