/* --- BASE STYLES --- */
body {
  margin: 0;
  padding: 20px;
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: #0f0f0f;
  color: #e0e0e0;
}

/* --- LAYOUT --- */
.container {
  max-width: 650px;
  margin: 0 auto;
  background-color: #1a1a1a;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* --- TYPOGRAPHY --- */
h2 {
  text-align: center;
  color: #ffffff;
  margin-top: 0;
  margin-bottom: 5px;
  letter-spacing: 1px;
  font-weight: 700;
}

.subtitle {
  text-align: center;
  color: #888;
  font-size: 12px;
  margin-top: 0;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e74c3c;
}

/* --- FILTERS --- */
.filters-container {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 25px;
  background: linear-gradient(145deg, #1e1e1e, #222222);
  padding: 18px;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
}

.filter-group {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 150px;
}

.filter-group label {
  font-size: 11px;
  color: #888;
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- CUSTOM DROPDOWN (usato sia per Cinema che per Orario) --- */
.custom-dropdown {
  position: relative;
  width: 100%;
}

.dropdown-header {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #333;
  background-color: #161616;
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dropdown-header:hover {
  border-color: #555;
}

.custom-dropdown.open .dropdown-header {
  border-color: #e67e22;
  box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.15);
}

.dropdown-header::after {
  content: "";
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  margin-left: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  transition: transform 0.25s ease;
}

.custom-dropdown.open .dropdown-header::after {
  transform: rotate(180deg);
}

.dropdown-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background-color: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Scrollbar per il dropdown */
.dropdown-options::-webkit-scrollbar {
  width: 6px;
}

.dropdown-options::-webkit-scrollbar-track {
  background: transparent;
}

.dropdown-options::-webkit-scrollbar-thumb {
  background-color: #444;
  border-radius: 3px;
}

.custom-dropdown.open .dropdown-options {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background-color 0.15s;
  font-size: 13px;
  color: #ccc;
  user-select: none;
}

.dropdown-item:first-child {
  border-radius: 7px 7px 0 0;
}

.dropdown-item:last-child {
  border-radius: 0 0 7px 7px;
}

.dropdown-item:hover {
  background-color: #222;
}

/* Separatore visivo per item "Tutti" */
.dropdown-item:first-child {
  border-bottom: 1px solid #2a2a2a;
  font-weight: 600;
}

/* Stile per item selezionato (time dropdown, single-select) */
.dropdown-item.selected {
  background-color: rgba(230, 126, 34, 0.12);
  color: #e67e22;
  font-weight: 600;
}

/* Custom checkbox */
.dropdown-item input[type="checkbox"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #555;
  border-radius: 4px;
  background-color: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s ease;
  margin: 0;
}

.dropdown-item input[type="checkbox"]:checked {
  background-color: #e67e22;
  border-color: #e67e22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: 12px;
  background-position: center;
  background-repeat: no-repeat;
}

.dropdown-item label {
  cursor: pointer;
  font-weight: inherit;
  color: inherit;
  line-height: normal;
  margin: 0;
  flex-grow: 1;
  display: flex;
  align-items: center;
}

/* --- MOVIE CARD (Mobile Friendly) --- */
.movie-card {
  display: flex;
  flex-direction: row;
  gap: 20px;
  margin-bottom: 25px;
}

.movie-poster-container {
  flex-shrink: 0;
  width: 140px;
}

.movie-poster {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: block;
}

.movie-info {
  flex-grow: 1;
}

.movie-title {
  margin: 0 0 10px 0;
  color: #e67e22;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.movie-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
  transition: transform 0.1s;
  display: block;
  transform: translateY(-1px);
}

.movie-icon:hover {
  transform: scale(1.1);
}

.movie-desc {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: #999;
  line-height: 1.6;
  font-style: italic;
}

.movie-meta {
  margin: 0 0 4px 0;
  font-size: 13px;
  color: #bbb;
}

/* --- CINEMA BOX --- */
.cinemas-box {
  background-color: #1e1e1e;
  padding: 12px;
  border-radius: 8px;
  border-left: 3px solid #3498db;
  margin-top: 15px;
}

.cinemas-title {
  font-size: 13px;
  color: #e0e0e0;
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.cinema-item {
  font-size: 13px;
  color: #aaa;
  display: block;
  margin-bottom: 4px;
}

.cinema-link {
  color: #5dade2;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.cinema-link:hover {
  color: #3498db;
}

/* --- UTILITIES & FOOTER --- */
hr {
  border: 0;
  border-top: 1px solid #2a2a2a;
  margin-bottom: 25px;
}

.footer {
  margin-top: 40px;
  text-align: center;
  font-size: 12px;
  color: #7f8c8d;
  line-height: 1.6;
}

.footer a img {
  transition: opacity 0.2s;
  border-radius: 10px;
}

.footer a img:hover {
  opacity: 0.8;
}

/* --- EXCEPTION STYLES FOR STATE --- */
.empty-state {
  text-align: center;
  color: #e74c3c;
  font-weight: 600;
}

.loading-state {
  text-align: center;
  color: #888;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 500px) {
  .movie-card {
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
  }
  
  .movie-poster-container {
    width: 180px;
  }

  .movie-title {
    justify-content: center;
  }

  .cinemas-box {
    text-align: left;
  }
}
