/* ═══════════════════════════════════════════════════════════════════════════
   CriartMídia — Design System & Styles
   Theme: Dark premium with violet/indigo accents + glassmorphism
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ─── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg-base:       #09090f;
  --bg-elevated:   #111118;
  --bg-surface:    #16161f;
  --bg-card:       #1c1c28;
  --bg-glass:      rgba(28, 28, 40, 0.55);

  --accent:        #7c6cfc;
  --accent-light:  #a89cff;
  --accent-dim:    rgba(124, 108, 252, 0.15);
  --accent-glow:   rgba(124, 108, 252, 0.35);

  --success:       #22c55e;
  --warn:          #f59e0b;
  --error:         #ef4444;
  --info:          #38bdf8;

  --text-primary:  #f1f0ff;
  --text-secondary:#a39ec4;
  --text-muted:    #5c587a;

  --border:        rgba(255,255,255,0.07);
  --border-accent: rgba(124,108,252,0.4);

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

  --shadow-card:   0 4px 24px rgba(0,0,0,0.45);
  --shadow-glow:   0 0 40px rgba(124,108,252,0.2);

  --transition:    all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Background ambient ─────────────────────────────────────────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(124,108,252,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 110%, rgba(168,92,250,0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Layout ──────────────────────────────────────────────────────────────── */
#app {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 20px var(--accent-glow);
}

.logo-text h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, #fff 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text p {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-light);
}

/* ─── Dropzone ───────────────────────────────────────────────────────────── */
#dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 60px 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
  margin-bottom: 28px;
}

#dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-dim) 0%, transparent 60%);
  opacity: 0;
  transition: var(--transition);
}

#dropzone:hover,
#dropzone.drag-over {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

#dropzone:hover::before,
#dropzone.drag-over::before {
  opacity: 1;
}

#dropzone.drag-over {
  transform: scale(1.005);
}

.dropzone-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--accent-dim), rgba(168,92,250,0.1));
  border: 1px solid var(--border-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 30px;
  transition: var(--transition);
}

#dropzone:hover .dropzone-icon {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.dropzone-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.dropzone-sub {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.dropzone-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
}

.type-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── Toolbar ────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

#stats {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-secondary);
  display: none;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.15s;
}

.btn:hover::after { background: rgba(255,255,255,0.05); }
.btn:active::after { background: rgba(255,255,255,0.12); }

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: #fff;
  padding: 12px 28px;
  font-size: 15px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px var(--accent-glow);
}

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

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

/* ─── Empty State ────────────────────────────────────────────────────────── */
#empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  color: var(--text-muted);
  gap: 12px;
  font-size: 15px;
}

#empty-state svg { opacity: 0.3; }

/* ─── Media Grid ─────────────────────────────────────────────────────────── */
#media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ─── Media Card ─────────────────────────────────────────────────────────── */
.media-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  cursor: default;
  animation: cardIn 0.25s ease backwards;
}

@keyframes cardIn {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to { opacity: 1; transform: none; }
}

.media-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}

.media-card[data-status="done"] {
  border-color: rgba(34, 197, 94, 0.35);
}

.media-card[data-status="error"] {
  border-color: rgba(239, 68, 68, 0.35);
}

.media-card[data-status="uploading"] {
  border-color: var(--border-accent);
  box-shadow: 0 0 14px var(--accent-dim);
}

/* ─── Thumbnail ──────────────────────────────────────────────────────────── */
.media-thumb-wrapper {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-elevated);
}

.media-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.media-card:hover .media-thumb {
  transform: scale(1.04);
}

/* ─── Card Controls ──────────────────────────────────────────────────────── */
.remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.65);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
  backdrop-filter: blur(6px);
  z-index: 2;
}

.media-card:hover .remove-btn { opacity: 1; }
.remove-btn:hover { background: var(--error); transform: scale(1.1); }

.type-icon {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-size: 16px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}

/* ─── Status Badge ───────────────────────────────────────────────────────── */
.status-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  backdrop-filter: blur(8px);
  z-index: 2;
}

.status-idle     { background: rgba(0,0,0,0.5); color: var(--text-muted); }
.status-uploading{ background: var(--accent-glow); color: var(--accent-light); animation: pulse 1.2s infinite; }
.status-done     { background: rgba(34,197,94,0.25); color: var(--success); }
.status-error    { background: rgba(239,68,68,0.25); color: var(--error); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* ─── Progress Bar (within card) ─────────────────────────────────────────── */
.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.1);
  z-index: 3;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transition: width 0.2s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ─── Media Info ─────────────────────────────────────────────────────────── */
.media-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.media-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-size {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Progress Overlay ───────────────────────────────────────────────────── */
#progress-overlay {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 20px 32px;
  min-width: 360px;
  text-align: center;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1000;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

#progress-overlay.visible {
  transform: translateX(-50%) translateY(0);
}

#overall-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.overall-bar-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
}

#overall-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a855f7, var(--accent-light));
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
  animation: shimmer 1.5s infinite linear;
}

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

/* ─── Toast ──────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 340px;
  box-shadow: var(--shadow-card);
}

.toast.show { transform: translateX(0); opacity: 1; }
.toast-success { border-color: rgba(34,197,94,0.4); }
.toast-warn    { border-color: rgba(245,158,11,0.4); }
.toast-error   { border-color: rgba(239,68,68,0.4); }
.toast-info    { border-color: rgba(56,189,248,0.4); }

/* ─── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #app { padding: 0 16px 60px; }

  .header { padding: 20px 0 24px; flex-wrap: wrap; gap: 12px; }

  #dropzone { padding: 40px 20px; }

  #media-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

  .toolbar { gap: 8px; }

  #progress-overlay { min-width: calc(100vw - 32px); left: 16px; transform: translateY(120px); bottom: 16px; }
  #progress-overlay.visible { transform: translateY(0); }

  #toast-container { left: 16px; right: 16px; }
  .toast { max-width: none; }
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── Selection ──────────────────────────────────────────────────────────── */
::selection { background: var(--accent-dim); color: var(--accent-light); }
