/* Base Styles & Variables */
:root {
  --primary: #e50914;
  --secondary: #b20710;
  --primary-light: #ff3b43;
  --primary-transparent: rgba(229, 9, 20, 0.1);
  --text: #ffffff;
  --text-secondary: #b3b3b3;
  --text-tertiary: #737373;
  --background: #141414;
  --surface: #1f1f1f;
  --surface-light: #2a2a2a;
  --surface-lighter: #333333;
  --border: #333333;
  --border-light: #444444;
  --success: #46d369;
  --success-bg: rgba(70, 211, 105, 0.15);
  --warning: #ffc107;
  --warning-bg: rgba(255, 193, 7, 0.15);
  --danger: #dc3545;
  --danger-bg: rgba(220, 53, 69, 0.15);
  --info: #0071eb;
  --info-bg: rgba(0, 113, 235, 0.15);
  --shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.5;
  background-image: linear-gradient(to bottom, rgba(20, 20, 20, 0.9), rgba(20, 20, 20, 1)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Container */
.films-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  animation: fadeIn 0.5s ease;
}

/* Header */
.films-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
  position: relative;
}

.films-header::after {
  content: "";
  position: absolute;
  bottom: -16px;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.films-title-section {
  flex: 1;
}

.films-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  display: inline-block;
}

.films-title::before {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 40px;
  height: 3px;
  background-color: var(--primary);
  border-radius: 2px;
}

.films-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
}

.films-actions {
  display: flex;
  gap: 12px;
}

/* Buttons */
.films-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  outline: none;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.films-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%);
  transform-origin: 50% 50%;
}

.films-btn:active:not(:focus-visible)::after {
  animation: ripple 1s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }
  20% {
    transform: scale(25, 25);
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: scale(40, 40);
  }
}

.films-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--text);
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.3);
}

.films-btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(229, 9, 20, 0.4);
}

.films-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(229, 9, 20, 0.3);
}

.films-btn-secondary {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
}

.films-btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.films-btn-secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.films-btn-danger {
  background: linear-gradient(135deg, var(--danger), #b30000);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.films-btn-danger:hover {
  background: linear-gradient(135deg, #ff3b49, var(--danger));
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
}

.films-btn-danger:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.films-btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-secondary);
}

.films-btn-edit:hover {
  background-color: var(--info-bg);
  color: var(--info);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 113, 235, 0.2);
}

.films-btn-delete:hover {
  background-color: var(--danger-bg);
  color: var(--danger);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

.films-btn-view:hover {
  background-color: var(--success-bg);
  color: var(--success);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(70, 211, 105, 0.2);
}

/* Alert */
.films-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  animation: slideDown 0.4s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.films-alert-success {
  background-color: var(--success-bg);
  border-left: 4px solid var(--success);
}

.films-alert-error {
  background-color: var(--danger-bg);
  border-left: 4px solid var(--danger);
}

.films-alert-icon {
  color: var(--success);
  font-size: 24px;
}

.films-alert-error .films-alert-icon {
  color: var(--danger);
}

.films-alert-content {
  flex: 1;
  font-weight: 500;
}

/* Card */
.films-card {
  background-color: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.films-card:hover {
  box-shadow: var(--shadow-lg);
}

.films-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(to right, var(--surface-light), var(--surface));
  border-bottom: 1px solid var(--border);
}

.films-card-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.films-card-count {
  font-size: 14px;
  color: var(--text-secondary);
  background-color: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.films-card-body {
  padding: 24px;
}

/* Form */
.films-form {
  width: 100%;
}

.films-form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}

.films-form-group {
  margin-bottom: 24px;
  flex: 1;
}

.films-form-group-large {
  flex: 2;
}

.films-form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
}

.films-form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.films-form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-transparent);
  background-color: rgba(255, 255, 255, 0.08);
}

.films-form-control[readonly] {
  background-color: var(--surface);
  cursor: not-allowed;
}

.films-form-help {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.films-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 32px;
}

