/**
 * Captsr Component Library
 * A modern, Tailwind-inspired CSS component system
 *
 * Design Direction:
 * - Red Evil dark theme
 * - Primary color: #DC2626 (evil red)
 * - Dark backgrounds with red accents
 * - Red glow effects
 * - Mobile-first, accessible
 */

/* ==========================================================================
   CSS Custom Properties (Design Tokens)
   ========================================================================== */

:root {
  /* Primary Colors - Evil Red */
  --color-primary: #DC2626;
  --color-primary-hover: #EF4444;
  --color-primary-active: #B91C1C;
  --color-primary-light: #FEE2E2;
  --color-primary-dark: #991B1B;

  /* Gradient */
  --gradient-primary: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
  --gradient-primary-hover: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%);
  --gradient-background: linear-gradient(180deg, #1A0A0A 0%, #0D0505 100%);

  /* Background Colors - Dark/Black */
  --color-bg-base: #0D0505;
  --color-bg-elevated: #1A0A0A;
  --color-bg-surface: #2D1212;
  --color-bg-surface-hover: #3D1818;

  /* Neutral Colors - Dark Theme */
  --color-white: #FFFFFF;
  --color-gray-50: #1A0A0A;
  --color-gray-100: #2D1212;
  --color-gray-200: #3D1818;
  --color-gray-300: #5C2424;
  --color-gray-400: #737373;
  --color-gray-500: #A3A3A3;
  --color-gray-600: #D4D4D4;
  --color-gray-700: #E5E5E5;
  --color-gray-800: #F5F5F5;
  --color-gray-900: #FAFAFA;

  /* Text Colors */
  --color-text-primary: #F5F5F5;
  --color-text-secondary: #A3A3A3;
  --color-text-muted: #737373;

  /* Border Colors */
  --color-border: #3D1818;
  --color-border-hover: #5C2424;
  --color-border-focus: #DC2626;

  /* Semantic Colors */
  --color-success: #10B981;
  --color-success-light: #064E3B;
  --color-warning: #F59E0B;
  --color-warning-light: #78350F;
  --color-error: #EF4444;
  --color-error-light: #7F1D1D;
  --color-info: #3B82F6;
  --color-info-light: #1E3A8A;

  /* Shadows - Red glow */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(220, 38, 38, 0.4);
  --shadow-glow-strong: 0 0 30px rgba(220, 38, 38, 0.6);

  /* Border Radius */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Z-index layers */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
}

/* Dark mode is the default for Red Evil theme */
/* Light mode override (optional) */
:root[data-theme="light"] {
  --color-gray-50: #F9FAFB;
  --color-gray-100: #F3F4F6;
  --color-gray-200: #E5E7EB;
  --color-gray-300: #D1D5DB;
  --color-gray-400: #9CA3AF;
  --color-gray-500: #6B7280;
  --color-gray-600: #4B5563;
  --color-gray-700: #374151;
  --color-gray-800: #1F2937;
  --color-gray-900: #111827;
  --color-bg-base: #FFFFFF;
  --color-bg-elevated: #F9FAFB;
  --color-bg-surface: #F3F4F6;
  --color-bg-surface-hover: #E5E7EB;
}

/* ==========================================================================
   Base Reset & Typography
   ========================================================================== */

.captsr-base {
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled,
.btn.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button - Red Gradient */
.btn-primary {
  background: var(--gradient-primary);
  color: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gradient-primary-hover);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.97) translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Secondary Button - Outlined */
.btn-secondary {
  background: transparent;
  color: var(--color-gray-700);
  border: 2px solid var(--color-gray-300);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-gray-100);
  border-color: var(--color-gray-400);
  color: var(--color-gray-900);
}

.btn-secondary:active:not(:disabled) {
  background: var(--color-gray-200);
}

/* Ghost Button - Minimal */
.btn-ghost {
  background: transparent;
  color: var(--color-gray-600);
  padding: 0.5rem 0.75rem;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-gray-100);
  color: var(--color-gray-900);
}

.btn-ghost:active:not(:disabled) {
  background: var(--color-gray-200);
}

/* Icon Button */
.btn-icon {
  padding: 0.625rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  border-radius: var(--radius);
}

.btn-icon.btn-circle {
  border-radius: var(--radius-full);
}

/* Danger Button */
.btn-danger {
  background: var(--color-error);
  color: var(--color-white);
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  box-shadow: var(--shadow-md);
}

/* Success Button */
.btn-success {
  background: var(--color-success);
  color: var(--color-white);
}

.btn-success:hover:not(:disabled) {
  background: #059669;
  box-shadow: var(--shadow-md);
}

/* Button Sizes */
.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-xl {
  padding: 1rem 2rem;
  font-size: 1.125rem;
  border-radius: var(--radius-lg);
}

/* Full Width Button */
.btn-block {
  width: 100%;
}

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

.share-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-share:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-share:active {
  transform: scale(0.97);
}

/* Native share button - wider with text */
.btn-share-native {
  padding: 0.625rem 1.25rem;
}

.btn-share-native span {
  display: inline;
}

