@import url("https://fonts.googleapis.com/css2?family=Grechen+Fuemen&family=Manrope:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;600&display=swap");

:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --border: #e3e6ef;
  --text: #15141b;
  --muted: #6b6f7b;
  --link: #2563eb;
  --button: #1f2937;
  --button-text: #ffffff;
  --header: #ffffff;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --accent-a: #f72585;
  --accent-2: #4361ee;
  --accent-z: #fb8500;
  --accent-plus: #e63946;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #eef2ff 0%, #f7f7fb 45%, #ffffff 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.video-banner {
  width: 100%;
  background: #000;
}

.hero-video {
  display: block;
  width: 100%;
  height: clamp(180px, 28vw, 360px);
  object-fit: cover;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.site-header {
  background: var(--header);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  gap: 12px;
  flex-wrap: wrap;
}

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

.brand-title {
  font-size: 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  white-space: nowrap;
}

.a2z-logo {
  font-family: "Grechen Fuemen", cursive;
  font-size: 28px;
  letter-spacing: 0;
  display: inline-flex;
  gap: 0;
}

.a2z-letter {
  display: inline-block;
  line-height: 1;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-link:hover {
  text-decoration: none;
}

.a2z-a {
  color: var(--accent-a);
}

.a2z-2 {
  color: var(--accent-2);
}

.a2z-z {
  color: var(--accent-z);
}

.a2z-10 {
  color: var(--accent-plus);
}

.a2z-m {
  color: var(--accent-plus);
}

.a2z-plus {
  color: var(--accent-plus);
}

.brand-sep {
  color: var(--muted);
}

.brand-text {
  font-weight: 600;
}

.brand-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.ghost-button,
.action-button {
  border: 1px solid transparent;
  background: #f1f5f9;
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ghost-button:hover,
.action-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.action-button {
  background: var(--button);
  color: var(--button-text);
  border-color: var(--button);
}

main {
  padding: 24px 0 32px;
  flex: 1;
}

.collection-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.collection-hero h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-family: "Space Grotesk", "Manrope", sans-serif;
}

.muted {
  color: var(--muted);
}

.collection-controls {
  display: flex;
  gap: 12px;
}

.info-section {
  margin-top: 28px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(16, 185, 129, 0.06));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.info-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-family: "Space Grotesk", "Manrope", sans-serif;
}

.info-scroll {
  margin-top: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.info-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(340px, 1fr);
  gap: 16px;
}

.info-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.info-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.info-card ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.info-card strong {
  color: var(--text);
  font-weight: 600;
}

.info-code {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 11px;
  overflow-x: auto;
}

.info-code-title {
  font-size: 12px;
  color: #cbd5f5;
  margin-bottom: 8px;
}

.info-code pre {
  margin: 0;
  white-space: pre-wrap;
}

.info-code code {
  font-family: "Space Grotesk", "Manrope", sans-serif;
}

.info-note {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(37, 99, 235, 0.4);
  background: rgba(59, 130, 246, 0.08);
  color: var(--muted);
  font-size: 12px;
}

.search-bar {
  margin-top: 14px;
}

.search-bar input {
  width: min(420px, 90vw);
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 14px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.control {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 6px;
  color: var(--muted);
}

.control select {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-top: 20px;
  overflow-x: auto;
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

.collection-table,
.files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 600px;
}

.collection-table thead,
.files-table thead {
  background: #f8fafc;
}

.collection-table th,
.collection-table td,
.files-table th,
.files-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.collection-table tbody tr:hover {
  background: #f8fafc;
}

.table-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.table-header h2 {
  margin: 0;
  font-size: 15px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px 0 0;
}

.page-indicator {
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--header);
  padding: 18px 0 28px;
  font-size: 13px;
}

.detail-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.detail-hero h1 {
  margin: 4px 0 0;
  font-size: 24px;
  font-family: "Space Grotesk", "Manrope", sans-serif;
}

.detail-meta {
  font-size: 13px;
  color: var(--muted);
}

.detail-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  margin-top: 18px;
  box-shadow: var(--shadow);
}

.detail-grid {
  display: grid;
  gap: 12px;
}

.detail-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
}

.detail-label {
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
}

.detail-row > div:not(.detail-label) {
  word-break: break-word;
}

.files-table td:last-child {
  text-align: right;
}

.files-table td:last-child .action-button {
  margin: 4px 0;
}

