* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --dark-bg: #0a0a0f;
  --card-bg: rgba(20, 20, 30, 0.7);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --blur-amount: 20px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  background: var(--dark-bg);
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(245, 87, 108, 0.15) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.site-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  backdrop-filter: blur(var(--blur-amount)) saturate(180%);
  background: rgba(10, 10, 15, 0.8);
  z-index: 100;
  gap: 16px;
  transition: all 0.3s ease;
}

.logo {
  font-weight: 700;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  transition: transform 0.3s ease;
}

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

.logo span {
  background: linear-gradient(135deg, #22c55e, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-emoji {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.5));
}

.main-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-secondary);
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.4);
  transform: translateY(-2px);
}

.nav-link.active {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.user-badge {
  font-size: 0.75rem;
  color: #9ca3af;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.user-badge strong {
  color: #e5e7eb;
}

.user-role {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #1f2937;
  background: #020617;
}

.page-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  width: 100%;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 4px 0 6px;
}

.section-sub {
  font-size: 0.9rem;
  color: #9ca3af;
  margin-bottom: 12px;
}

/* AUTH */

.auth-panel {
  margin-top: 12px;
  margin-bottom: 20px;
  padding: 24px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  font-size: 0.95rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  backdrop-filter: blur(var(--blur-amount));
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-col-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.auth-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.auth-row-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

label {
  font-size: 0.75rem;
  color: #9ca3af;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(10, 10, 15, 0.6);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(102, 126, 234, 0.6);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.helper {
  font-size: 0.7rem;
  color: #6b7280;
}

.btn {
  margin-top: 4px;
  padding: 10px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--primary-gradient);
  color: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.4);
}

.status {
  margin-top: 4px;
  font-size: 0.75rem;
  color: #6ee7b7;
}

.status.error {
  color: #f97373;
}

/* FILTERS + FILMS */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 20px;
  background: var(--card-bg);
  border-radius: 20px;
  border: 1px solid var(--card-border);
  font-size: 0.9rem;
  backdrop-filter: blur(var(--blur-amount));
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.filters-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.filters-search {
  min-width: 220px;
  flex: 1;
}

.filters-inline {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.filters-inline label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.filters-inline input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.film-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 6px;
}

.film-card {
  background: var(--card-bg);
  border-radius: 20px;
  border: 1px solid var(--card-border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(var(--blur-amount));
  position: relative;
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

.film-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.film-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(102, 126, 234, 0.6);
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
}

.film-card:hover::before {
  opacity: 0.1;
}

.film-image {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  transition: transform 0.4s ease;
}

.film-card:hover .film-image {
  transform: scale(1.05);
}

.film-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}

.film-title {
  font-weight: 600;
  font-size: 0.98rem;
}

.film-meta {
  font-size: 0.75rem;
  color: #9ca3af;
}

.film-tag {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #1f2937;
  color: #9ca3af;
  text-align: right;
}

/* крупные оценки на карточке */

.film-rating-big {
  display: flex;
  gap: 8px;
  margin: 2px 0 4px;
}