/* Platform buttons - icon only by default, with brand colors on hover */
.btn-share-x,
.btn-share-facebook,
.btn-share-whatsapp {
  padding: 0.625rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
}

.btn-share-x:hover {
  background: #000000;
  border-color: #000000;
}

.btn-share-facebook:hover {
  background: #1877F2;
  border-color: #1877F2;
}

.btn-share-whatsapp:hover {
  background: #25D366;
  border-color: #25D366;
}

/* Mobile responsive - hide text on native button */
@media (max-width: 480px) {
  .share-buttons {
    gap: 0.5rem;
  }

  .btn-share-native span {
    display: none;
  }

  .btn-share-native {
    padding: 0.625rem;
    min-width: 2.5rem;
  }
}

/* Button Loading State */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

.btn-primary.btn-loading::after {
  border-color: var(--color-white);
  border-right-color: transparent;
}

/* Button Group */
.btn-group {
  display: inline-flex;
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.btn-group .btn:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.btn-group .btn:not(:last-child) {
  border-right: 1px solid rgba(0, 0, 0, 0.1);
}

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

.card {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: all var(--transition);
}

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

.card-clickable {
  cursor: pointer;
}

.card-clickable:active {
  transform: scale(0.98);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-gray-100);
}

.card-header-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-gray-900);
  margin: 0;
}

.card-body {
  padding: 1.5rem;
}

.card-body-compact {
  padding: 1rem 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-gray-100);
  background: var(--color-gray-50);
}

/* Card with image */
.card-image {
  width: 100%;
  height: auto;
  display: block;
}

.card-image-container {
  position: relative;
  overflow: hidden;
}

.card-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 50%);
  display: flex;
  align-items: flex-end;
  padding: 1.5rem;
}

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

.card-primary {
  border-left: 4px solid var(--color-primary);
}

.card-success {
  border-left: 4px solid var(--color-success);
}

.card-warning {
  border-left: 4px solid var(--color-warning);
}

.card-error {
  border-left: 4px solid var(--color-error);
}

/* ==========================================================================
   MODALS
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), var(--shadow-glow);
  z-index: var(--z-modal);
  width: calc(100% - 2rem);
  max-width: 500px;
  max-height: calc(100vh - 4rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-spring);
}

.modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-sm {
  max-width: 380px;
}

.modal-lg {
  max-width: 680px;
}

.modal-xl {
  max-width: 900px;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

.modal-close {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-surface);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Fullscreen modal for mobile */
.modal-fullscreen {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  transform: translate(-50%, -50%) translateY(20px);
}

.modal-fullscreen.active {
  transform: translate(-50%, -50%) translateY(0);
}

@media (min-width: 640px) {
  .modal-fullscreen {
    width: calc(100% - 2rem);
    height: auto;
    max-width: 500px;
    max-height: calc(100vh - 4rem);
    border-radius: var(--radius-xl);
  }
}

/* ==========================================================================
   FORM INPUTS
   ========================================================================== */

.input {
  display: block;
  width: 100%;
  padding: 0.625rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
  outline: none;
}

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

.input:hover:not(:disabled):not(:focus) {
  border-color: var(--color-gray-300);
}

.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.input:disabled {
  background: var(--color-gray-100);
  cursor: not-allowed;
  opacity: 0.7;
}

/* Input Sizes */
.input-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
}

.input-lg {
  padding: 0.875rem 1.25rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

/* Input States */
.input-error {
  border-color: var(--color-error);
}

.input-error:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px var(--color-error-light);
}

.input-success {
  border-color: var(--color-success);
}

.input-success:focus {
  border-color: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-light);
}

/* Input with Icon */
.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-gray-400);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.input-icon-left {
  left: 1rem;
}

.input-icon-right {
  right: 1rem;
}

.input-with-icon-left {
  padding-left: 2.75rem;
}

.input-with-icon-right {
  padding-right: 2.75rem;
}

.input:focus ~ .input-icon {
  color: var(--color-primary);
}

/* Textarea */
.textarea {
  display: block;
  width: 100%;
  min-height: 100px;
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.625;
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  resize: vertical;
  transition: all var(--transition-fast);
  outline: none;
}

.textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.textarea-error {
  border-color: var(--color-error);
}

/* Character Counter */
.char-counter {
  font-size: 0.75rem;
  color: var(--color-gray-500);
  text-align: right;
  margin-top: 0.25rem;
}

.char-counter-warning {
  color: var(--color-warning);
}

.char-counter-error {
  color: var(--color-error);
}

/* Select */
.select {
  display: block;
  width: 100%;
  padding: 0.625rem 2.5rem 0.625rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23A3A3A3'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: all var(--transition-fast);
  outline: none;
}

.select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Checkbox */
.checkbox-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.checkbox:hover {
  border-color: var(--color-gray-400);
}

.checkbox:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.checkbox:checked {
  background: var(--gradient-primary);
  border-color: var(--color-primary);
}

