/**
 * CECCM Design System - Components
 * 
 * Unified component styles using design tokens from design-tokens.css
 * This file provides consistent buttons, forms, cards, and other UI components.
 * 
 * Version: 1.0.0
 * Date: 2026-02-17
 */

/* ============================================
   BUTTONS
   ============================================ */

/* Base Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-weight: var(--font-weight-medium);
  font-size: var(--text-sm);
  line-height: 1;
  text-decoration: none;
  text-transform: none;
  letter-spacing: var(--tracking-normal);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

.btn-xl {
  padding: var(--space-5) var(--space-10);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

/* Primary Button - Navy Theme */
.btn-primary {
  background: linear-gradient(
    135deg,
    var(--color-primary-500),
    var(--color-primary-600)
  );
  color: var(--color-text-dark, #fff);
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(
    135deg,
    var(--color-primary-400),
    var(--color-primary-500)
  );
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(10, 42, 74, 0.4);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

/* Secondary Button - Navy Theme */
.btn-secondary {
  background: var(--color-bg-light-secondary);
  color: var(--color-primary-500);
  border: 1px solid var(--color-border-light);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-bg-light-tertiary);
  border-color: var(--color-primary-400);
}

/* Accent Button - Cyan/Violet Theme (Landing/Auth) */
.btn-accent {
  background: linear-gradient(
    135deg,
    var(--color-accent-cyan),
    var(--color-accent-violet)
  );
  color: var(--color-bg-dark);
  font-weight: var(--font-weight-semibold);
  box-shadow: var(--shadow-cyan-sm);
}

.btn-accent:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-cyan);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg-secondary);
  border-color: var(--color-border-hover);
}

/* Glass Button */
.btn-glass {
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-glass);
  color: var(--color-text-primary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-glass:hover:not(:disabled) {
  background: var(--color-bg-glass-hover);
  border-color: var(--color-border-accent);
}

/* Outline Buttons */
.btn-outline {
  background: transparent;
  border: 2px solid var(--color-primary-500);
  color: var(--color-primary-500);
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-primary-500);
  color: #fff;
}

.btn-outline-accent {
  background: transparent;
  border: 2px solid var(--color-accent-cyan);
  color: var(--color-accent-cyan);
}

.btn-outline-accent:hover:not(:disabled) {
  background: var(--color-accent-cyan);
  color: var(--color-bg-dark);
}

/* Danger Button */
.btn-danger {
  background: var(--color-accent-red);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-1px);
}

/* Success Button */
.btn-success {
  background: var(--color-accent-green);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #16a34a;
  transform: translateY(-1px);
}

/* Warning Button */
.btn-warning {
  background: var(--color-accent-amber);
  color: #fff;
}

.btn-warning:hover:not(:disabled) {
  background: #d97706;
  transform: translateY(-1px);
}

/* Icon Button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-lg);
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
}

.btn-icon-lg {
  width: 48px;
  height: 48px;
}

/* Button Group */
.btn-group {
  display: inline-flex;
  gap: var(--space-2);
}

.btn-group .btn {
  margin: 0;
}

.btn-group .btn:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.btn-group .btn:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* ============================================
   FORMS
   ============================================ */

/* Form Group */
.form-group {
  margin-bottom: var(--space-5);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-body);
  font-weight: var(--font-weight-medium);
  font-size: var(--text-sm);
  color: var(--color-text);
}

/* Form Input Base */
.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-input:hover:not(:disabled) {
  border-color: var(--color-border-hover);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.15);
}

.form-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--color-bg-secondary);
}

/* Form Input - Dark Theme (Auth) */
body.auth-page .form-input,
body.landing-page .form-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

body.auth-page .form-input:focus,
body.landing-page .form-input:focus {
  border-color: var(--color-accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

/* Form Textarea */
.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* Form Select */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
}

/* Form Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.form-check-input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary-500);
  cursor: pointer;
}

.form-check-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
}

/* Form Switch */
.form-switch {
  position: relative;
  width: 44px;
  height: 24px;
}

.form-switch-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.form-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--color-bg-tertiary);
  border-radius: var(--radius-full);
  transition: var(--transition-base);
}

.form-switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: var(--transition-base);
}

.form-switch-input:checked + .form-switch-slider {
  background-color: var(--color-primary-500);
}

.form-switch-input:checked + .form-switch-slider::before {
  transform: translateX(20px);
}

/* Form Helper Text */
.form-helper {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Form Error */
.form-error {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-accent-red);
}

.form-input.error {
  border-color: var(--color-accent-red);
}

.form-input.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Form Success */
.form-input.success {
  border-color: var(--color-accent-green);
}

