/* Root Variables */
:root {
    --font-family-base: 'Arial', sans-serif;
    --text-color: #24292f;
    --text-muted: #6a737d;
    --background-color-muted: #f9f9f9;
    --border-color: #d1d5da;
    --primary-color: #0366d6;
    --hover-color: rgba(3, 102, 214, 0.1);
    --box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    --box-shadow-hover: 0 6px 14px rgba(0, 0, 0, 0.15);
}

/* Shared Styles */
.catalog-film-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.catalog-film-tags .film-tag {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background-color: var(--border-color);
    color: var(--text-color);
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.catalog-film-tags .film-tag:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.catalog-film-title {
    font-family: var(--font-family-base);
    font-size: 1.25rem;
    color: var(--text-color);
    margin: 0.5rem 0;
}

.catalog-film-description {
    font-family: var(--font-family-base);
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Grid View */
.catalog-film-container.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1.25rem;
    color: var(--text-color);
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .catalog-film-container.grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .catalog-film-container.grid {
        grid-template-columns: 1fr;
    }
}

.catalog-film-box {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--box-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.catalog-film-box:hover {
    transform: scale(1.02);
    box-shadow: var(--box-shadow-hover);
}

.catalog-film-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.catalog-film-details {
    padding: 0.75rem;
}

/* List View */
.catalog-film-container.list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    box-sizing: border-box;
}

.catalog-film-list-item {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1rem;
    align-items: flex-start;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--background-color-muted);
    padding: 1rem;
    box-sizing: border-box;
}

.catalog-film-image-wrapper {
    max-height: 320px;
    overflow: hidden;
    border-radius: 0.375rem;
}

.catalog-film-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.catalog-film-list-item img.catalog-film-image {
    width: 100%;
    height: 420px;
    max-height: 100%;
    object-fit: cover;
    object-position: top center;
    border-radius: 0.375rem;
    display: block;
}

.catalog-film-list-item .catalog-film-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
}

@media (max-width: 768px) {
    .catalog-film-list-item {
        grid-template-columns: 1fr;
    }

    .catalog-film-list-item img.catalog-film-image {
        height: auto;
        max-height: 320px;
    }
}

/* --- Film Guide Header Layout --- */
.eventive-film-guide-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.eventive-film-guide-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.eventive-film-guide-search {
  min-width: 220px;
  max-width: 420px;
}

.eventive-film-guide-controls {
  flex: 0 0 auto;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.eventive-film-guide-tags-filter {
  width: 100%;
  margin-top: 0.5rem;
}

/* Responsive: stack header row on mobile */
@media (max-width: 768px) {
  .eventive-film-guide-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .eventive-film-guide-search,
  .eventive-film-guide-controls {
    width: 100%;
    max-width: 100%;
  }
  .eventive-film-guide-tags-filter {
    margin-top: 0.5rem;
  }
}

/* ================================
   Search UI (sleek, modern, full-width)
   ================================ */
.eventive-film-guide-search {
  position: relative;
  width: 100%;
  max-width: 100%;
}

/* Base input */
#filmSearchInput {
  width: 100%;
  height: 44px;
  padding: 0.5rem 2.75rem 0.5rem 2.75rem; /* room for icon + clear */
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: #fff;
  color: var(--text-color);
  font: 500 0.95rem/1 var(--font-family-base);
  box-shadow: var(--box-shadow);
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

#filmSearchInput::placeholder {
  color: var(--text-muted);
  opacity: 0.9;
}

#filmSearchInput:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px var(--hover-color), var(--box-shadow-hover);
}

/* Leading icon */
.eventive-film-guide-search::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  opacity: 0.85;
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: center;
  /* Magnifying glass (inline SVG) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236a737d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

/* Trailing clear affordance (native where supported) */
#filmSearchInput::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 18px; width: 18px;
  margin-right: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E") no-repeat center;
  cursor: pointer;
}

/* Optional: show a spinner when searching/filtering */
.eventive-film-guide-search[data-loading="true"]::after {
  content: "";
  position: absolute;
  right: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(3, 102, 214, .2);
  border-top-color: var(--primary-color);
  animation: efg-spin 0.8s linear infinite;
}

@keyframes efg-spin { to { transform: translateY(-50%) rotate(360deg); } }

/* Compact layout tweaks when header stacks on mobile */
@media (max-width: 768px) {
  #filmSearchInput { height: 42px; }
}