.checkbox:checked::after {
  content: '';
  position: absolute;
  top: 0.125rem;
  left: 0.375rem;
  width: 0.375rem;
  height: 0.625rem;
  border: 2px solid var(--color-white);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.checkbox-label {
  font-size: 0.9375rem;
  color: var(--color-gray-700);
}

/* Radio */
.radio {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.radio:checked {
  border-color: var(--color-primary);
}

.radio:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0.625rem;
  height: 0.625rem;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
}

.radio:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Form Label */
.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-gray-700);
  margin-bottom: 0.5rem;
}

.label-required::after {
  content: ' *';
  color: var(--color-error);
}

/* Form Helper Text */
.form-helper {
  font-size: 0.8125rem;
  color: var(--color-gray-500);
  margin-top: 0.375rem;
}

.form-error {
  font-size: 0.8125rem;
  color: var(--color-error);
  margin-top: 0.375rem;
}

/* Form Group */
.form-group {
  margin-bottom: 1.25rem;
}

/* ==========================================================================
   BADGES & PILLS
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--radius-sm);
  background: var(--color-gray-100);
  color: var(--color-gray-700);
}

.badge-primary {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.badge-success {
  background: var(--color-success-light);
  color: #6EE7B7; /* Light green for dark background */
}

.badge-warning {
  background: var(--color-warning-light);
  color: #FCD34D; /* Light amber for dark background */
}

.badge-error {
  background: var(--color-error-light);
  color: #FCA5A5; /* Light red for dark background */
}

.badge-info {
  background: var(--color-info-light);
  color: #93C5FD; /* Light blue for dark background */
}

/* Badge with dot indicator */
.badge-dot {
  padding-left: 0.375rem;
}

.badge-dot::before {
  content: '';
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* Pill (larger, more rounded) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--radius-full);
  background: var(--color-gray-100);
  color: var(--color-gray-700);
}

.pill-primary {
  background: var(--gradient-primary);
  color: var(--color-white);
}

.pill-outline {
  background: transparent;
  border: 1px solid var(--color-gray-300);
}

/* ==========================================================================
   LOADING STATES
   ========================================================================== */

/* Spinner */
.spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--color-gray-200);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

.spinner-sm {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
}

.spinner-lg {
  width: 2.5rem;
  height: 2.5rem;
  border-width: 3px;
}

.spinner-xl {
  width: 3.5rem;
  height: 3.5rem;
  border-width: 4px;
}

.spinner-primary {
  border-color: rgba(220, 38, 38, 0.3);
  border-top-color: var(--color-primary);
}

.spinner-white {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: var(--color-white);
}

/* For dark backgrounds */
.spinner-primary-dark {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: var(--color-primary);
}

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

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-gray-200) 0%,
    var(--color-gray-100) 50%,
    var(--color-gray-200) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
  border-radius: 0.25rem;
}

.skeleton-text:last-child {
  width: 80%;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 1rem;
}

.skeleton-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
}

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
}

.skeleton-button {
  height: 2.5rem;
  width: 6rem;
  border-radius: var(--radius);
}

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

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 10;
  border-radius: inherit;
}

.loading-overlay-dark {
  background: rgba(0, 0, 0, 0.7);
  color: var(--color-white);
}

.loading-text {
  font-size: 0.875rem;
  color: var(--color-gray-600);
}

/* ==========================================================================
   PROGRESS & STEPS
   ========================================================================== */

/* Step Indicator */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.step {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--color-gray-200);
  color: var(--color-gray-500);
  transition: all var(--transition);
}

.step-active {
  background: var(--gradient-primary);
  color: var(--color-white);
  box-shadow: var(--shadow-glow);
  animation: step-activate 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes step-activate {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); box-shadow: var(--shadow-glow-strong); }
  100% { transform: scale(1); box-shadow: var(--shadow-glow); }
}

.step-completed {
  background: var(--color-success);
  color: var(--color-white);
}

.step-connector {
  width: 2rem;
  height: 2px;
  background: var(--color-gray-200);
  transition: all var(--transition);
}

.step-connector-active {
  background: var(--color-primary);
}

/* Horizontal Steps with Labels */
.steps-horizontal {
  display: flex;
  justify-content: space-between;
  position: relative;
}

.steps-horizontal::before {
  content: '';
  position: absolute;
  top: 1.125rem;
  left: 2rem;
  right: 2rem;
  height: 2px;
  background: var(--color-gray-200);
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}

.step-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-gray-500);
  text-align: center;
  max-width: 80px;
}