.rating-pill {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.rating-pill:hover {
  transform: scale(1.05);
  border-color: rgba(102, 126, 234, 0.4);
}

.rating-label {
  font-size: 0.7rem;
  color: #9ca3af;
}

.rating-value {
  font-size: 1.05rem;
  font-weight: 700;
}

.film-genres {
  font-size: 0.78rem;
  color: #9ca3af;
}

.film-rating-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.film-rating-row span:first-child {
  color: #9ca3af;
}

.film-desc {
  font-size: 0.78rem;
  color: #d1d5db;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

/* Full description on film page */
.film-desc.full {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}

.film-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.film-ratings-bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(102, 126, 234, 0.15);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  font-size: 0.72rem;
}

.chip {
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-secondary);
  white-space: nowrap;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.chip:hover {
  transform: translateY(-2px);
}

.chip.titki {
  border-color: #fb7185;
  color: #fecaca;
}

.chip.rating-gaveshka {
  border-color: #ef4444;
}

.chip.rating-manaino {
  border-color: #facc15;
}

.chip.rating-kaifarik {
  border-color: #22c55e;
}

/* FORM CARDS, HERO, ETC */

.form-card {
  background: var(--card-bg);
  border-radius: 20px;
  border: 1px solid var(--card-border);
  padding: 24px;
  font-size: 0.95rem;
  max-width: 800px;
  backdrop-filter: blur(var(--blur-amount));
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.form-row {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.hero-mini {
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid #1f2937;
  background: radial-gradient(circle at top, #1f2937, #020617);
  margin-bottom: 12px;
  font-size: 0.83rem;
}

.hero-mini-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.hero-mini-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  color: #9ca3af;
}

.notice {
  font-size: 0.8rem;
  color: #facc15;
  margin-bottom: 8px;
}

.site-footer {
  margin-top: 60px;
  padding: 24px;
  border-top: 1px solid var(--card-border);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  backdrop-filter: blur(var(--blur-amount));
}

/* ANIMATIONS */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.film-card {
  animation: fadeIn 0.5s ease-out;
}

.film-card:nth-child(1) { animation-delay: 0.05s; }
.film-card:nth-child(2) { animation-delay: 0.1s; }
.film-card:nth-child(3) { animation-delay: 0.15s; }
.film-card:nth-child(4) { animation-delay: 0.2s; }
.film-card:nth-child(5) { animation-delay: 0.25s; }
.film-card:nth-child(6) { animation-delay: 0.3s; }

/* CIRCULAR RATING INDICATOR */
.circular-rating {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto;
}

.circular-rating svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.circular-rating .circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 7;
}

.circular-rating .circle-progress {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.circular-rating .rating-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.circular-rating .rating-number {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Rating colors */
.rating-bad { stroke: #ef4444; }
.rating-medium { stroke: #f59e0b; }
.rating-good { stroke: #22c55e; }

/* Admin average rating */
.admin-avg-rating {
  text-align: center;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.admin-avg-rating strong {
  color: var(--text-primary);
  font-size: 1rem;
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(10, 10, 15, 0.5);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-gradient);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-gradient);
}

/* SLIDERS */

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-row input[type="range"] {
  flex: 1;
}

.slider-value {
  min-width: 38px;
  text-align: right;
  font-size: 0.8rem;
}

/* FILM DETAIL */

.film-detail-header {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 10px;
}

.film-detail-image {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 16px;
  background: #111827;
}

.film-detail-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.film-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: #9ca3af;
}

.film-section {
  margin-top: 16px;
}

.film-section-title {
  font-size: 1rem;
  margin-bottom: 6px;
}

/* Trailer player */
.trailer-player {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  background: #0b1220;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.trailer-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ADMIN CRITERIA TABLE */

.admin-table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #1f2937;
  background: #020617;
  margin-top: 6px;
}

.criteria-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.criteria-table th,
.criteria-table td {
  border-bottom: 1px solid #1f2937;
  padding: 6px 8px;
  text-align: center;
}

.criteria-table th:first-child,
.criteria-table td:first-child {
  text-align: left;
}

.criteria-table thead {
  background: #020617;
}

/* DROPZONE ДЛЯ ПОСТЕРА */

.dropzone {
  margin-top: 4px;
  margin-bottom: 6px;
  border-radius: 12px;
  border: 1px dashed #4b5563;
  padding: 10px;
  text-align: center;
  background: #020617;
  cursor: pointer;
  position: relative;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone-text {
  font-size: 0.78rem;
  color: #9ca3af;
}

.dropzone.dragover {
  border-color: #22c55e;
  background: #020617cc;
}

.dropzone.has-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.dropzone.has-image .dropzone-text {
  background: rgba(15, 23, 42, 0.8);
  padding: 2px 6px;
  border-radius: 999px;
}

/* RESPONSIVE */

@media (max-width: 1024px) {
  .page-main {
    padding: 20px 16px 40px;
  }
  
  .film-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .site-header {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 12px;
  }
  
  .logo {
    font-size: 1.2rem;
  }
  
  .logo-emoji {
    font-size: 1.5rem;
  }
  
  .main-nav {
    width: 100%;
    order: 3;
    justify-content: center;
  }
  
  .nav-link {
    font-size: 0.85rem;
    padding: 6px 12px;
  }
  
  .page-main {
    padding: 16px 12px 32px;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .auth-panel {
    grid-template-columns: 1fr;
    padding: 20px;
    gap: 24px;
  }
  
  .filters {
    padding: 16px;
    gap: 10px;
  }
  
  .filters-group {
    min-width: 100%;
  }
  
  .film-list {
    grid-template-columns: 1fr;
  }
  
  .film-card {
    padding: 10px;
  }
  
  .film-detail-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .film-detail-image {
    max-height: 300px;
  }
  
  .form-card {
    padding: 16px;
  }
  
  .form-row-inline {
    grid-template-columns: 1fr;
  }
  
  .user-badge {
    align-items: flex-end;
    font-size: 0.7rem;
  }
  
  .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
  }
  
  .rating-pill {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
  
  .rating-label {
    font-size: 0.65rem;
  }
  
  .rating-value {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 10px 12px;
    justify-content: center;
  }
  
  .logo {
    font-size: 1rem;
  }
  
  .page-main {
    padding: 12px 10px 24px;
  }
  
  .section-title {
    font-size: 1.3rem;
  }
  
  .section-sub {
    font-size: 0.85rem;
  }
  
  .nav-link {
    font-size: 0.8rem;
    padding: 5px 10px;
  }
  
  .filters {
    padding: 12px;
  }
  
  .film-rating-big {
    flex-direction: column;
    gap: 6px;
  }
  
  .rating-pill {
    width: 100%;
    justify-content: space-between;
  }
  
  .auth-panel {
    padding: 16px;
  }
  
  .form-card {
    padding: 12px;
  }
  
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  select,
  textarea {
    font-size: 0.9rem;
    padding: 8px 12px;
  }
  
  .circular-rating {
    width: 75px;
    height: 75px;
  }
  
  .circular-rating .rating-number {
    font-size: 1.1rem;
  }
  
  .admin-avg-rating {
    font-size: 0.75rem;
  }
  
  .admin-avg-rating strong {
    font-size: 0.9rem;
  }
}

.trailer-player {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.trailer-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}