.form-input.success:focus {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

/* Input Group */
.input-group {
  position: relative;
  display: flex;
}

.input-group .form-input {
  flex: 1;
}

.input-group-addon {
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.input-group-addon:first-child {
  border-right: 0;
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}

.input-group-addon:last-child {
  border-left: 0;
  border-top-right-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* ============================================
   CARDS
   ============================================ */

/* Base Card */
.card {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* Card with Border */
.card-bordered {
  border: 1px solid var(--color-border);
  box-shadow: none;
}

/* Card Header */
.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.card-header h2,
.card-header h3,
.card-header h4 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

/* Card Body */
.card-body {
  padding: var(--space-6);
}

/* Card Footer */
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
}

/* Glass Card */
.card-glass {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );
  backdrop-filter: blur(var(--glass-blur, 20px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 20px));
  border: 1px solid var(--color-border-glass);
  box-shadow: var(--shadow-glass);
}

.card-glass:hover {
  border-color: var(--color-border-accent);
}

/* Card Hover Effect */
.card-hover {
  transition: all var(--transition-base);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* ============================================
   BADGES
   ============================================ */

/* Base Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-full);
}

/* Badge Colors */
.badge-primary {
  background: rgba(10, 42, 74, 0.1);
  color: var(--color-primary-500);
  border: 1px solid rgba(10, 42, 74, 0.2);
}

.badge-success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--color-accent-green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-info {
  background: rgba(6, 182, 212, 0.1);
  color: var(--color-accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.badge-neutral {
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* ============================================
   TABLES
   ============================================ */

/* Base Table */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
}

.table th {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}

.table td {
  font-size: var(--text-sm);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}

.table tr:last-child td {
  border-bottom: none;
}

.table-hover tbody tr {
  transition: background var(--transition-fast);
}

.table-hover tbody tr:hover {
  background: var(--color-bg-secondary);
}

/* ============================================
   PAGINATION
   ============================================ */

/* Base Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin: 0;
}

.pagination-item {
  display: flex;
}

.pagination-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.pagination-link:hover:not(.active) {
  color: var(--color-primary);
  border-color: var(--color-primary-400);
  background: var(--color-bg-secondary);
}

.pagination-link.active {
  color: #fff;
  background: var(--color-primary-500);
  border-color: var(--color-primary-500);
}

.pagination-link.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   AVATARS
   ============================================ */

/* Avatar Base */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: linear-gradient(
    135deg,
    var(--color-accent-cyan),
    var(--color-accent-violet)
  );
  color: var(--color-bg-dark);
  font-family: var(--font-body);
  font-weight: var(--font-weight-semibold);
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Avatar Sizes */
.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: var(--text-xs);
}

.avatar-md {
  width: 40px;
  height: 40px;
  font-size: var(--text-sm);
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: var(--text-base);
}

.avatar-xl {
  width: 80px;
  height: 80px;
  font-size: var(--text-xl);
}

.avatar-2xl {
  width: 120px;
  height: 120px;
  font-size: var(--text-3xl);
}

/* Avatar Group */
.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--color-bg);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ============================================
   ALERTS
   ============================================ */

/* Base Alert */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
}

.alert-icon {
  flex-shrink: 0;
  font-size: var(--text-lg);
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
}

.alert-message {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

/* Alert Colors */
.alert-primary {
  background: rgba(10, 42, 74, 0.1);
  border-color: rgba(10, 42, 74, 0.2);
  color: var(--color-primary-500);
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
  color: var(--color-accent-green);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--color-accent-red);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
  color: var(--color-accent-amber);
}

.alert-info {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.2);
  color: var(--color-accent-cyan);
}

/* ============================================
   PROGRESS BARS
   ============================================ */

/* Progress Base */
.progress {
  width: 100%;
  height: 8px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--color-primary-400),
    var(--color-primary-500)
  );
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* Progress Sizes */
.progress-sm {
  height: 4px;
}

.progress-lg {
  height: 12px;
}

/* Progress Colors */
.progress-success .progress-bar {
  background: linear-gradient(90deg, #4ade80, var(--color-accent-green));
}

.progress-danger .progress-bar {
  background: linear-gradient(90deg, #f87171, var(--color-accent-red));
}

.progress-warning .progress-bar {
  background: linear-gradient(90deg, #fbbf24, var(--color-accent-amber));
}

/* ============================================
   CONTAINERS - Standardized System with @container
   ============================================ */

/* Base Container */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* Container Sizes */
.container-sm {
  max-width: var(--container-sm);
}
.container-md {
  max-width: var(--container-md);
}
.container-lg {
  max-width: var(--container-lg);
}
.container-2xl {
  max-width: var(--container-2xl);
}

/* Container with inline-size for container queries */
.container-cq {
  container-type: var(--container-type-inline-size);
  container-name: container;
}

/* Container Query Utility Classes */
@container (min-width: 400px) {
  .cq-sm\:auto {
    width: auto;
  }
  .cq-sm\:full {
    width: 100%;
  }
}

@container (min-width: 600px) {
  .cq-md\:auto {
    width: auto;
  }
  .cq-md\:full {
    width: 100%;
  }
}

@container (min-width: 800px) {
  .cq-lg\:auto {
    width: auto;
  }
  .cq-lg\:full {
    width: 100%;
  }
}

/* Section */
.section {
  padding: var(--space-16) 0;
}

.section-sm {
  padding: var(--space-10) 0;
}

.section-lg {
  padding: var(--space-24) 0;
}

/* ============================================
   FLUID TYPOGRAPHY - Using clamp()
   ============================================ */

/* Fluid text utilities - scales between min and max based on viewport */
.fluid-text-xs {
  font-size: clamp(var(--text-xs), 0.8rem + 0.5vw, var(--text-sm));
}

.fluid-text-sm {
  font-size: clamp(var(--text-sm), 0.9rem + 0.5vw, var(--text-base));
}

.fluid-text-base {
  font-size: clamp(var(--text-base), 1rem + 0.5vw, var(--text-lg));
}

.fluid-text-lg {
  font-size: clamp(var(--text-lg), 1.1rem + 0.75vw, var(--text-xl));
}

.fluid-text-xl {
  font-size: clamp(var(--text-xl), 1.25rem + 1vw, var(--text-2xl));
}

.fluid-text-2xl {
  font-size: clamp(var(--text-2xl), 1.5rem + 1.5vw, var(--text-3xl));
}

.fluid-text-3xl {
  font-size: clamp(var(--text-3xl), 2rem + 2vw, var(--text-4xl));
}

.fluid-text-4xl {
  font-size: clamp(var(--text-4xl), 2.5rem + 2.5vw, var(--text-5xl));
}

/* ============================================
   GRID SYSTEM with Subgrid Support
   ============================================ */

/* Base Grid */
.grid {
  display: grid;
  gap: var(--space-6);
  /* Gap fallback for older browsers */
  grid-gap: var(--space-6);
}

/* Grid Columns */
.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}
.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}
.grid-cols-6 {
  grid-template-columns: repeat(6, 1fr);
}

/* Grid with Subgrid Support */
.grid-subgrid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
}