.step-active + .step-label,
.step-item.active .step-label {
  color: var(--color-gray-900);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 0.5rem;
  background: var(--color-gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-bar-animated .progress-bar-fill {
  background: linear-gradient(
    90deg,
    var(--color-primary) 0%,
    var(--color-primary-hover) 50%,
    var(--color-primary) 100%
  );
  background-size: 200% 100%;
  animation: progress-shimmer 2s linear infinite;
}

@keyframes progress-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.progress-bar-lg {
  height: 0.75rem;
}

/* ==========================================================================
   COUNTDOWN RING
   ========================================================================== */

.countdown-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.countdown-ring svg {
  transform: rotate(-90deg);
}

.countdown-ring-circle {
  fill: none;
  stroke: var(--color-gray-200);
  stroke-width: 4;
}

.countdown-ring-progress {
  fill: none;
  stroke: url(#countdown-gradient);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.countdown-ring-text {
  position: absolute;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-gray-900);
  font-variant-numeric: tabular-nums;
  transition: transform var(--transition-fast);
}

/* Number scale animation when value changes */
.countdown-ring-text.value-changed {
  animation: countdown-value-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes countdown-value-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.countdown-ring-text-sm {
  font-size: 1rem;
}

.countdown-ring-text-lg {
  font-size: 2rem;
}

/* Low time warning glow */
.countdown-ring-warning .countdown-ring-progress {
  stroke: var(--color-error);
  filter: drop-shadow(0 0 8px var(--color-error));
}

.countdown-ring-warning .countdown-ring-text {
  color: var(--color-error);
  animation: pulse-text 1s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Inline countdown gradient definition */
.countdown-gradient-def {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ==========================================================================
   UPLOAD ZONE
   ========================================================================== */

.upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 200px;
  padding: 2rem;
  background: var(--color-bg-elevated);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition), transform var(--transition-fast);
}

.upload-zone:hover {
  background: var(--color-bg-surface);
  border-color: var(--color-primary);
}

.upload-zone-active,
.upload-zone.dragover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  border-style: solid;
  box-shadow: inset 0 0 0 2px var(--color-primary-light), var(--shadow-glow);
  transform: scale(1.02);
}

/* File drop bounce animation */
.upload-zone.file-dropped {
  animation: file-drop-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes file-drop-bounce {
  0% { transform: scale(1.02); }
  40% { transform: scale(0.98); }
  60% { transform: scale(1.01); }
  100% { transform: scale(1); }
}

.upload-zone-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.upload-zone-icon {
  width: 3rem;
  height: 3rem;
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.upload-zone:hover .upload-zone-icon,
.upload-zone-active .upload-zone-icon {
  color: var(--color-primary);
  transform: translateY(-4px);
}

.upload-zone-text {
  text-align: center;
}

.upload-zone-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.25rem;
}

.upload-zone-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.upload-zone-formats {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

/* Upload Preview */
.upload-zone-preview {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  animation: preview-fade-in 0.3s ease-out;
}

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

.upload-zone-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.upload-zone-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.upload-zone-preview:hover .upload-zone-preview-overlay {
  opacity: 1;
}

/* Upload Progress */
.upload-progress {
  width: 100%;
  margin-top: 1rem;
}

.upload-progress-bar {
  height: 4px;
  background: var(--color-gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  transition: width var(--transition);
}

.upload-progress-text {
  font-size: 0.8125rem;
  color: var(--color-gray-600);
  text-align: center;
  margin-top: 0.5rem;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast-container-top {
  top: 1.5rem;
  bottom: auto;
}

.toast-container-left {
  left: 1.5rem;
  right: auto;
}

.toast-container-center {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 280px;
  max-width: 400px;
  padding: 1rem 1.25rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-slide-in var(--transition-spring);
}

.toast-exiting {
  animation: toast-slide-out var(--transition) forwards;
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-slide-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-gray-900);
  margin-bottom: 0.125rem;
}

.toast-message {
  font-size: 0.875rem;
  color: var(--color-gray-600);
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--color-gray-400);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toast-close:hover {
  background: var(--color-gray-100);
  color: var(--color-gray-600);
}

/* Toast Variants */
.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast-success .toast-icon {
  color: var(--color-success);
}

.toast-error {
  border-left: 4px solid var(--color-error);
}

.toast-error .toast-icon {
  color: var(--color-error);
}

.toast-warning {
  border-left: 4px solid var(--color-warning);
}

.toast-warning .toast-icon {
  color: var(--color-warning);
}

.toast-info {
  border-left: 4px solid var(--color-info);
}

.toast-info .toast-icon {
  color: var(--color-info);
}

/* Toast with action button */
.toast-action {
  margin-top: 0.5rem;
}

.toast-action .btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

/* Gradients */
.gradient-primary {
  background: var(--gradient-primary);
}

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Shadows */
.shadow-soft {
  box-shadow: var(--shadow-soft);
}

.shadow-glow {
  box-shadow: var(--shadow-glow);
}

.shadow-glow-strong {
  box-shadow: var(--shadow-glow-strong);
}

/* Animations */
.animate-fade-in {
  animation: fade-in var(--transition) ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-slide-up {
  animation: slide-up var(--transition) ease-out;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-down {
  animation: slide-down var(--transition) ease-out;
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-scale-in {
  animation: scale-in var(--transition-spring);
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: var(--shadow-glow);
  }
  50% {
    box-shadow: var(--shadow-glow-strong);
  }
}

.animate-bounce {
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(-5%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

/* Transition utilities */
.transition-all {
  transition: all var(--transition);
}

.transition-fast {
  transition: all var(--transition-fast);
}

.transition-slow {
  transition: all var(--transition-slow);
}

/* Container */
.container-captsr {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .container-captsr {
    padding: 0 1.5rem;
  }
}

/* Flex utilities */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.focus-ring:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Backdrop blur */
.backdrop-blur {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.backdrop-blur-sm {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.backdrop-blur-lg {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Glass effect */
.glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-white);
}

/* Truncate */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   DROPDOWN MENU
   ========================================================================== */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  padding: 0.5rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition);
}

.dropdown-menu.active,
.dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
}

.dropdown-menu-right {
  left: auto;
  right: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--color-gray-700);
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--color-gray-100);
  color: var(--color-gray-900);
}

.dropdown-item-icon {
  width: 1rem;
  height: 1rem;
  color: var(--color-gray-400);
}

.dropdown-divider {
  height: 1px;
  margin: 0.5rem 0;
  background: var(--color-gray-200);
}

/* ==========================================================================
   AVATAR
   ========================================================================== */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: var(--color-white);
  font-weight: 600;
  font-size: 0.9375rem;
  overflow: hidden;
}

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

.avatar-sm {
  width: 2rem;
  height: 2rem;
  font-size: 0.75rem;
}

.avatar-lg {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.25rem;
}

.avatar-xl {
  width: 5rem;
  height: 5rem;
  font-size: 1.75rem;
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--color-white);
  margin-left: -0.75rem;
}

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

/* ==========================================================================
   TOOLTIP
   ========================================================================== */

.tooltip {
  position: relative;
}

.tooltip::before,
.tooltip::after {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
}

.tooltip::before {
  content: attr(data-tooltip);
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  background: var(--color-gray-900);
  color: var(--color-white);
  border-radius: var(--radius-sm);
}

.tooltip::after {
  content: '';
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--color-gray-900);
}

.tooltip:hover::before,
.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   DIVIDER
   ========================================================================== */

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--color-gray-400);
  font-size: 0.8125rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-gray-200);
}

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

