/* CSS Reset & Variables */
:root {
  --bg-color: #080b11;
  --card-bg: rgba(17, 22, 34, 0.65);
  --card-border: rgba(255, 255, 255, 0.07);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --accent-primary: #8b5cf6;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  
  /* Platform Colors */
  --color-instagram: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  --color-kwai: #ff5000;
  --color-facebook: #1877f2;
  
  --radius-lg: 20px;
  --radius-md: 12px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Background Glow Spheres */
.glow-sphere {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 1;
  opacity: 0.45;
  pointer-events: none;
}

.glow-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
  top: -10%;
  right: -5%;
}

.glow-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
  bottom: -10%;
  left: -10%;
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 580px;
  padding: 24px 16px;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Header */
.app-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

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

.logo-icon-wrapper {
  background: var(--accent-gradient);
  padding: 10px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon {
  width: 26px;
  height: 26px;
  color: white;
}

.logo-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.logo-title span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Main Card */
.main-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Platform Badges */
.platforms-badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.badge i {
  width: 14px;
  height: 14px;
}

/* Active platform classes */
.badge.active-instagram {
  background: var(--color-instagram);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(220, 39, 67, 0.3);
}

.badge.active-kwai {
  background: var(--color-kwai);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(255, 80, 0, 0.3);
}

.badge.active-facebook {
  background: var(--color-facebook);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(24, 119, 242, 0.3);
}

/* Download Form */
.download-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.input-link-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  pointer-events: none;
}

#video-url {
  width: 100%;
  padding: 16px 110px 16px 48px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
}

#video-url:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
  background: rgba(0, 0, 0, 0.45);
}

.paste-btn {
  position: absolute;
  right: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: white;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

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

.paste-btn:active {
  transform: translateY(1px);
}

.paste-btn i {
  width: 14px;
  height: 14px;
}

.submit-btn {
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.2);
}

.submit-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}

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

.submit-btn i {
  width: 18px;
  height: 18px;
  transition: var(--transition-smooth);
}

.submit-btn:hover i {
  transform: translateX(4px);
}

/* Loading Card */
.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0;
  gap: 12px;
  animation: fadeIn 0.4s ease;
}

.spinner-wrapper {
  position: relative;
  width: 60px;
  height: 60px;
  margin-bottom: 8px;
}

.spinner {
  width: 100%;
  height: 100%;
  border: 4px solid rgba(139, 92, 246, 0.15);
  border-top-color: var(--accent-primary);
  border-bottom-color: var(--accent-secondary);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loading-sparkle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  color: var(--accent-secondary);
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.loading-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Error Card */
.error-card {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #f87171;
  font-size: 0.9rem;
  animation: shake 0.4s ease;
}

.error-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Result Card */
.result-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-content {
  display: flex;
  gap: 16px;
}

.video-preview-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#video-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.platform-indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 700;
}

.platform-indicator i {
  width: 10px;
  height: 10px;
}

.video-details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
}

.video-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: white;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.action-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.download-btn-action {
  flex-grow: 1;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.download-btn-action:hover {
  background: #059669;
  transform: translateY(-1px);
}

.download-btn-action:active {
  transform: translateY(1px);
}

.download-btn-action i {
  width: 16px;
  height: 16px;
}

.clear-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.clear-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.clear-btn i {
  width: 16px;
  height: 16px;
}

/* Progress Wrapper */
.progress-wrapper {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: 10px;
  transition: width 0.1s ease;
}

/* Guide / Tutorial Section */
.guide-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guide-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 480px) {
  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.step-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.step-card:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.2);
}

.step-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
}

.step-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Footer */
.app-footer {
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-subtext {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.15);
}

/* Helper Class */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.9); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Responsive Overrides */
@media (max-width: 480px) {
  .logo-title {
    font-size: 1.8rem;
  }
  
  .main-card {
    padding: 20px 16px;
  }
  
  #video-url {
    padding-right: 90px;
    font-size: 0.85rem;
  }
  
  .paste-btn span {
    display: none; /* Oculta texto "Colar" em telas muito pequenas, deixando só ícone */
  }
  
  .paste-btn {
    padding: 8px;
    right: 6px;
  }
  
  .result-content {
    flex-direction: column;
  }
  
  .video-preview-wrapper {
    width: 100%;
    height: 160px;
  }
}