/* Current image preview */
.films-current-image {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.films-current-image img {
  width: 60px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.films-current-image span {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Table */
.films-table-container {
  overflow-x: auto;
  border-radius: 8px;
}

.films-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.films-table th,
.films-table td {
  padding: 16px;
  text-align: left;
}

.films-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: rgba(255, 255, 255, 0.03);
  border-bottom: 2px solid var(--border);
}

.films-table tbody tr {
  transition: all 0.3s ease;
  border-bottom: 1px solid var(--border);
}

.films-table tbody tr:last-child {
  border-bottom: none;
}

.films-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1;
  position: relative;
}

.films-actions-cell {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Poster thumbnail */
.films-poster-cell {
  width: 60px;
}

.films-thumbnail {
  width: 60px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.films-thumbnail:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

/* Title cell */
.films-title-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.films-title-text {
  font-weight: 600;
  font-size: 16px;
}

.films-synopsis-preview {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* Badges */
.films-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.films-badge .material-symbols-outlined {
  font-size: 16px;
}

.films-badge-active {
  background: linear-gradient(135deg, var(--success), #2da350);
  color: white;
}

.films-badge-inactive {
  background: linear-gradient(135deg, var(--surface-light), var(--surface-lighter));
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Empty State */
.films-empty-state {
  padding: 60px 20px;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

.films-empty-icon {
  font-size: 64px;
  color: var(--text-tertiary);
  margin-bottom: 24px;
  opacity: 0.6;
}

.films-empty-icon .material-symbols-outlined {
  font-size: 64px;
}

.films-empty-text {
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* Modal */
.films-modal-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background-color: rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(5px) !important;
  z-index: 1000 !important;
  opacity: 1 !important;
  transition: opacity 0.3s ease !important;
}

.films-modal {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 90% !important;
  max-width: 500px !important;
  background-color: var(--surface) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-lg) !important;
  z-index: 1001 !important;
  opacity: 1 !important;
  transition: opacity 0.3s ease, transform 0.3s ease !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.films-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to right, var(--surface-light), var(--surface));
}

.films-modal-title {
  font-size: 20px;
  font-weight: 600;
}

.films-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.3s ease;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.films-modal-close:hover {
  color: var(--text);
  background-color: rgba(255, 255, 255, 0.1);
}

.films-modal-body {
  padding: 24px;
}

.films-modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}

/* Text Styles */
.films-text-warning {
  color: var(--warning);
  margin-top: 16px;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.films-text-warning::before {
  content: "warning";
  font-family: "Material Symbols Outlined";
  font-size: 20px;
}

/* KDM Upload Section */
.films-kdm-upload {
  margin-top: 32px;
  padding: 24px;
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px dashed rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.films-kdm-upload::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
  z-index: -1;
}

.films-kdm-upload h4 {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.films-kdm-upload h4::before {
  content: "upload_file";
  font-family: "Material Symbols Outlined";
  font-size: 24px;
  color: var(--primary);
}

.films-kdm-upload p {
  margin-bottom: 20px;
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 600px;
}

.films-kdm-form {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.films-kdm-form input[type="file"] {
  flex: 1;
  min-width: 200px;
  padding: 12px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

.films-kdm-form input[type="file"]::file-selector-button {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  margin-right: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.films-kdm-form input[type="file"]::file-selector-button:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .films-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .films-actions {
    width: 100%;
    flex-direction: column;
  }

  .films-btn {
    width: 100%;
  }

  .films-form-row {
    flex-direction: column;
    gap: 0;
  }

  .films-form-actions {
    flex-direction: column;
  }

  .films-form-actions .films-btn {
    width: 100%;
  }

  .films-modal-footer {
    flex-direction: column;
  }

  .films-modal-footer .films-btn,
  .films-modal-footer form {
    width: 100%;
  }

  .films-modal-footer form button {
    width: 100%;
  }

  .films-table th,
  .films-table td {
    padding: 12px 8px;
  }

  .films-actions-cell {
    flex-direction: column;
    gap: 8px;
  }
}

/* Make delete buttons more noticeable */
.films-btn-delete {
  background-color: rgba(220, 53, 69, 0.2) !important;
  color: #dc3545 !important;
  border: 1px solid #dc3545 !important;
}

.films-btn-delete:hover {
  background-color: rgba(220, 53, 69, 0.4) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3) !important;
}

/* Add animation for modal appearance */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.films-modal[style*="display: block"] {
  animation: modalFadeIn 0.3s ease forwards;
}