@media (max-width: 639px) {
  .hidden-mobile {
    display: none !important;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }
}

@media (min-width: 640px) {
  .hidden-desktop {
    display: none !important;
  }
}

/* ==========================================================================
   WEBCAM CAPTURE
   ========================================================================== */

/* Camera button in upload zone */
.btn-camera {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.upload-zone-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.upload-zone-divider::before,
.upload-zone-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
  max-width: 3rem;
}

/* Webcam modal */
#webcam-modal .modal {
  max-width: 420px;
}

#webcam-modal .modal-body {
  padding: 0;
  background: var(--color-bg-base);
}

/* Webcam container - 9:16 aspect ratio */
.webcam-container {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: var(--color-bg-base);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.webcam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror for front camera */
}

.webcam-video.rear-camera {
  transform: scaleX(1); /* Don't mirror rear camera */
}

/* Webcam loading state */
.webcam-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-base);
  color: var(--color-text-secondary);
  gap: 1rem;
}

.webcam-loading.hidden {
  display: none;
}

/* Webcam error state */
.webcam-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background: var(--color-bg-base);
  color: var(--color-text-secondary);
}

.webcam-error.hidden {
  display: none;
}

.webcam-error svg {
  color: var(--color-error);
  margin-bottom: 1rem;
}

.webcam-error p {
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Webcam modal footer - 3-column grid for centered capture button */
#webcam-modal .modal-footer {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  padding: 1rem 1.5rem;
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border);
}

#webcam-modal .modal-footer > button:first-child {
  justify-self: start;
}

#webcam-modal .modal-footer > button:nth-child(2) {
  justify-self: center;
}

#webcam-modal .modal-footer > button:last-child {
  justify-self: end;
}

/* Capture button (big circle) */
.btn-capture {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  padding: 0;
  position: relative;
  background: var(--color-primary);
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-capture:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.3);
}

.btn-capture:active {
  transform: scale(0.95);
}

.capture-ring {
  position: absolute;
  inset: 4px;
  border: 3px solid var(--color-white);
  border-radius: var(--radius-full);
  pointer-events: none;
}

/* Camera switch button */
.btn-switch-camera {
  padding: 0.75rem;
  border-radius: var(--radius-full);
}

.btn-switch-camera svg {
  transition: transform 0.3s ease;
}

.btn-switch-camera:active svg {
  transform: rotate(180deg);
}

/* Hide camera button if not supported */
.no-camera .btn-camera,
.no-camera .upload-zone-divider {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 639px) {
  #webcam-modal .modal {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    margin: 0;
  }

  #webcam-modal .modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0;
  }

  #webcam-modal .modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .webcam-container {
    max-height: 100%;
  }

  #webcam-modal .modal-footer {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

/* ==========================================================================
   RESULT SECTION (Full-bleed image result display)
   ========================================================================== */

.result-section {
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile */
  background: var(--color-bg-base);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
}

.result-section.hidden {
  display: none;
}

/* Full-bleed image display */
.result-image-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  overflow: hidden;
}

.result-image-wrapper {
  position: relative;
  max-width: 400px;
  width: 100%;
}

.result-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: block;
}

/* Countdown ring overlay (top right of image) */
.result-countdown-overlay {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-full);
  padding: 0.25rem;
}

/* Small countdown ring variant */
.countdown-ring-sm {
  width: 48px;
  height: 48px;
}

.countdown-ring-sm svg {
  width: 48px;
  height: 48px;
}

