/* ═══════════════════════════════════════════
   CompressKit — Component Styles
   ═══════════════════════════════════════════ */

/* ── Glass Card ── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  transition: all var(--transition-base);
}
.card:hover {
  background: var(--bg-card-hover);
}
.card--no-hover:hover {
  background: var(--bg-card);
}
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Dropzone ── */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-12) var(--sp-8);
  border: 2px dashed var(--border-dropzone);
  border-radius: var(--radius-xl);
  background: var(--bg-dropzone);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, var(--accent-blue-light) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-base);
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--border-dropzone-hover);
  background: var(--bg-dropzone-hover);
  transform: scale(1.005);
}
.dropzone:hover::before,
.dropzone.dragover::before {
  opacity: 1;
}
.dropzone__icon {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  color: var(--accent-blue);
  opacity: 0.7;
  transition: opacity var(--transition-base);
}
.dropzone:hover .dropzone__icon {
  opacity: 1;
}
.dropzone__text {
  position: relative;
  z-index: 1;
  font-size: 0.95rem;
  color: var(--text-secondary);
}
.dropzone__text strong {
  color: var(--accent-blue);
}
.dropzone__hint {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  line-height: 1.5;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn--primary {
  background: var(--accent-blue);
  color: #fff;
}
.btn--primary:hover:not(:disabled) {
  background: var(--accent-blue-hover);
  box-shadow: var(--shadow-glow-blue);
  transform: translateY(-1px);
}

.btn--secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-secondary);
}
.btn--secondary:hover:not(:disabled) {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
}

.btn--success {
  background: var(--accent-green);
  color: #fff;
}
.btn--success:hover:not(:disabled) {
  box-shadow: var(--shadow-glow-green);
  transform: translateY(-1px);
}

.btn--danger {
  background: var(--accent-red);
  color: #fff;
}
.btn--danger:hover:not(:disabled) {
  opacity: 0.9;
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--bg-input);
  color: var(--text-primary);
}

.btn--sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: 0.8rem;
}
.btn--lg {
  padding: var(--sp-3) var(--sp-8);
  font-size: 1rem;
}
.btn--icon {
  padding: var(--sp-2);
  width: 36px;
  height: 36px;
}

/* ── Form Controls ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-input,
.form-select {
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--accent-blue-light);
}
.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239090a8' d='M6 8.825L1.175 4 2.238 2.938 6 6.7l3.763-3.763L10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* ── Range Slider ── */
.range-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.range-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.range-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.range-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-blue);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--progress-bg);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  transition: transform var(--transition-fast);
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
  cursor: pointer;
}

/* ── Checkbox ── */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.checkbox-group input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  flex-shrink: 0;
}
.checkbox-group input[type="checkbox"]:checked {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}
.checkbox-group input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ── Badge / Status ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge--pending {
  background: var(--bg-input);
  color: var(--text-tertiary);
}
.badge--processing {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
}
.badge--done {
  background: var(--accent-green-light);
  color: var(--accent-green);
}
.badge--error {
  background: var(--accent-red-light);
  color: var(--accent-red);
}

/* ── Progress Bar ── */
.progress {
  width: 100%;
  height: 8px;
  background: var(--progress-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.progress__bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
  position: relative;
}
.progress__bar--green { background: var(--accent-green); }
.progress__bar--yellow { background: var(--accent-yellow); }
.progress__bar--orange { background: var(--accent-orange); }
.progress__bar--blue { background: var(--accent-blue); }

/* Shimmer animation during active compression */
.progress--active .progress__bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Skeleton Loader ── */
.skeleton {
  background: var(--bg-skeleton);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    var(--bg-skeleton-shine),
    transparent
  );
  animation: shimmer 2s infinite;
}
.skeleton--text {
  height: 14px;
  width: 60%;
  margin-bottom: var(--sp-2);
}
.skeleton--rect {
  height: 200px;
  width: 100%;
}

/* ── Stats Panel ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-item__label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-item__value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.stat-item__value--green { color: var(--accent-green); }
.stat-item__value--yellow { color: var(--accent-yellow); }
.stat-item__value--orange { color: var(--accent-orange); }
.stat-item__value--red { color: var(--accent-red); }

/* ── Image Comparator ── */
.comparator {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  cursor: col-resize;
  aspect-ratio: 16 / 10;
  user-select: none;
}
.comparator__img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.comparator__img--after {
  clip-path: inset(0 0 0 50%);
}
.comparator__divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #fff;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
}
.comparator__divider::before,
.comparator__divider::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.comparator__divider::before {
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2'%3E%3Cpath d='M18 8l4 4-4 4M6 8l-4 4 4 4'/%3E%3C/svg%3E") center no-repeat;
}
.comparator__divider::after {
  display: none;
}
.comparator__label {
  position: absolute;
  bottom: var(--sp-3);
  padding: var(--sp-1) var(--sp-3);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  z-index: 3;
  pointer-events: none;
}
.comparator__label--before { left: var(--sp-3); }
.comparator__label--after { right: var(--sp-3); }

/* ── File List ── */
.file-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.file-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}
.file-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-secondary);
}
.file-item.active {
  border-color: var(--accent-blue);
  background: var(--accent-blue-light);
}
.file-item.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}
.file-item__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-item__icon svg {
  width: 18px;
  height: 18px;
  color: var(--accent-blue);
}
.file-item__info {
  flex: 1;
  min-width: 0;
}
.file-item__name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item__meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}
.file-item__actions {
  display: flex;
  gap: var(--sp-1);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-base) ease-out;
}
.modal-overlay.active {
  display: flex;
}
.modal {
  background: var(--bg-card-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp var(--transition-slow) ease-out;
}
.modal--fullscreen {
  max-width: 100%;
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
}
.modal__title {
  font-size: 1.1rem;
  font-weight: 600;
}
.modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.modal__close:hover {
  background: var(--accent-red-light);
  color: var(--accent-red);
}

/* ── Toast / Notification ── */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  animation: slideInRight var(--transition-slow) ease-out;
  min-width: 280px;
}
.toast--success { border-left: 3px solid var(--accent-green); }
.toast--error { border-left: 3px solid var(--accent-red); }
.toast--info { border-left: 3px solid var(--accent-blue); }

/* ── Preset Chips ── */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.preset-chip:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: var(--accent-blue-light);
}
.preset-chip.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

/* ── Video Players Container ── */
.video-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.video-compare__panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.video-compare__panel video {
  width: 100%;
  border-radius: var(--radius-md);
  background: #000;
}
.video-compare__label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

/* ── Audio Waveform Container ── */
.waveform-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.waveform-compare__panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.waveform-compare__player {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
  min-height: 80px;
}
.waveform-compare__label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

/* ── PDF Preview ── */
.pdf-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.pdf-compare__panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.pdf-compare__canvas {
  width: 100%;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.pdf-compare__label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

/* ── Controls Panel ── */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ── History List ── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: 400px;
  overflow-y: auto;
}
.history-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg-input);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.history-item:hover {
  background: var(--bg-input-focus);
}
.history-item__ratio {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-fadeIn { animation: fadeIn var(--transition-base) ease-out; }
.animate-slideUp { animation: slideUp var(--transition-slow) ease-out; }
.animate-pulse { animation: pulse 2s infinite; }

/* ── Responsive Comparators ── */
@media (max-width: 600px) {
  .video-compare,
  .waveform-compare,
  .pdf-compare {
    grid-template-columns: 1fr;
  }
  .comparator {
    aspect-ratio: 4 / 3;
  }
}
