@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ============================================
   VaultDrop — File Download Page Styles
   ============================================ */

.file-page-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding-top: 1.4rem;
  padding-bottom: 1.4rem;
}

/* ── State Wrappers (loading, error, password) ── */
.state-wrap {
  text-align: center;
  max-width: 420px;
  width: 100%;
  background: linear-gradient(180deg, rgba(16,26,54,0.7), rgba(12,19,42,0.85));
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  padding: 1.6rem 1.2rem;
  box-shadow: var(--shadow), 0 10px 40px rgba(0,0,0,0.4);
  margin: 0 auto;
}

/* Spinner */
.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.25rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.state-text {
  color: var(--text-sub);
  font-size: 0.95rem;
}

.state-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

/* Error icon */
.error-icon {
  width: 56px; height: 56px;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: var(--error);
  margin: 0 auto 1rem;
  font-family: var(--font-display);
  font-weight: 700;
}

/* Lock icon */
.lock-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: block;
}

/* Password form */
.pw-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.pw-input {
  width: 100%;
  text-align: center;
  font-size: 1rem;
  padding: 0.75rem 1rem !important;
}

.pw-btn {
  padding: 0.75rem 1.5rem !important;
  font-size: 0.95rem !important;
}

.pw-error {
  margin-top: 0.75rem;
  color: var(--error);
  font-size: 0.82rem;
}

/* ── File Card ── */
.file-card {
  width: 100%;
  max-width: 820px;
  background: linear-gradient(180deg, rgba(16,26,54,0.7), rgba(12,19,42,0.85));
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 26px;
  padding: clamp(1rem, 3vw, 2rem);
  box-shadow: var(--shadow), 0 10px 40px rgba(0,0,0,0.4);
  animation: fadeUp 0.4s ease both;
  margin: 0 auto;
}

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

/* ── File Hero ── */
.file-hero {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.file-type-badge {
  width: 68px; height: 68px;
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.file-type-badge svg {
  width: 32px;
  height: 32px;
}

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

.file-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  word-break: break-all;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.file-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stat-pill {
  padding: 0.25rem 0.65rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.72rem;
  color: var(--text-sub);
  white-space: nowrap;
}

.expiry-pill {
  border-color: rgba(255,122,69,0.35);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ── Preview Area ── */
.preview-area {
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  min-height: 90px;
}

.preview-area:empty { display: none; }

/* Image preview */
.preview-area img {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  display: block;
}

/* Video preview */
.preview-area video {
  width: 100%;
  max-height: 380px;
  display: block;
}

/* Audio preview */
.preview-area audio {
  width: 100%;
  padding: 1.25rem;
  display: block;
}

/* PDF preview */
.preview-area iframe {
  width: 100%;
  height: 420px;
  border: none;
  display: block;
}

.preview-area pre {
  overflow: auto;
  max-width: 100%;
}

/* No preview */
.no-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  color: var(--text-dim);
  gap: 0.5rem;
  font-size: 0.85rem;
}
.no-preview span { font-size: 2rem; }

/* ── Download Actions ── */
.download-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-download {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.5rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
  min-width: 180px;
  min-height: 48px;
}
.btn-download:hover { background: #ff8e61; transform: translateY(-2px); box-shadow: 0 10px 28px var(--accent-glow); }

.btn-share-own {
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
  white-space: nowrap;
}
.btn-share-own:hover { color: var(--text-main); }

@media (max-width: 860px) {
  .file-page-main {
    padding-top: 0.85rem;
  }

  .file-card {
    max-width: 100%;
  }

  .file-hero {
    gap: 1rem;
  }

  .file-stats {
    gap: 0.5rem;
  }

  .preview-area iframe {
    height: 340px;
  }
}

@media (max-width: 620px) {
  .file-page-main {
    min-height: calc(100vh - 88px);
    padding-top: 0.6rem;
  }

  .state-wrap {
    max-width: 100%;
    padding: 1rem 0.72rem;
    border-radius: 18px;
  }

  .file-card {
    border-radius: 18px;
    padding: 0.82rem;
  }

  .file-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }

  .file-type-badge {
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
  }

  .file-name {
    font-size: 1.02rem;
    margin-bottom: 0.6rem;
  }

  .stat-pill {
    font-size: 0.68rem;
    padding: 0.22rem 0.55rem;
  }

  .preview-area img,
  .preview-area video {
    max-height: 250px;
  }

  .preview-area iframe {
    height: 280px;
  }

  .download-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
  }

  .btn-download {
    width: 100%;
    min-width: 0;
    min-height: 46px;
  }

  .btn-share-own {
    text-align: center;
    font-size: 0.8rem;
  }
}

@media (max-width: 430px) {
  .state-title {
    font-size: 1.35rem;
  }

  .state-text {
    font-size: 0.87rem;
  }

  .file-type-badge {
    width: 48px;
    height: 48px;
    font-size: 1.35rem;
  }

  .preview-area iframe {
    height: 240px;
  }

  .no-preview {
    padding: 1.7rem 1rem;
  }
}