.countdown-ring-sm .countdown-ring-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-white);
}

.countdown-ring-sm .countdown-ring-circle {
  stroke-width: 3;
}

.countdown-ring-sm .countdown-ring-progress {
  stroke-width: 3;
}

/* Action bar at bottom */
.result-action-bar {
  background: rgba(45, 18, 18, 0.98); /* Lighter for better contrast */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--color-border-hover);
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.result-action-content {
  max-width: 400px;
  margin: 0 auto;
}

/* Share URL with copy button */
.share-url-container {
  margin-bottom: 1rem;
}

.share-url-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.share-url-input {
  width: 100%;
  padding-right: 3rem;
  background: var(--color-bg-surface-hover);
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
  font-size: 0.875rem;
}

.share-url-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.3);
}

.copy-url-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.5rem;
  color: #D4D4D4; /* Brighter for better contrast */
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 2rem;
  min-height: 2rem;
}

.copy-url-btn:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.copy-url-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.copy-url-btn .copy-icon,
.copy-url-btn .check-icon {
  width: 1.25rem;
  height: 1.25rem;
  transition: all var(--transition-fast);
}

.copy-url-btn .check-icon {
  color: var(--color-success);
}

.copy-url-btn .hidden {
  display: none;
}

/* Action buttons */
.result-actions {
  display: flex;
  gap: 0.75rem;
}

.result-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius);
  min-height: 48px; /* Touch-friendly */
}

.result-action-btn svg {
  flex-shrink: 0;
}

.result-action-btn.btn-secondary {
  background: transparent;
  color: var(--color-text-primary);
  border: 2px solid #7C3030; /* More visible border */
}

.result-action-btn.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-text-muted);
}

/* Safe area utilities for iOS */
.safe-area-top {
  padding-top: max(1rem, env(safe-area-inset-top));
}

.safe-area-bottom {
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.safe-area-left {
  padding-left: max(1rem, env(safe-area-inset-left));
}

.safe-area-right {
  padding-right: max(1rem, env(safe-area-inset-right));
}

/* ==========================================================================
   TOAST CONTAINER POSITIONING
   ========================================================================== */

.toast-container-top {
  top: 1.5rem;
  bottom: auto;
  top: max(1.5rem, env(safe-area-inset-top));
}

/* Mobile toast adjustments for result section */
@media (max-width: 639px) {
  .result-section .toast-container {
    left: 1rem;
    right: 1rem;
  }
}


/* ==========================================================================
   CARD HOVER ENHANCEMENTS (Admin Page)
   ========================================================================== */

.picture-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.picture-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.15);
}

.picture-card:active {
  transform: translateY(-2px);
}

/* Image zoom on hover */
.picture-card .bg-gray-100 img {
  transition: transform 0.3s ease;
}

.picture-card:hover .bg-gray-100 img {
  transform: scale(1.05);
}

/* Selection checkbox animation */
.card-checkbox {
  transition: all 0.15s ease;
}

.card-checkbox:hover {
  transform: scale(1.1);
}

.card-checkbox.checked,
.picture-card.selected .card-checkbox {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}

.card-checkbox.checked svg,
.picture-card.selected .card-checkbox svg {
  opacity: 1 !important;
}

/* Floating action bar animation */
#floating-action-bar {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

#floating-action-bar.hidden {
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
}

#floating-action-bar:not(.hidden) {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   FORM INPUT FOCUS ANIMATIONS
   ========================================================================== */

.input:focus,
.textarea:focus,
.select:focus {
  transform: translateY(-1px);
}

/* ==========================================================================
   RIPPLE EFFECT FOR BUTTONS (Optional Enhancement)
   ========================================================================== */

.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
}

/* ==========================================================================
   REDUCED MOTION PREFERENCES
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .upload-zone,
  .upload-zone.dragover,
  .upload-zone.file-dropped {
    transform: none !important;
  }

  .step-active {
    animation: none !important;
  }

  .countdown-ring-text.value-changed {
    animation: none !important;
  }
}

/* ==========================================================================
   SINGLE SCREEN LAYOUT (No-Scroll Interface)
   ========================================================================== */

/* Main App Container - Full viewport height */
.captsr-app {
  height: 100dvh;
  height: 100vh; /* fallback for older browsers */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--gradient-background);
}

/* App Container - Centers content */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 750px;
  max-width: 28rem;
  width: 100%;
}

/* Header - Fixed 48px */
.app-header {
  flex-shrink: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}

.app-logo {
  display: inline-flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  position: relative;
}

/* Caption-style brackets */
.logo-bracket {
  font-weight: 300;
  color: var(--color-primary);
  opacity: 0.7;
  font-size: 1.3em;
  line-height: 1;
  transition: all 0.3s ease;
}

.app-logo:hover .logo-bracket {
  opacity: 1;
  color: var(--color-primary-hover);
  text-shadow: 0 0 12px rgba(220, 38, 38, 0.6);
}

/* Main logo text container */
.logo-text {
  display: inline-flex;
  align-items: baseline;
}

/* "Capt" - the capture/caption part - bold gradient */
.logo-cap {
  background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 50%, #e5e5e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  letter-spacing: -0.03em;
  position: relative;
}