@media (max-width: 900px) {
  .collection-hero {
    flex-direction: column;
  }

  .collection-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .info-grid {
    grid-auto-columns: minmax(280px, 85vw);
  }

  .detail-hero {
    flex-direction: column;
  }

  .detail-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .detail-row .detail-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .brand-title {
    white-space: normal;
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .files-table th:nth-child(2),
  .files-table td:nth-child(2),
  .files-table th:nth-child(4),
  .files-table td:nth-child(4) {
    display: none;
  }

  .files-table th:nth-child(3),
  .files-table td:nth-child(3) {
    font-size: 12px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .brand {
    width: 100%;
  }

  .collection-table,
  .files-table {
    min-width: 100%;
  }

  .table-card {
    border-radius: 12px;
  }
}

/* ────────────────────────────────────────
   Auth area
   ──────────────────────────────────────── */
#auth-area {
  display: flex;
  align-items: center;
}

.auth-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.15s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.auth-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  background: #f8fafc;
}

.google-icon {
  flex-shrink: 0;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sign-out-btn {
  font-size: 13px;
  padding: 6px 14px;
}

/* ────────────────────────────────────────
   Access-gating banner
   ──────────────────────────────────────── */
.access-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: 14px;
  margin-top: 18px;
  font-size: 14px;
  animation: bannerSlideIn 0.35s ease;
}

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

.access-banner--warning {
  background: linear-gradient(135deg, rgba(251, 133, 0, 0.08), rgba(247, 37, 133, 0.06));
  border: 1px solid rgba(251, 133, 0, 0.3);
  color: var(--text);
}

.access-banner--info {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(16, 185, 129, 0.06));
  border: 1px solid rgba(37, 99, 235, 0.3);
  color: var(--text);
}

.access-banner-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.access-banner-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.access-banner-body strong {
  font-size: 14px;
}

.access-banner-body span {
  font-size: 13px;
  color: var(--muted);
}

.access-banner .open-license-btn {
  flex-shrink: 0;
  font-size: 13px;
  padding: 8px 18px;
}

/* ────────────────────────────────────────
   Disabled action buttons
   ──────────────────────────────────────── */
.action-button.disabled,
.action-button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* ────────────────────────────────────────
   SPA view switching
   ──────────────────────────────────────── */
.view-hidden {
  display: none !important;
}

main:not(.view-hidden) {
  animation: viewFadeIn 0.2s ease;
}

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

/* ────────────────────────────────────────
   License modal
   ──────────────────────────────────────── */
.license-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.license-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.license-modal-card {
  width: min(640px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s ease;
}

.license-modal-overlay.active .license-modal-card {
  transform: translateY(0) scale(1);
}

.license-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.license-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-family: "Space Grotesk", "Manrope", sans-serif;
}

.license-modal-close {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.license-modal-close:hover {
  color: var(--text);
}

.license-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.license-modal-body h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-family: "Space Grotesk", "Manrope", sans-serif;
}

.license-modal-body h4 {
  margin: 20px 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.license-modal-body p {
  margin: 0 0 10px;
  color: #4b5563;
}

.license-modal-body em {
  display: block;
  margin-top: 18px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(16, 185, 129, 0.04));
  border-left: 3px solid var(--link);
  border-radius: 0 10px 10px 0;
  color: var(--text);
  font-style: normal;
  font-weight: 500;
}

.license-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

.license-modal-footer .action-button {
  min-width: 110px;
  text-align: center;
  font-weight: 600;
}

.license-modal-footer .action-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ────────────────────────────────────────
   License form fields
   ──────────────────────────────────────── */
.license-form {
  margin-top: 20px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04), rgba(16, 185, 129, 0.03));
  border: 1px solid var(--border);
  border-radius: 14px;
}

.license-form h4 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.license-required-note {
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}

.license-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.license-field:last-child {
  margin-bottom: 0;
}

.license-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.license-field input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.license-field input::placeholder {
  color: #9ca3af;
  font-size: 13px;
}

.license-field input:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.license-field input:invalid:not(:placeholder-shown) {
  border-color: #ef4444;
}

.license-field input[readonly] {
  background: #f1f5f9;
  color: var(--muted);
  cursor: not-allowed;
  border-style: dashed;
}

.license-disclaimer {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(234, 57, 70, 0.3);
  background: rgba(234, 57, 70, 0.05);
  font-size: 12px;
  line-height: 1.6;
  color: #6b7280;
}

.license-disclaimer p {
  margin: 0;
}

.license-disclaimer strong {
  color: #dc2626;
}

/* ────────────────────────────────────────
   Responsive — auth & modal
   ──────────────────────────────────────── */
@media (max-width: 900px) {
  .user-name {
    display: none;
  }

  .access-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 600px) {
  .license-modal-card {
    border-radius: 14px;
    max-height: 90vh;
  }

  .license-modal-body {
    padding: 16px;
  }

  .auth-button {
    font-size: 13px;
    padding: 7px 12px;
  }
}
