/* ==========================================================================
   Vimeo Video Downloader - Premium Stylesheet
   Color Palette:
   Vimeo Blue: #1AB7EA
   Vimeo Dark Blue / Navy: #002B49
   Vimeo Deep Royal: #0077A9
   Pure White: #FFFFFF
   Card Gray: #F7F9FA
   Text Primary: #17171C
   Text Secondary: #65676E
   Border Gray: #E5E7EB
   Success: #10B981
   Warning: #F59E0B
   Error: #EF4444
   ========================================================================== */

:root {
  --vimeo-blue: #1AB7EA;
  --vimeo-blue-hover: #159fd0;
  --vimeo-blue-light: #EBF8FD;
  --vimeo-dark: #002B49;
  --vimeo-gradient: linear-gradient(135deg, #1AB7EA 0%, #0093D8 60%, #0074B7 100%);
  --white: #FFFFFF;
  --bg-page: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-subtle: #F8FAFC;
  --text-primary: #17171C;
  --text-secondary: #5C6573;
  --text-muted: #8E9BAE;
  --border-light: #E2E8F0;
  --border-focus: #1AB7EA;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 36px rgba(0, 43, 73, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header: Displays ONLY the official Vimeo Logo
   ========================================================================== */
.site-header {
  width: 100%;
  padding: 24px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.site-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-logo-link:hover {
  transform: scale(1.02);
  opacity: 0.95;
}

.header-vimeo-logo {
  height: 38px;
  width: auto;
  color: var(--white);
  fill: currentColor;
}

/* ==========================================================================
   Hero Section: Vimeo-Inspired Blue Branding (#1AB7EA)
   ========================================================================== */
.hero-section {
  background: var(--vimeo-gradient);
  color: var(--white);
  padding: 0 20px 72px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle decorative backdrop circle */
.hero-section::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -100px;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.hero-content {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
  color: var(--white);
  text-shadow: 0 2px 8px rgba(0, 43, 73, 0.15);
}

.hero-subtitle {
  font-size: 1.125rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 36px;
  letter-spacing: -0.01em;
}

/* URL Input Card */
.input-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  border: 2px solid transparent;
}

.input-card:focus-within {
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 20px 40px rgba(0, 43, 73, 0.2);
}

.input-field-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 14px;
}

.input-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 12px;
}

.url-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--text-primary);
  background: transparent;
  padding: 12px 32px 12px 0;
}

.url-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.clear-btn {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: none;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
}

.clear-btn:hover {
  color: var(--text-primary);
  background: #F1F5F9;
}

.clear-btn.visible {
  display: flex;
}

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

/* Prominent Download Button */
.btn-download-primary {
  background-color: var(--vimeo-dark);
  color: var(--white);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px 32px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 43, 73, 0.2);
}

.btn-download-primary:hover {
  background-color: #001A2D;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 43, 73, 0.3);
}

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

.btn-download-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

/* Input helper cues below input */
.input-meta-help {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-pill svg {
  width: 14px;
  height: 14px;
  opacity: 0.9;
}

/* ==========================================================================
   Content Section: Pure White Background (#FFFFFF)
   ========================================================================== */
.content-section {
  background-color: var(--bg-page);
  flex: 1;
  padding: 48px 20px 80px 20px;
}

.container {
  max-width: 880px;
  margin: 0 auto;
}

/* Loading State */
.state-loading {
  display: none;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
}

.state-loading.active {
  display: block;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(26, 183, 234, 0.18);
  border-top-color: var(--vimeo-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px auto;
}

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

.loading-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

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

/* Error State / Notification Card */
.state-error {
  display: none;
  background: var(--white);
  border: 1px solid #FEE2E2;
  border-left: 5px solid var(--error);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.state-error.active {
  display: block;
}

.error-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.error-icon {
  width: 24px;
  height: 24px;
  color: var(--error);
  flex-shrink: 0;
}

.error-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #991B1B;
}

.error-message {
  font-size: 0.95rem;
  color: #4B5563;
  margin-left: 36px;
  line-height: 1.6;
}

/* Success Result Card */
.state-success {
  display: none;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 48px;
  animation: fadeIn 0.3s ease-out;
}

.state-success.active {
  display: block;
}

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

/* Video Information Banner */
.video-preview-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

.preview-media-container {
  position: relative;
  background: #000;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.duration-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.8);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

.video-details-card {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.permission-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ECFDF5;
  color: #065F46;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
  width: fit-content;
}

.permission-tag svg {
  width: 14px;
  height: 14px;
}

.video-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.video-author-line {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.author-link {
  color: var(--vimeo-blue);
  text-decoration: none;
  font-weight: 600;
}

.author-link:hover {
  text-decoration: underline;
}

/* Quality Table */
.formats-wrapper {
  padding: 28px;
}

.formats-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.formats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.format-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.format-row:hover {
  border-color: #CBD5E1;
  background: #F1F5F9;
}

.format-col-quality {
  display: flex;
  align-items: center;
  gap: 12px;
}

.format-badge {
  background: #E2E8F0;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.format-badge.hd {
  background: var(--vimeo-blue);
  color: var(--white);
}

.format-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.format-col-size {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.format-col-action {
  display: flex;
  align-items: center;
}

.btn-download-format {
  background: var(--vimeo-blue);
  color: var(--white);
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  text-decoration: none;
}

.btn-download-format:hover {
  background: var(--vimeo-blue-hover);
  transform: translateY(-1px);
}

.btn-download-format svg {
  width: 14px;
  height: 14px;
}

/* Progress Modal / Processing Bar */
.download-progress-box {
  display: none;
  background: var(--vimeo-blue-light);
  border: 1px solid #BAE6FD;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-top: 16px;
}

.download-progress-box.active {
  display: block;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--vimeo-dark);
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: #E0F2FE;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--vimeo-blue);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* ==========================================================================
   Educational / Policy Information Block
   ========================================================================== */
.policy-section {
  border-top: 1px solid var(--border-light);
  padding-top: 40px;
  margin-top: 24px;
}

.policy-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
}

.policy-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.policy-title svg {
  width: 18px;
  height: 18px;
  color: var(--vimeo-blue);
}

.policy-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.policy-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.policy-item {
  font-size: 0.825rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.policy-bullet {
  color: var(--vimeo-blue);
  font-weight: bold;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 0.825rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.1rem;
  }
  
  .hero-section {
    padding-bottom: 48px;
  }
  
  .input-card {
    flex-direction: column;
    padding: 10px;
  }
  
  .input-field-wrapper {
    width: 100%;
    padding-left: 6px;
  }
  
  .btn-download-primary {
    width: 100%;
    padding: 14px;
  }
  
  .video-preview-grid {
    grid-template-columns: 1fr;
  }
  
  .preview-media-container {
    max-height: 240px;
  }
  
  .policy-list {
    grid-template-columns: 1fr;
  }
  
  .format-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .format-col-action {
    width: 100%;
  }
  
  .btn-download-format {
    width: 100%;
    justify-content: center;
  }
}