/* "sr" - lighter weight, subtle red tint */
.logo-sr {
  font-weight: 400;
  color: var(--color-primary);
  opacity: 0.9;
  letter-spacing: 0;
  font-style: italic;
}

/* Blinking cursor - like typing a caption */
.logo-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--color-primary);
  margin-left: 3px;
  animation: cursor-blink 1s step-end infinite;
  opacity: 0.8;
  border-radius: 1px;
}

@keyframes cursor-blink {
  0%, 50% { opacity: 0.8; }
  51%, 100% { opacity: 0; }
}

/* Hover state - glow effect */
.app-logo:hover .logo-cap {
  background: linear-gradient(135deg, #ffffff 0%, #fef2f2 50%, #fecaca 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.app-logo:hover .logo-sr {
  color: var(--color-primary-hover);
  text-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

.app-logo:hover .logo-cursor {
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.6);
}

/* Hero Section */
.hero-section {
  flex-shrink: 0;
  text-align: center;
  padding: 0.5rem 1rem 0.75rem;
}

.hero-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.hero-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.4;
}

@media (min-width: 640px) {
  .hero-section {
    padding: 1rem 1.5rem 1.25rem;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }
}

/* Main Content Area - Flexbox column with gaps */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 16px 16px;
  gap: 12px;
}

/* Upload Zone - Flexible, grows to fill space */
.upload-zone-compact {
  flex: 1;
  min-height: 120px;
  max-height: 45vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  position: relative;
}

.upload-zone-compact:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.upload-zone-compact.dragover {
  background: var(--color-primary-light);
  box-shadow: inset 0 0 0 3px var(--color-primary), var(--shadow-glow);
}

.upload-zone-compact .upload-zone-content {
  padding: 1rem;
}

.upload-zone-compact .upload-zone-preview {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ensure hidden class works on upload zone elements */
.upload-zone-compact .upload-zone-preview.hidden {
  display: none !important;
}

.upload-zone-compact .upload-zone-content.hidden {
  display: none !important;
}

/* Live Preview Container - 9:16 aspect ratio */
.live-preview-container {
  position: relative;
  width: auto;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.live-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Live Timer Preview - Top right corner */
.live-preview-timer {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.live-preview-timer span {
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
}

/* Live Text Preview - Caption band overlay (full-width) */
/* Aligned with overlay-template.html for accurate preview */
.live-preview-text {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px 16px;
  text-align: center;
  cursor: move;
  user-select: none;
  z-index: 10;
}

.live-preview-text span {
  color: #FFFFFF;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
  display: block;
  word-wrap: break-word;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}


/* Caption Input Row - Fixed 56px */
.caption-input-row {
  flex-shrink: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.caption-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.caption-input {
  flex: 1;
  border: none;
  padding: 0.75rem 1rem;
  padding-right: 5.5rem;
  font-size: 1rem;
  background: transparent;
  color: var(--color-text-primary);
}

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

.caption-input:focus {
  outline: none;
  box-shadow: none;
}

.caption-input-wrapper:focus-within {
  box-shadow: 0 0 0 2px var(--color-primary), var(--shadow-soft);
}

.emoji-btn {
  position: absolute;
  right: 2.75rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.5rem;
  z-index: 10;
  cursor: pointer;
}

.position-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.5rem;
  color: var(--color-gray-500);
  z-index: 10;
  cursor: pointer;
}

.position-btn:hover {
  color: var(--color-primary-dark);
}

.char-counter-inline {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  min-width: 32px;
  text-align: right;
}

.char-counter-inline.char-counter-warning {
  color: #FCA5A5;
}

.char-counter-inline.char-counter-error {
  color: #FCA5A5;
}

/* Countdown Row - Fixed 72px */
.countdown-row {
  flex-shrink: 0;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius);
  padding: 0 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--color-border);
}

/* Mini Countdown Ring */
.countdown-ring-mini {
  flex-shrink: 0;
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-ring-mini svg {
  transform: rotate(-90deg);
}

.countdown-ring-mini .countdown-ring-circle {
  fill: none;
  stroke: var(--color-gray-200);
}

.countdown-ring-mini .countdown-ring-progress {
  fill: none;
  stroke: url(#countdown-gradient);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.countdown-ring-text-mini {
  position: absolute;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-gray-900);
  font-variant-numeric: tabular-nums;
}

.countdown-ring-text-mini.value-changed {
  animation: countdown-value-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Countdown Slider */
.countdown-slider-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
}

.countdown-slider {
  width: 100%;
  height: 6px;
  background: var(--color-gray-200);
  border-radius: var(--radius-full);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.countdown-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.countdown-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2), var(--shadow-glow);
}

.countdown-slider::-webkit-slider-thumb:active {
  transform: scale(1.05);
}

.countdown-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.countdown-slider::-moz-range-track {
  background: var(--color-gray-200);
  height: 6px;
  border-radius: var(--radius-full);
}

/* Countdown Label */
.countdown-label {
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Generate Button - Fixed 56px */
.btn-generate {
  flex-shrink: 0;
  height: 56px;
  width: 100%;
  font-size: 1.125rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
}

/* Reset Button */
.reset-btn {
  margin-top: 8px;
  width: 100%;
  justify-content: center;
  color: var(--gray-400);
  font-size: 0.875rem;
}

.reset-btn:hover {
  color: var(--gray-200);
}

/* Mobile optimizations */
@media (max-height: 600px) {
  .app-header {
    height: 40px;
  }

  .app-main {
    gap: 8px;
    padding-bottom: 12px;
  }

  .upload-zone-compact {
    min-height: 80px;
    max-height: 35vh;
  }

  .countdown-row {
    height: 56px;
    padding: 0 12px;
    gap: 12px;
  }

  .countdown-ring-mini {
    width: 36px;
    height: 36px;
  }

  .countdown-ring-mini svg {
    width: 36px;
    height: 36px;
  }

  .countdown-ring-text-mini {
    font-size: 0.875rem;
  }

  .btn-generate {
    height: 48px;
  }
}

/* Safe area for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
  .app-header {
    padding-top: env(safe-area-inset-top);
    height: calc(48px + env(safe-area-inset-top));
  }

  .app-main {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* Landscape orientation adjustment */
@media (orientation: landscape) and (max-height: 500px) {
  .app-main {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .upload-zone-compact {
    flex: 1 1 40%;
    min-height: 100px;
    max-height: none;
  }

  .caption-input-row {
    flex: 1 1 55%;
  }

  .countdown-row {
    flex: 1 1 65%;
    height: 48px;
  }

  .btn-generate {
    flex: 1 1 30%;
    height: 48px;
  }
}

/* ==========================================================================
   CROPPER.JS DARK THEME OVERRIDES
   ========================================================================== */

.cropper-container {
  background-color: var(--color-bg-base) !important;
}

.cropper-bg {
  background-color: var(--color-bg-elevated) !important;
}

.cropper-modal {
  background-color: rgba(13, 5, 5, 0.7) !important;
}

.cropper-view-box {
  outline-color: var(--color-primary) !important;
}

.cropper-line {
  background-color: var(--color-primary) !important;
}

.cropper-point {
  background-color: var(--color-primary) !important;
}

.cropper-dashed {
  border-color: rgba(220, 38, 38, 0.5) !important;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background: linear-gradient(to top, rgba(13, 5, 5, 0.9), transparent);
  pointer-events: none;
  z-index: 10;
}

.app-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
  pointer-events: auto;
  transition: color 0.15s ease;
}

.app-footer a:hover {
  color: var(--color-primary);
}

.footer-dot {
  display: inline-block;
  width: 3px;
  height: 3px;
  background: var(--color-text-muted);
  border-radius: 50%;
  margin: 0 0.5rem;
  vertical-align: middle;
  opacity: 0.5;
}

/* ==========================================================================
   VIDEO UPLOAD FEATURE
   ========================================================================== */

/* Upload Tabs */
.upload-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-shrink: 0;
}

.upload-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg-surface);
  color: var(--color-text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}