.grid-subgrid > * {
  grid-column: span 1;
}

/* Grid Auto */
.grid-auto {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

/* Responsive Grid - Mobile First */
@media (max-width: 480px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4,
  .grid-cols-6 {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 0 var(--space-3);
  }
}

@media (min-width: 640px) {
  .sm\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .sm\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .md\:grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .container {
    padding: 0 var(--space-5);
  }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .lg\:grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .container {
    padding: 0 var(--space-6);
  }
}

/* ============================================
   SKELETON LOADING
   ============================================ */

/* Base Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Skeleton Text */
.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
}

.skeleton-text-sm {
  height: 0.75rem;
  width: 60%;
}

.skeleton-text-lg {
  height: 1.25rem;
  width: 80%;
}

/* Skeleton Avatar */
.skeleton-avatar {
  border-radius: var(--radius-full);
}

.skeleton-avatar-sm {
  width: 32px;
  height: 32px;
}
.skeleton-avatar-md {
  width: 40px;
  height: 40px;
}
.skeleton-avatar-lg {
  width: 56px;
  height: 56px;
}
.skeleton-avatar-xl {
  width: 80px;
  height: 80px;
}

/* Skeleton Card */
.skeleton-card {
  height: 200px;
  border-radius: var(--radius-xl);
}

/* Skeleton Button */
.skeleton-button {
  width: 100px;
  height: 40px;
}

/* Skeleton Input */
.skeleton-input {
  height: 44px;
  border-radius: var(--radius-lg);
}

/* Skeleton Image */
.skeleton-image {
  aspect-ratio: var(--aspect-video);
  border-radius: var(--radius-lg);
}

/* Skeleton Circle */
.skeleton-circle {
  border-radius: var(--radius-full);
}

/* Skeleton - No Animation (for reduced motion) */
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
    background: var(--color-bg-tertiary);
  }
}

/* ============================================
   SKELETON LOADER COMPONENTS
   ============================================ */

/* Skeleton Loader Container */
.skeleton-loader {
  display: contents;
}

