/* ============================================================
   Fusion — Components
   ============================================================ */

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-default);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Stat Cards ---- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: all var(--transition-base);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: var(--border-default); transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-value {
  font-size: var(--text-3xl);
  font-weight: var(--fw-extrabold);
  color: var(--text-primary);
  line-height: 1;
}

.stat-card-change {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
}

.stat-card-change.up { color: var(--success); }
.stat-card-change.down { color: var(--danger); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.5;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
}
.btn-primary:hover {
  background: #d62b38;
  box-shadow: var(--shadow-brand);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-glass-light);
  color: var(--text-primary);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
  box-shadow: 0 2px 8px rgba(46, 204, 113, 0.3);
}
.btn-success:hover { background: #27ae60; transform: translateY(-1px); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #c0392b; }

.btn-warning {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}

.btn-outline-primary {
  background: transparent;
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn-outline-primary:hover {
  background: rgba(230, 57, 70, 0.1);
}

.btn-sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

.btn-icon {
  padding: var(--sp-2);
  width: 36px;
  height: 36px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ---- Forms ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
}

.form-control {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: all var(--transition-base);
  width: 100%;
}

.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.12);
  outline: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control[type="color"] {
  padding: var(--sp-1);
  height: 40px;
  cursor: pointer;
}

select.form-control {
  cursor: pointer;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b93b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}

.form-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.form-col-span-2 { grid-column: span 2; }

/* ---- Badge / Tag ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-primary { background: rgba(230, 57, 70, 0.12); color: var(--brand-primary); }
.badge-muted { background: var(--bg-elevated); color: var(--text-muted); }
.badge-purple { background: rgba(124, 58, 237, 0.15); color: #a78bfa; }
.badge-gold { background: rgba(245, 158, 11, 0.15); color: var(--brand-gold); }

/* ---- Table ---- */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.table-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-3);
  min-width: 220px;
}

.table-search input {
  background: none;
  color: var(--text-primary);
  font-size: var(--text-sm);
  flex: 1;
}

.table-search input::placeholder { color: var(--text-muted); }

.data-table {
  width: 100%;
}

.data-table thead tr {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  padding: var(--sp-3) var(--sp-5);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table th:hover { color: var(--text-primary); }

.data-table td {
  padding: var(--sp-4) var(--sp-5);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover { background: var(--bg-glass-light); }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.pagination {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.page-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
}

.page-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.page-btn.active { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  animation: fadeInBackdrop 0.2s ease;
}

@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideInUp 0.25s ease;
}

.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover { background: var(--bg-card); color: var(--text-primary); }

.modal-body {
  padding: var(--sp-6);
}

.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
}

/* ---- Toast ---- */
#toast-container {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  animation: slideInRight 0.3s ease;
  pointer-events: all;
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast-error .toast-icon { background: var(--danger-bg); color: var(--danger); }
.toast-warning .toast-icon { background: var(--warning-bg); color: var(--warning); }
.toast-info .toast-icon { background: var(--info-bg); color: var(--info); }

.toast-content { flex: 1; }
.toast-title { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-primary); }
.toast-message { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

.toast-close {
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--sp-1);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.toast-close:hover { color: var(--text-primary); background: var(--bg-card); }

.toast.removing {
  animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideOutRight {
  to { opacity: 0; transform: translateX(100%); }
}

/* ---- Empty State ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-16) var(--sp-8);
  color: var(--text-muted);
  gap: var(--sp-4);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
}

.empty-state-desc {
  font-size: var(--text-sm);
  max-width: 320px;
}

/* ---- Progress Bar ---- */
.progress {
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.progress-sm { height: 4px; }
.progress-lg { height: 8px; }

/* ---- Avatar Group ---- */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}

.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 44px; height: 44px; font-size: var(--text-base); }
.avatar-xl { width: 60px; height: 60px; font-size: var(--text-xl); }

/* ---- Cinema Card ---- */
.cinema-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
}

.cinema-card:hover {
  border-color: var(--border-brand);
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

.cinema-card.active-cinema {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15), var(--shadow-xl);
}

.cinema-card-header {
  position: relative;
  height: 120px;
  background: linear-gradient(135deg, #1a1f35, #2d3561);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cinema-card-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(230,57,70,0.2), rgba(255,107,53,0.1));
}

.cinema-card-body {
  padding: var(--sp-4);
}

.cinema-card-name {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}

.cinema-card-meta {
  display: flex;
  gap: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* ---- Movie Card ---- */
.movie-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base);
}

.movie-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--border-default);
}

.movie-poster {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1f35, #2a2f50);
  font-size: 48px;
  position: relative;
}

.movie-poster-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.8));
}

.movie-rating-badge {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-default);
  color: var(--brand-accent);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
}

.movie-card-body {
  padding: var(--sp-4);
}

.movie-title {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-meta {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--sp-4) 0;
}

/* ---- Color Dot ---- */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-success { background: var(--success); box-shadow: 0 0 6px var(--success); }
.dot-warning { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.dot-danger { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.dot-info { background: var(--info); }

/* ---- Input Group ---- */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  border-right: none;
}

.input-group .btn {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-addon {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  padding: var(--sp-3) var(--sp-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
}

.input-addon-left {
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-addon-right {
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ---- Timeline ---- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: var(--sp-4);
  padding-bottom: var(--sp-4);
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 1px;
  background: var(--border-subtle);
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  background: var(--bg-card);
  border: 2px solid var(--border-default);
  z-index: 1;
}

.timeline-content {
  flex: 1;
  padding-top: var(--sp-1);
}

.timeline-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Skeleton Loader ---- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* ---- Switch Toggle ---- */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
}

.switch-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: all var(--transition-base);
}

.switch input:checked + .switch-slider {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
  background: #fff;
}

/* ---- Tooltip ---- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-size: var(--text-xs);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 500;
  box-shadow: var(--shadow-md);
}

[data-tooltip]:hover::after { opacity: 1; }