.upload-tab:hover {
  border-color: var(--color-primary);
  color: var(--color-text-primary);
}

.upload-tab.active {
  background: var(--gradient-primary);
  border-color: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

.upload-tab svg {
  width: 1rem;
  height: 1rem;
}

/* Upload Sections */
.upload-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
  min-height: 0;
}

.upload-section.hidden {
  display: none;
}

/* Video Preview Container */
.video-preview-container {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.video-preview-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Video Caption Band Overlay */
.video-caption-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px 16px;
  text-align: center;
  cursor: move;
  transition: top 0.1s ease-out;
}

.video-caption-band.hidden {
  display: none;
}

.video-caption-band span {
  color: white;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.3;
  display: block;
  word-wrap: break-word;
}

/* Video Timer Ring Overlay */
.video-timer-ring {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-timer-ring span {
  color: white;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Video Controls */
.video-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0;
}

/* Preview Section */
.preview-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
  min-height: 0;
}

.preview-section.hidden {
  display: none;
}

/* Processing Overlay */
.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.processing-overlay.hidden {
  display: none;
}

.processing-content {
  text-align: center;
  color: white;
  max-width: 300px;
  padding: 2rem;
}

.processing-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
  color: var(--color-text-primary);
}

.processing-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  animation: spin 1s linear infinite;
}

.processing-content .progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}

.processing-content .progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.progress-hint {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Video drop zone specific styles */
#video-drop-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#video-drop-zone.dragover {
  background: var(--color-primary-light);
  box-shadow: inset 0 0 0 3px var(--color-primary), var(--shadow-glow);
}

/* Video preview section layout */
#video-preview-section .video-preview-container {
  flex: 1;
  max-height: 45vh;
  width: auto;
  height: auto;
}

#video-preview-section .video-controls {
  flex-shrink: 0;
}

/* Responsive adjustments for video */
@media (max-height: 600px) {
  #video-preview-section .video-preview-container {
    max-height: 35vh;
  }

  .video-controls {
    gap: 0.5rem;
  }
}

/* Video position btn full width */
#video-position-btn {
  width: 100%;
  justify-content: center;
}
