/* ============================================
   SubShift — Design System & Styles
   ============================================ */

/* ---- Google Font ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---- CSS Custom Properties (Tokens) ---- */
:root {
  /* Colors — Dark theme (default) */
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --bg-glass-border: rgba(255, 255, 255, 0.1);
  --bg-dropzone: rgba(99, 102, 241, 0.06);
  --bg-dropzone-active: rgba(99, 102, 241, 0.14);

  --text-primary: #f0f0f8;
  --text-secondary: #9899b3;
  --text-muted: #5d5f7e;

  --accent-start: #6366f1;
  --accent-end: #a855f7;
  --accent-mid: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.35);

  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.25);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.25);
  --warning: #f59e0b;

  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--accent-glow);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;

  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* ---- Light Theme ---- */
[data-theme="light"] {
  --bg-primary: #f4f4fb;
  --bg-secondary: #eaeaf5;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.55);
  --bg-glass-border: rgba(0, 0, 0, 0.08);
  --bg-dropzone: rgba(99, 102, 241, 0.06);
  --bg-dropzone-active: rgba(99, 102, 241, 0.12);

  --text-primary: #1a1a2e;
  --text-secondary: #555573;
  --text-muted: #8888a5;

  --accent-glow: rgba(99, 102, 241, 0.18);

  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.14);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 40px var(--accent-glow);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--duration-slow) var(--ease-out),
              color var(--duration-slow) var(--ease-out);
}

/* ---- Animated Background Mesh ---- */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-mesh::before,
.bg-mesh::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  animation: meshFloat 20s ease-in-out infinite alternate;
}

.bg-mesh::before {
  width: 600px;
  height: 600px;
  background: var(--accent-start);
  top: -200px;
  left: -100px;
}

.bg-mesh::after {
  width: 500px;
  height: 500px;
  background: var(--accent-end);
  bottom: -150px;
  right: -100px;
  animation-delay: -10s;
}

[data-theme="light"] .bg-mesh::before,
[data-theme="light"] .bg-mesh::after {
  opacity: 0.15;
}

@keyframes meshFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.1); }
  100% { transform: translate(-30px, 70px) scale(0.95); }
}

/* ---- Layout ---- */
.app {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.header__logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
}

.header__title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header__subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: var(--space-xs);
}

/* ---- Theme Toggle ---- */
.theme-toggle {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 100;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--bg-glass-border);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-primary);
  transition: transform var(--duration-base) var(--ease-spring),
              background var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
}

/* ---- Drop Zone ---- */
.dropzone {
  position: relative;
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  background: var(--bg-dropzone);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at center, var(--accent-glow) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out);
  pointer-events: none;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent-mid);
  background: var(--bg-dropzone-active);
}

.dropzone:hover::before,
.dropzone.dragover::before {
  opacity: 1;
}

.dropzone.dragover {
  transform: scale(1.01);
  box-shadow: var(--shadow-glow);
}

.dropzone__icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  display: block;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.dropzone__title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.dropzone__hint {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.dropzone__input {
  display: none;
}

/* ---- File List ---- */
.file-list {
  margin-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.file-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--duration-base) var(--ease-out);
  animation: slideUp var(--duration-slow) var(--ease-spring) both;
}

.file-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  color: white;
}

.file-card__info {
  flex: 1;
  min-width: 0;
}

.file-card__name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.file-card__status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.file-card__check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  background: var(--success);
  color: white;
  box-shadow: 0 0 12px var(--success-glow);
  animation: popIn var(--duration-base) var(--ease-spring);
}

.file-card__check--error {
  background: var(--error);
  box-shadow: 0 0 12px var(--error-glow);
}

@keyframes popIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.file-card__download {
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.file-card__download:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-mid);
  color: var(--accent-mid);
}

/* ---- Actions Bar ---- */
.actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 28px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  color: white;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px var(--accent-glow);
}

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

.btn--ghost {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ---- Ripple ---- */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: ripple 600ms linear;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  color: var(--text-primary);
  animation: toastIn var(--duration-slow) var(--ease-spring);
  max-width: 360px;
}

.toast--success { border-left: 3px solid var(--success); }
.toast--error { border-left: 3px solid var(--error); }
.toast--info { border-left: 3px solid var(--accent-mid); }

.toast.removing {
  animation: toastOut var(--duration-base) var(--ease-out) forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
}

/* ---- Empty / Hidden States ---- */
.hidden {
  display: none !important;
}

/* ---- Footer ---- */
.footer {
  margin-top: auto;
  padding-top: var(--space-2xl);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer__privacy {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

/* ---- Counter Badge ---- */
.counter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: var(--space-md);
  text-align: center;
  justify-content: center;
  width: 100%;
}

.counter__number {
  font-weight: 700;
  color: var(--accent-mid);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .app {
    padding: var(--space-lg) var(--space-md);
  }

  .header__title {
    font-size: 1.7rem;
  }

  .dropzone {
    padding: var(--space-xl) var(--space-md);
  }

  .theme-toggle {
    top: var(--space-md);
    right: var(--space-md);
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
  }

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