/* Video Card Skeleton */
.skeleton-video-card {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.skeleton-video-card .skeleton-thumbnail {
  aspect-ratio: 16/9;
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-video-card .skeleton-content {
  padding: var(--space-4);
}

.skeleton-video-card .skeleton-title {
  height: 1.25rem;
  width: 85%;
  margin-bottom: var(--space-2);
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-video-card .skeleton-description {
  height: 0.875rem;
  width: 100%;
  margin-bottom: var(--space-1);
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-video-card .skeleton-description:last-child {
  width: 60%;
  margin-bottom: 0;
}

.skeleton-video-card .skeleton-meta {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
}

.skeleton-video-card .skeleton-meta-item {
  height: 0.75rem;
  width: 80px;
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* Table Row Skeleton */
.skeleton-table-row {
  display: contents;
}

.skeleton-table-row td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.skeleton-table-row .skeleton-cell {
  height: 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-table-row .skeleton-cell-thumbnail {
  width: 80px;
  height: 45px;
  border-radius: var(--radius-md);
}

.skeleton-table-row .skeleton-cell-title {
  width: 150px;
}

.skeleton-table-row .skeleton-cell-badge {
  width: 70px;
  height: 1.5rem;
  border-radius: var(--radius-full);
}

.skeleton-table-row .skeleton-cell-actions {
  display: flex;
  gap: var(--space-2);
}

.skeleton-table-row .skeleton-action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* Stat Card Skeleton */
.skeleton-stat-card {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.skeleton-stat-card .skeleton-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-stat-card .skeleton-stat-content {
  flex: 1;
}

.skeleton-stat-card .skeleton-stat-value {
  height: 2rem;
  width: 60px;
  margin-bottom: var(--space-1);
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-stat-card .skeleton-stat-label {
  height: 0.875rem;
  width: 100px;
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* Mini Video Card Skeleton */
.skeleton-video-mini {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
}

.skeleton-video-mini .skeleton-thumb-mini {
  width: 120px;
  height: 68px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

.skeleton-video-mini .skeleton-info-mini {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-2);
}

.skeleton-video-mini .skeleton-title-mini {
  height: 1rem;
  width: 90%;
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-video-mini .skeleton-author-mini {
  height: 0.75rem;
  width: 60%;
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* Event Card Skeleton */
.skeleton-event-card {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.skeleton-event-card .skeleton-date-badge {
  width: 60px;
  height: 70px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

.skeleton-event-card .skeleton-event-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.skeleton-event-card .skeleton-event-title {
  height: 1.25rem;
  width: 70%;
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-event-card .skeleton-event-detail {
  height: 0.875rem;
  width: 50%;
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-event-card .skeleton-event-btn {
  width: 100px;
  height: 36px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* Action Card Skeleton */
.skeleton-action-card {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.skeleton-action-card .skeleton-action-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-action-card .skeleton-action-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.skeleton-action-card .skeleton-action-title {
  height: 1.125rem;
  width: 70%;
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-action-card .skeleton-action-desc {
  height: 0.875rem;
  width: 90%;
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* Skeleton Grid Container */
.skeleton-grid {
  display: grid;
  gap: var(--space-6);
}

.skeleton-grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.skeleton-grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.skeleton-grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.skeleton-grid-stats {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Responsive Skeleton Grid */
@media (max-width: 1024px) {
  .skeleton-grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .skeleton-grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .skeleton-grid-cols-4,
  .skeleton-grid-cols-3,
  .skeleton-grid-cols-2 {
    grid-template-columns: 1fr;
  }
}

/* Skeleton Fade In Animation */
.skeleton-fade-in {
  animation: skeleton-fade-in 0.3s ease-out;
}

@keyframes skeleton-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Skeleton Fade Out Animation */
.skeleton-fade-out {
  animation: skeleton-fade-out 0.3s ease-out forwards;
}

@keyframes skeleton-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Content Fade In (for replacing skeletons) */
.content-fade-in {
  animation: content-fade-in 0.4s ease-out;
}

@keyframes content-fade-in {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hidden state for skeleton containers */
.skeleton-container {
  transition: opacity 0.3s ease-out;
}

.skeleton-container.hidden {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

/* Loading state indicator */
.is-loading {
  position: relative;
}

.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-bg);
  opacity: 0.7;
  z-index: 10;
}

/* ============================================
   MODERN CSS SELECTORS (:has, :where, :is)
   ============================================ */

/* :has() - Parent selector patterns */

/* Card with interactive content */
.card:has(.btn:hover) {
  box-shadow: var(--shadow-lg);
}

/* Form with focus */
.form-group:has(.form-input:focus) label {
  color: var(--color-primary);
}

/* Grid with items */
.grid:has(.grid-item:hover) {
  gap: var(--space-8);
}

/* :where() - Zero-specificity selector placeholders */
:where(.btn-primary, .btn-secondary, .btn-accent) {
  cursor: pointer;
}

:where(.form-input, .form-textarea, .form-select):focus-visible {
  outline: 2px solid var(--color-primary-400);
  outline-offset: 2px;
}

/* :is() - Grouping selector */
:is(h1, h2, h3, h4, h5, h6).heading-display {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
}

:is(.alert-success, .alert-danger, .alert-warning, .alert-info) {
  border-left-width: 4px;
}

/* ============================================
   FOCUS STATES - Consistent Across All Pages
   ============================================ */

/* Global Focus Styles */
:focus-visible {
  outline: 2px solid var(--color-primary-400);
  outline-offset: 2px;
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Button Focus */
.btn:focus-visible {
  outline: 2px solid var(--color-primary-400);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(74, 158, 255, 0.2);
}

/* Input Focus - using :where for lower specificity */
:where(.form-input, .form-textarea, .form-select):focus-visible {
  outline: 2px solid var(--color-primary-400);
  outline-offset: 0;
}

/* Link Focus */
a:focus-visible {
  outline: 2px solid var(--color-accent-cyan);
  outline-offset: 2px;
}

/* ============================================
   UTILITIES
   ============================================ */

/* Display */
.d-flex {
  display: flex;
}
.d-block {
  display: block;
}
.d-inline {
  display: inline;
}
.d-inline-block {
  display: inline-block;
}
.d-none {
  display: none;
}
.d-grid {
  display: grid;
}

/* Flexbox */
.flex-row {
  flex-direction: row;
}
.flex-column {
  flex-direction: column;
}
.flex-wrap {
  flex-wrap: wrap;
}
.flex-1 {
  flex: 1;
}
.flex-shrink-0 {
  flex-shrink: 0;
}
.items-center {
  align-items: center;
}
.items-start {
  align-items: flex-start;
}
.items-end {
  align-items: flex-end;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-end {
  justify-content: flex-end;
}

/* Gap with fallback */
.gap-1 {
  gap: var(--space-1);
}
.gap-2 {
  gap: var(--space-2);
}
.gap-3 {
  gap: var(--space-3);
}
.gap-4 {
  gap: var(--space-4);
}
.gap-6 {
  gap: var(--space-6);
}
.gap-8 {
  gap: var(--space-8);
}

/* Spacing - Margin */
.m-0 {
  margin: 0;
}
.m-auto {
  margin: auto;
}
.mt-auto {
  margin-top: auto;
}
.mb-auto {
  margin-bottom: auto;
}
.mt-4 {
  margin-top: var(--space-4);
}
.mb-4 {
  margin-bottom: var(--space-4);
}
.mb-6 {
  margin-bottom: var(--space-6);
}
.mb-8 {
  margin-bottom: var(--space-8);
}

/* Spacing - Padding */
.p-0 {
  padding: 0;
}
.p-4 {
  padding: var(--space-4);
}
.p-6 {
  padding: var(--space-6);
}
.p-8 {
  padding: var(--space-8);
}

/* Width */
.w-full {
  width: 100%;
}
.w-auto {
  width: auto;
}
.max-w-sm {
  max-width: var(--container-sm);
}
.max-w-md {
  max-width: var(--container-md);
}
.max-w-lg {
  max-width: var(--container-lg);
}

/* Height */
.h-full {
  height: 100%;
}
.h-screen {
  height: 100vh;
}
.min-h-screen {
  min-height: 100vh;
}

/* Text */
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-right {
  text-align: right;
}
.text-sm {
  font-size: var(--text-sm);
}
.text-base {
  font-size: var(--text-base);
}
.text-lg {
  font-size: var(--text-lg);
}
.font-normal {
  font-weight: var(--font-weight-normal);
}
.font-medium {
  font-weight: var(--font-weight-medium);
}
.font-semibold {
  font-weight: var(--font-weight-semibold);
}
.font-bold {
  font-weight: var(--font-weight-bold);
}
.tracking-wide {
  letter-spacing: var(--tracking-wide);
}
.leading-tight {
  line-height: var(--leading-tight);
}
.leading-relaxed {
  line-height: var(--leading-relaxed);
}

/* Overflow */
.overflow-hidden {
  overflow: hidden;
}
.overflow-auto {
  overflow: auto;
}
.overflow-x-auto {
  overflow-x: auto;
}

/* Position */
.relative {
  position: relative;
}
.absolute {
  position: absolute;
}
.fixed {
  position: fixed;
}
.sticky {
  position: sticky;
}

/* Visibility */
.visible {
  visibility: visible;
}
.invisible {
  visibility: hidden;
}

/* Cursor */
.cursor-pointer {
  cursor: pointer;
}
.cursor-not-allowed {
  cursor: not-allowed;
}

/* User Select */
.select-none {
  user-select: none;
}
.select-text {
  user-select: text;
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

/* Mobile First Approach - min-width breakpoints */

/* Small devices (landscape phones, 480px and up) */
@media (min-width: 480px) {
  .sm\:flex-row {
    flex-direction: row;
  }
  .sm\:flex-column {
    flex-direction: column;
  }
  .sm\:text-left {
    text-align: left;
  }
  .sm\:text-center {
    text-align: center;
  }
  .sm\:d-flex {
    display: flex;
  }
  .sm\:d-none {
    display: none;
  }
  .sm\:d-block {
    display: block;
  }
  .sm\:w-auto {
    width: auto;
  }
  .sm\:w-full {
    width: 100%;
  }
}

/* Medium devices (tablets, 640px and up) */
@media (min-width: 640px) {
  .md\:flex-row {
    flex-direction: row;
  }
  .md\:flex-column {
    flex-direction: column;
  }
  .md\:text-left {
    text-align: left;
  }
  .md\:text-center {
    text-align: center;
  }
  .md\:d-flex {
    display: flex;
  }
  .md\:d-none {
    display: none;
  }
  .md\:d-block {
    display: block;
  }
  .md\:w-auto {
    width: auto;
  }
  .md\:w-full {
    width: 100%;
  }
}

/* Large devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
  .lg\:flex-row {
    flex-direction: row;
  }
  .lg\:flex-column {
    flex-direction: column;
  }
  .lg\:text-left {
    text-align: left;
  }
  .lg\:text-center {
    text-align: center;
  }
  .lg\:d-flex {
    display: flex;
  }
  .lg\:d-none {
    display: none;
  }
  .lg\:d-block {
    display: block;
  }
  .lg\:w-auto {
    width: auto;
  }
  .lg\:w-full {
    width: 100%;
  }
}

/* Extra large devices (large desktops, 1280px and up) */
@media (min-width: 1280px) {
  .xl\:flex-row {
    flex-direction: row;
  }
  .xl\:flex-column {
    flex-direction: column;
  }
  .xl\:d-flex {
    display: flex;
  }
  .xl\:d-none {
    display: none;
  }
  .xl\:d-block {
    display: block;
  }
  .xl\:w-auto {
    width: auto;
  }
  .xl\:w-full {
    width: 100%;
  }
}

/* ============================================
   RESPONSIVE COMPONENT STYLES
   ============================================ */

/* Extra Small devices (phones, 480px and below) */
@media (max-width: 480px) {
  /* Buttons - Stack on mobile */
  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn {
    width: 100%;
    border-radius: var(--radius-lg);
  }

  .btn-group .btn:not(:first-child) {
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    margin-top: var(--space-2);
  }

  .btn-group .btn:not(:last-child) {
    border-top-right-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
  }

  /* Buttons - Size adjustments */
  .btn {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
  }

  .btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
  }

  .btn-xl {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
  }

  /* Cards - Full width on mobile */
  .card {
    border-radius: var(--radius-lg);
  }

  .card-body {
    padding: var(--space-4);
  }

  .card-header {
    padding: var(--space-4);
  }

  .card-footer {
    padding: var(--space-3) var(--space-4);
  }

  /* Forms - Stack on mobile */
  .form-group {
    margin-bottom: var(--space-4);
  }

  .input-group {
    flex-direction: column;
  }

  .input-group .form-input {
    width: 100%;
  }

  .input-group-addon {
    width: 100%;
    justify-content: center;
    border-radius: var(--radius-lg);
    padding: var(--space-2) var(--space-3);
  }

  .input-group-addon:first-child {
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-right-radius: var(--radius-lg);
    border-top-left-radius: var(--radius-lg);
  }

  .input-group-addon:last-child {
    border-radius: var(--radius-lg);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
  }

  /* Tables - Responsive scroll */
  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* Avatars - Smaller on mobile */
  .avatar-xl {
    width: 64px;
    height: 64px;
    font-size: var(--text-lg);
  }

  .avatar-2xl {
    width: 80px;
    height: 80px;
    font-size: var(--text-xl);
  }

  /* Alerts - Compact on mobile */
  .alert {
    padding: var(--space-3) var(--space-4);
    flex-direction: column;
    text-align: center;
  }

  .alert-icon {
    margin-bottom: var(--space-2);
  }

  /* Pagination - Compact on mobile */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
  }

  .pagination-link {
    min-width: 32px;
    height: 32px;
    font-size: var(--text-xs);
  }

  /* Progress - Smaller on mobile */
  .progress-lg {
    height: 8px;
  }

  /* Section - Reduced padding */
  .section {
    padding: var(--space-10) 0;
  }

  .section-sm {
    padding: var(--space-6) 0;
  }

  .section-lg {
    padding: var(--space-16) 0;
  }
}

/* Small devices (landscape phones, 481px to 640px) */
@media (min-width: 481px) and (max-width: 640px) {
  /* Buttons */
  .btn-group {
    flex-wrap: wrap;
  }

  .btn-group .btn {
    flex: 1 1 auto;
  }

  /* Cards */
  .card-body {
    padding: var(--space-5);
  }

  /* Tables */
  .table {
    display: block;
    overflow-x: auto;
  }
}

/* Medium devices (tablets, 641px to 768px) */
@media (min-width: 641px) and (max-width: 768px) {
  /* Cards */
  .card-body {
    padding: var(--space-5) var(--space-6);
  }

  /* Forms */
  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Medium-large devices (tablets landscape, 769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Grid adjustments */
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-cols-6 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Large devices (desktops, 1025px to 1280px) */
@media (min-width: 1025px) and (max-width: 1280px) {
  /* Grid adjustments */
  .grid-cols-6 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   RESPONSIVE SPACING UTILITIES
   ============================================ */

/* Extra Small - Mobile */
@media (max-width: 480px) {
  .xs\:p-2 {
    padding: var(--space-2);
  }
  .xs\:p-3 {
    padding: var(--space-3);
  }
  .xs\:p-4 {
    padding: var(--space-4);
  }
  .xs\:m-0 {
    margin: 0;
  }
  .xs\:mb-4 {
    margin-bottom: var(--space-4);
  }
  .xs\:gap-2 {
    gap: var(--space-2);
  }
  .xs\:gap-3 {
    gap: var(--space-3);
  }
}

/* Small devices */
@media (min-width: 480px) {
  .sm\:p-4 {
    padding: var(--space-4);
  }
  .sm\:p-6 {
    padding: var(--space-6);
  }
  .sm\:m-0 {
    margin: 0;
  }
  .sm\:mb-4 {
    margin-bottom: var(--space-4);
  }
  .sm\:gap-4 {
    gap: var(--space-4);
  }
  .sm\:gap-6 {
    gap: var(--space-6);
  }
}

/* Medium devices */
@media (min-width: 640px) {
  .md\:p-6 {
    padding: var(--space-6);
  }
  .md\:p-8 {
    padding: var(--space-8);
  }
  .md\:m-0 {
    margin: 0;
  }
  .md\:mb-6 {
    margin-bottom: var(--space-6);
  }
  .md\:gap-6 {
    gap: var(--space-6);
  }
  .md\:gap-8 {
    gap: var(--space-8);
  }
}

/* Large devices */
@media (min-width: 1024px) {
  .lg\:p-8 {
    padding: var(--space-8);
  }
  .lg\:p-10 {
    padding: var(--space-10);
  }
  .lg\:m-0 {
    margin: 0;
  }
  .lg\:mb-8 {
    margin-bottom: var(--space-8);
  }
  .lg\:gap-8 {
    gap: var(--space-8);
  }
  .lg\:gap-10 {
    gap: var(--space-10);
  }
}

/* ============================================
   RESPONSIVE TYPOGRAPHY UTILITIES
   ============================================ */

/* Extra Small - Mobile */
@media (max-width: 480px) {
  .xs\:text-xs {
    font-size: var(--text-xs);
  }
  .xs\:text-sm {
    font-size: var(--text-sm);
  }
  .xs\:text-base {
    font-size: var(--text-base);
  }
}

/* Small devices */
@media (min-width: 480px) {
  .sm\:text-sm {
    font-size: var(--text-sm);
  }
  .sm\:text-base {
    font-size: var(--text-base);
  }
  .sm\:text-lg {
    font-size: var(--text-lg);
  }
}

/* Medium devices */
@media (min-width: 640px) {
  .md\:text-base {
    font-size: var(--text-base);
  }
  .md\:text-lg {
    font-size: var(--text-lg);
  }
  .md\:text-xl {
    font-size: var(--text-xl);
  }
}

/* Large devices */
@media (min-width: 1024px) {
  .lg\:text-lg {
    font-size: var(--text-lg);
  }
  .lg\:text-xl {
    font-size: var(--text-xl);
  }
  .lg\:text-2xl {
    font-size: var(--text-2xl);
  }
}

/* ============================================
   RESPONSIVE FLEX UTILITIES
   ============================================ */

/* Extra Small - Mobile */
@media (max-width: 480px) {
  .xs\:flex-column {
    flex-direction: column;
  }
  .xs\:flex-wrap {
    flex-wrap: wrap;
  }
  .xs\:justify-center {
    justify-content: center;
  }
  .xs\:items-center {
    align-items: center;
  }
  .xs\:w-full {
    width: 100%;
  }
}

/* Small devices */
@media (min-width: 480px) {
  .sm\:flex-wrap {
    flex-wrap: wrap;
  }
  .sm\:justify-between {
    justify-content: space-between;
  }
  .sm\:items-start {
    align-items: flex-start;
  }
}

/* Medium devices */
@media (min-width: 640px) {
  .md\:flex-nowrap {
    flex-wrap: nowrap;
  }
  .md\:justify-between {
    justify-content: space-between;
  }
  .md\:items-stretch {
    align-items: stretch;
  }
}

/* Large devices */
@media (min-width: 1024px) {
  .lg\:flex-nowrap {
    flex-wrap: nowrap;
  }
  .lg\:justify-between {
    justify-content: space-between;
  }
}

/* ============================================
   LAZY LOADING IMAGES
   ============================================ */

/* Base Lazy Image */
img.lazy {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

/* Loading State */
img.lazy-loading {
  opacity: 0.1;
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-secondary) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: lazy-image-loading 1.5s ease-in-out infinite;
}

@keyframes lazy-image-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Loaded State */
img.lazy-loaded {
  opacity: 1;
  background: none;
  animation: none;
}

/* Error State */
img.lazy-error {
  opacity: 0.5;
  background: var(--color-bg-tertiary);
  filter: grayscale(100%);
}

/* Lazy Image Container - maintains aspect ratio */
.lazy-image-container {
  position: relative;
  overflow: hidden;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-lg);
}

.lazy-image-container img.lazy {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Lazy Image Placeholder */
.lazy-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-secondary);
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}

.lazy-placeholder::before {
  content: "📷";
  opacity: 0.5;
}

/* Lazy Image with Aspect Ratio */
.lazy-image-container[data-aspect="16:9"] {
  aspect-ratio: 16 / 9;
}

.lazy-image-container[data-aspect="4:3"] {
  aspect-ratio: 4 / 3;
}

.lazy-image-container[data-aspect="1:1"] {
  aspect-ratio: 1 / 1;
}

.lazy-image-container[data-aspect="3:2"] {
  aspect-ratio: 3 / 2;
}

/* Lazy Image Fade In Animation */
.lazy-fade-in {
  animation: lazy-fade-in 0.5s ease-out;
}

@keyframes lazy-fade-in {
  from {
    opacity: 0;
    filter: blur(10px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

/* LQIP (Low Quality Image Placeholder) Blur */
img.lazy-lqip {
  filter: blur(20px);
  transition: filter 0.3s ease-out;
}

img.lazy-loaded.lazy-lqip {
  filter: blur(0);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  img.lazy,
  img.lazy-loading,
  img.lazy-loaded {
    transition: none;
    animation: none;
  }

  img.lazy-loading {
    background: var(--color-bg-tertiary);
  }

  .lazy-fade-in {
    animation: none;
  }
}

/* ============================================
   ERROR BOUNDARIES
   ============================================ */

/* Base Error Boundary */
.error-boundary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  min-height: 200px;
  border-radius: var(--radius-xl);
}

/* Error Boundary in Glass Card */
.error-boundary.glass-card {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );
  backdrop-filter: blur(var(--glass-blur, 20px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 20px));
  border: 1px solid var(--color-border-glass);
}

/* Error Icon */
.error-boundary-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
  font-size: var(--text-3xl);
}

.error-boundary-icon i {
  font-size: 2.5rem;
}

/* Error Types */
.error-boundary-icon.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-accent-red);
}

.error-boundary-icon.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-accent-amber);
}

.error-boundary-icon.info {
  background: rgba(6, 182, 212, 0.1);
  color: var(--color-accent-cyan);
}

.error-boundary-icon.empty {
  background: rgba(107, 114, 128, 0.1);
  color: var(--color-text-muted);
}

/* Error Content */
.error-boundary-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.error-boundary-message {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  max-width: 400px;
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
}

/* Error Actions */
.error-boundary-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: center;
}

/* No Results Modern - For database unavailable states */
.no-results-modern {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  text-align: center;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );
  border: 1px solid var(--color-border-glass);
  border-radius: var(--radius-xl);
}

.no-results-modern .no-results-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(107, 114, 128, 0.1);
  border-radius: 50%;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  font-size: var(--text-2xl);
}

.no-results-modern h3 {
  color: var(--color-text);
  margin-bottom: var(--space-2);
  font-family: var(--font-display);
  font-weight: var(--font-weight-semibold);
}

.no-results-modern p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
  max-width: 400px;
  line-height: var(--leading-relaxed);
}

/* Empty State Variant */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  font-size: var(--text-2xl);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.empty-state-message {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  max-width: 300px;
  margin-bottom: var(--space-4);
}

/* Database Error State */
.db-error-state {
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.05),
    rgba(239, 68, 68, 0.02)
  );
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
}

.db-error-state .error-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-accent-red);
  margin: 0 auto var(--space-4);
  font-size: var(--text-2xl);
}

.db-error-state .error-title {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent-red);
  margin-bottom: var(--space-2);
}

.db-error-state .error-message {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

/* Network Error State */
.network-error-state {
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.05),
    rgba(245, 158, 11, 0.02)
  );
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
}

.network-error-state .error-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-accent-amber);
  margin: 0 auto var(--space-4);
  font-size: var(--text-2xl);
}

.network-error-state .error-title {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent-amber);
  margin-bottom: var(--space-2);
}

.network-error-state .error-message {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

/* Video Error State */
.video-error-state {
  aspect-ratio: 16/9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-xl);
  text-align: center;
  padding: var(--space-6);
}

.video-error-state .error-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-accent-red);
  margin-bottom: var(--space-4);
  font-size: var(--text-xl);
}

.video-error-state .error-title {
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.video-error-state .error-message {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

/* Live Stream Error State */
.live-error-state {
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.05),
    rgba(239, 68, 68, 0.02)
  );
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  text-align: center;
}

.live-error-state .error-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-accent-red);
  margin: 0 auto var(--space-5);
  font-size: var(--text-3xl);
}

.live-error-state .error-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.live-error-state .error-message {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  max-width: 400px;
  margin: 0 auto var(--space-6);
}

/* Content Unavailable State */
.content-unavailable {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  min-height: 300px;
}

.content-unavailable .unavailable-icon {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: linear-gradient(
    135deg,
    rgba(107, 114, 128, 0.1),
    rgba(107, 114, 128, 0.05)
  );
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  font-size: var(--text-4xl);
}

.content-unavailable .unavailable-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.content-unavailable .unavailable-message {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  max-width: 450px;
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
}

/* Permission Denied State */
.permission-denied {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.05),
    rgba(245, 158, 11, 0.02)
  );
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-xl);
  min-height: 250px;
}

