/* ============================================================
   doc.css — Document detail page styles
   Uses the site's CSS variables from global.css
   ============================================================ */

/* ── Page layout ───────────────────────────────────────────── */
.doc-page {
  min-height: calc(100vh - var(--nav-height));
  background: var(--footer-light, #f7f7f7);
  padding-bottom: 80px;
}

.doc-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 24px 0;
}

/* ── Breadcrumb ────────────────────────────────────────────── */
.doc-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: #666;
  margin-bottom: 28px;
}

.doc-breadcrumb a {
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}
.doc-breadcrumb a:hover { color: var(--color-black); }

.doc-breadcrumb span[aria-hidden] {
  color: var(--color-grey);
  user-select: none;
}

/* ── Document header ───────────────────────────────────────── */
.doc-header {
  background: var(--color-white);
  border-radius: 16px;
  padding: 32px 36px;
  margin-bottom: 20px;
  border: 1px solid rgba(0,0,0,0.07);
}

.doc-header-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

/* ── Type badge ────────────────────────────────────────────── */
.doc-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;

  /* Default (other) */
  background: var(--color-tag);
  color: var(--color-grey);
}

/* Per-type colour accents */
.doc-type--thanks        { background: #eaf4eb; color: #235c30; }
.doc-type--confirmation  { background: #e8f0fb; color: #194d9c; }
.doc-type--appeal        { background: #fdf3e3; color: #714b00; }
.doc-type--statement     { background: #f3edfb; color: #5c2e9a; }
.doc-type--response      { background: #e3f3f9; color: #0b586d; }
.doc-type--statute       { background: #1a1a1a; color: #ffffff; }
.doc-type--protocol      { background: #f7f7f7; color: #1a1a1a; border: 1px solid #d0d0d0; }

/* ── Format badge ──────────────────────────────────────────── */
.doc-format-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.doc-format-badge--electronic {
  background: var(--color-accent);
  color: var(--color-white);
  border-color: var(--color-accent);
}

.doc-format-badge--physical {
  background: var(--color-white);
  color: var(--color-grey);
  border-color: var(--color-grey);
}

/* ── Title & ID ────────────────────────────────────────────── */
.doc-title {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-black);
  margin: 0 0 8px;
}

.doc-id {
  font-size: 0.8rem;
  color: var(--color-grey);
  margin: 0;
}

/* ── Sections shared ───────────────────────────────────────── */
.doc-meta-section,
.doc-files-section {
  background: var(--color-white);
  border-radius: 16px;
  padding: 28px 36px;
  margin-bottom: 20px;
  border: 1px solid rgba(0,0,0,0.07);
}

.doc-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-grey);
  margin: 0 0 20px;
}

/* ── Metadata grid ─────────────────────────────────────────── */
.doc-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--color-border);
}

.doc-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}

/* Full-width row */
.doc-meta-item--wide {
  grid-column: 1 / -1;
}

/* Right column — indent slightly */
.doc-meta-item:nth-child(even):not(.doc-meta-item--wide) {
  padding-left: 24px;
  border-left: 1px solid var(--color-border);
}

.doc-meta-item dt {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-grey);
}

.doc-meta-item dd {
  font-size: 0.92rem;
  color: var(--color-black);
  font-weight: 500;
}

.doc-meta-item dd time {
  font-style: normal;
}

/* ── Files list ────────────────────────────────────────────── */
.doc-files-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-file-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #fafafa;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.doc-file-item:hover {
  border-color: var(--color-accent-tag);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.doc-file-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--color-accent-tag);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
}

.doc-file-icon svg {
  width: 20px;
  height: 20px;
}

.doc-file-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.doc-file-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-file-meta {
  font-size: 0.72rem;
  color: #999;
}

.doc-file-actions {
  flex-shrink: 0;
}

/* ── Download button ───────────────────────────────────────── */
.doc-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-main);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;

  background: var(--color-black);
  color: var(--color-white);
  border: none;
}

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

.doc-download-btn svg { flex-shrink: 0; }

.doc-download-btn--disabled {
  background: #f0f0f0;
  color: var(--color-grey);
  cursor: not-allowed;
  border: 1px solid #e0e0e0;
  transform: none !important;
}

/* ── "Download all" strip ──────────────────────────────────── */
.doc-download-all-wrap {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.doc-download-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 22px;
  border-radius: 8px;
  background: transparent;
  color: var(--color-black);
  border: 1.5px solid var(--color-black);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.doc-download-all-btn:hover {
  background: var(--color-black);
  color: var(--color-white);
}

/* ── Restricted block ──────────────────────────────────────── */
.doc-restricted {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
  gap: 14px;
}

.doc-restricted-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f7f7f7;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-grey);
}

.doc-restricted-icon svg { width: 26px; height: 26px; }

.doc-restricted-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-black);
  margin: 0;
}

.doc-restricted-text {
  font-size: 0.88rem;
  color: var(--color-grey);
  margin: 0;
  max-width: 480px;
}

.doc-restricted-contacts {
  font-style: normal;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.doc-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-size: 0.88rem;
}

.doc-contact-label {
  font-weight: 600;
  color: var(--color-grey);
}

.doc-contact-row a {
  color: var(--color-black);
  text-decoration: underline;
  transition: opacity 0.2s;
}
.doc-contact-row a:hover { opacity: 0.6; }

/* Inline restricted note (when download disabled but files shown) */
.doc-restricted-note {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--color-grey);
  line-height: 1.55;
}
.doc-restricted-note a {
  color: var(--color-black);
  text-decoration: underline;
}

/* ── Back link ─────────────────────────────────────────────── */
.doc-back {
  margin-top: 8px;
}

.doc-back a {
  font-size: 0.85rem;
  color: var(--color-grey);
  text-decoration: none;
  transition: color 0.2s;
}
.doc-back a:hover { color: var(--color-black); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .doc-container {
    padding: 24px 16px 0;
  }

  .doc-header,
  .doc-meta-section,
  .doc-files-section {
    padding: 22px 18px;
    border-radius: 12px;
  }

  .doc-title {
    font-size: 1.25rem;
  }

  .doc-meta-grid {
    grid-template-columns: 1fr;
  }

  .doc-meta-item:nth-child(even):not(.doc-meta-item--wide) {
    padding-left: 0;
    border-left: none;
  }

  .doc-file-item {
    flex-wrap: wrap;
    gap: 12px;
  }

  .doc-file-actions {
    width: 100%;
  }

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

  .doc-download-all-wrap {
    justify-content: stretch;
  }

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

/* ── Error block ───────────────────────────────────────────── */
.doc-error {
  background: var(--color-white);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 16px;
  padding: 64px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.doc-error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fdf3e3;
  border: 2px solid #f5d9a8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a5c00;
  margin-bottom: 4px;
}
.doc-error-icon svg { width: 30px; height: 30px; }

.doc-error-code {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-grey);
  margin: 0;
}

.doc-error-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-black);
  margin: 0;
}

.doc-error-text {
  font-size: 0.9rem;
  color: var(--color-grey);
  max-width: 440px;
  line-height: 1.6;
  margin: 0;
}

.doc-error-back {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: 8px;
  background: var(--color-black);
  color: var(--color-white);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}
.doc-error-back:hover {
  background: #333;
  transform: translateY(-1px);
}

/* ── Concerns link ─────────────────────────────────────────── */
.doc-meta-link {
  color: var(--color-black);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.2s;
}
.doc-meta-link:hover { opacity: 0.6; }