.permission-denied .denied-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-accent-amber);
  margin-bottom: var(--space-5);
  font-size: var(--text-3xl);
}

.permission-denied .denied-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.permission-denied .denied-message {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  max-width: 400px;
  margin-bottom: var(--space-6);
}

/* Error Boundary Animations */
.error-boundary-fade-in {
  animation: error-boundary-fade-in 0.4s ease-out;
}

@keyframes error-boundary-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.error-icon-pulse {
  animation: error-icon-pulse 2s ease-in-out infinite;
}

@keyframes error-icon-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Retry Button Animation */
.retry-button-loading {
  position: relative;
  pointer-events: none;
}

.retry-button-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: retry-spin 0.8s linear infinite;
}

@keyframes retry-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Error Boundaries */
@media (max-width: 640px) {
  .error-boundary {
    padding: var(--space-8) var(--space-4);
  }

  .error-boundary-icon {
    width: 64px;
    height: 64px;
  }

  .error-boundary-icon i {
    font-size: 2rem;
  }

  .error-boundary-title {
    font-size: var(--text-lg);
  }

  .error-boundary-message {
    font-size: var(--text-sm);
  }

  .error-boundary-actions {
    flex-direction: column;
    width: 100%;
  }

  .error-boundary-actions .btn {
    width: 100%;
  }

  .content-unavailable {
    padding: var(--space-10) var(--space-4);
  }

  .content-unavailable .unavailable-icon {
    width: 72px;
    height: 72px;
    font-size: var(--text-3xl);
  }

  .content-unavailable .unavailable-title {
    font-size: var(--text-xl);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .error-boundary-fade-in,
  .error-icon-pulse {
    animation: none;
  }

  .retry-button-loading::after {
    animation: none;
  }
}

/* ============================================
   COMPONENT MODULES
   ============================================ */

/* Note: Component CSS files (_stats.css, _video-player.css, _utilities.css, _bento-grid.css)
   are now loaded directly via header.php to ensure consistent path resolution across all pages.
   This avoids potential issues with relative @import paths when components.css is loaded
   from different directory levels (root, admin, dashboard). */
