/* ============================================================
   LEGAL.CSS — 365agents Branded Legal Document System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Rubik', ui-sans-serif, system-ui, sans-serif;
  color: #010030;
  background: #F0EEF8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Cover Page ─────────────────────────────────────────── */
.cover-page {
  position: relative;
  min-height: 100vh;
  background: #010030;
  color: #FCFCFC;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px;
  page-break-after: always;
  break-after: page;
}

.cover-top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 28px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.cover-back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(252,252,252,0.45);
  text-decoration: none;
  transition: color 160ms;
}
.cover-back-link:hover { color: rgba(252,252,252,0.85); }

.cover-print-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Rubik', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(252,252,252,0.7);
  background: rgba(175,52,255,0.18);
  border: 1px solid rgba(175,52,255,0.4);
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 180ms;
}
.cover-print-btn:hover { background: rgba(175,52,255,0.35); color: #FCFCFC; }

.cover-content {
  text-align: center;
  max-width: 640px;
  width: 100%;
}

.cover-logo {
  width: 200px;
  margin-bottom: 52px;
}

.cover-rule {
  width: 56px;
  height: 3px;
  background: #AF34FF;
  margin: 0 auto 40px;
  border-radius: 2px;
}

.cover-overline {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #C97DFF;
  margin-bottom: 18px;
}

.cover-title {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.12;
  color: #FCFCFC;
  letter-spacing: -0.015em;
  margin-bottom: 14px;
  text-wrap: balance;
}

.cover-subtitle {
  font-size: 16px;
  font-weight: 400;
  color: rgba(252,252,252,0.45);
}

.cover-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 22px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-size: 12px;
  font-weight: 500;
  color: rgba(252,252,252,0.35);
  letter-spacing: 0.05em;
}

.cover-footer-items {
  display: flex;
  align-items: center;
  gap: 18px;
}

.cover-footer-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(175,52,255,0.5);
  flex-shrink: 0;
}

/* ── Document Shell ─────────────────────────────────────── */
.doc-shell {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 48px 96px;
  background: #FFFFFF;
  box-shadow: 0 2px 60px rgba(1,0,48,0.10);
  min-height: 100vh;
}

/* ── Document Header ────────────────────────────────────── */
.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 0 22px;
  border-bottom: 2.5px solid #AF34FF;
  margin-bottom: 40px;
  gap: 20px;
}

.doc-header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.doc-header-logo {
  width: 128px;
  flex-shrink: 0;
}

.header-divider {
  width: 1px;
  height: 32px;
  background: rgba(1,0,48,0.12);
  flex-shrink: 0;
}

.doc-header-meta h1 {
  font-size: 16px;
  font-weight: 700;
  color: #010030;
  line-height: 1.2;
  margin-bottom: 2px;
}

.doc-version-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: #6F6E8C;
  letter-spacing: 0.04em;
}

.doc-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Rubik', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #6F6E8C;
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid rgba(1,0,48,0.12);
  transition: all 160ms;
  letter-spacing: 0.02em;
}
.btn-back:hover { color: #010030; border-color: rgba(1,0,48,0.25); background: rgba(1,0,48,0.03); }

.btn-print {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Rubik', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #FCFCFC;
  background: #AF34FF;
  padding: 7px 15px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 160ms;
}
.btn-print:hover { background: #9A1FE6; }

/* ── Notice / Changelog Boxes ───────────────────────────── */
.doc-notice {
  background: rgba(175,52,255,0.05);
  border-left: 3px solid #AF34FF;
  border-radius: 0 10px 10px 0;
  padding: 15px 20px;
  margin-bottom: 28px;
  font-size: 14px;
  line-height: 1.65;
  color: #2B2A5E;
}

.doc-changelog {
  background: rgba(78,205,196,0.06);
  border-left: 3px solid #4ECDC4;
  border-radius: 0 10px 10px 0;
  padding: 13px 18px;
  margin-bottom: 24px;
  font-size: 13px;
  line-height: 1.65;
  color: #2B2A5E;
}
.doc-changelog strong { color: #010030; font-weight: 600; }

/* ── Body Text ──────────────────────────────────────────── */
.doc-body p {
  font-size: 15px;
  line-height: 1.70;
  color: #010030;
  margin-bottom: 16px;
  text-wrap: pretty;
}

.doc-body strong { font-weight: 600; }

/* ── Recitals ────────────────────────────────────────────── */
.recitals {
  margin: 4px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recital-item {
  display: flex;
  gap: 14px;
  font-size: 15px;
  line-height: 1.68;
  color: #010030;
}

.recital-letter {
  font-weight: 700;
  color: #AF34FF;
  flex-shrink: 0;
  width: 22px;
  padding-top: 1px;
}

/* ── Sections ────────────────────────────────────────────── */
.doc-section { margin-bottom: 44px; }

.sec-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: #010030;
  padding: 10px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(1,0,48,0.09);
}

.sec-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 8px;
  background: rgba(175,52,255,0.1);
  color: #AF34FF;
  font-size: 11px;
  font-weight: 700;
  border-radius: 5px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.subsection { margin-bottom: 20px; }

.subsec-heading {
  font-size: 14px;
  font-weight: 600;
  color: #010030;
  margin-bottom: 8px;
  line-height: 1.4;
}

.subsec-num {
  color: #AF34FF;
  margin-right: 5px;
  font-weight: 700;
}

/* ── Definition Lists ───────────────────────────────────── */
.def-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 8px 0;
  border: 1px solid rgba(1,0,48,0.07);
  border-radius: 10px;
  overflow: hidden;
}

.def-item {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(1,0,48,0.06);
  font-size: 14.5px;
  line-height: 1.65;
}
.def-item:last-child { border-bottom: none; }

.def-term {
  font-weight: 600;
  color: #010030;
  flex-shrink: 0;
  width: 190px;
  min-width: 190px;
  padding: 12px 16px;
  background: rgba(175,52,255,0.03);
  border-right: 1px solid rgba(1,0,48,0.06);
  font-size: 13.5px;
}

.def-body {
  padding: 12px 16px;
  color: #010030;
  flex: 1;
}

/* ── Sub-lists (a)(b)(c) ─────────────────────────────────── */
.alpha-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alpha-list li {
  display: flex;
  gap: 10px;
  font-size: 14.5px;
  line-height: 1.65;
  color: #010030;
}

.alpha-marker {
  font-weight: 600;
  color: #6F6E8C;
  flex-shrink: 0;
  min-width: 22px;
  padding-top: 1px;
}

/* ── Tables ──────────────────────────────────────────────── */
.legal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  margin: 14px 0 24px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(1,0,48,0.10);
}

.legal-table thead tr th {
  background: #010030;
  color: #FCFCFC;
  padding: 11px 15px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.legal-table thead tr th:last-child { border-right: none; }

.legal-table tbody tr {
  transition: background 100ms;
}
.legal-table tbody tr:nth-child(even) td {
  background: rgba(1,0,48,0.018);
}
.legal-table tbody tr:hover td { background: rgba(175,52,255,0.04); }

.legal-table tbody td {
  padding: 10px 15px;
  vertical-align: top;
  color: #010030;
  line-height: 1.55;
  border-bottom: 1px solid rgba(1,0,48,0.06);
  border-right: 1px solid rgba(1,0,48,0.05);
}
.legal-table tbody td:last-child { border-right: none; }
.legal-table tbody tr:last-child td { border-bottom: none; }

/* ── Status Badges ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: rgba(78,205,196,0.13); color: #1d7872; }
.badge-yellow { background: rgba(255,209,102,0.22); color: #7a6000; }
.badge-blue   { background: rgba(67,97,238,0.12); color: #2c46c5; }
.badge-purple { background: rgba(175,52,255,0.10); color: #7b17b8; }

/* ── Checkboxes (Order Form) ──────────────────────────────── */
.checkbox-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.checkbox-list li {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 12px 16px;
  border-radius: 9px;
  border: 1px solid rgba(1,0,48,0.09);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.checkbox-list li:hover { background: rgba(175,52,255,0.03); border-color: rgba(175,52,255,0.2); }
.checkbox-list li:has(input:checked) {
  background: rgba(175,52,255,0.05);
  border-color: rgba(175,52,255,0.3);
}

.checkbox-list li input[type="checkbox"] {
  width: 17px; height: 17px;
  margin-top: 2px;
  accent-color: #AF34FF;
  cursor: pointer;
  flex-shrink: 0;
}

.cb-service { font-size: 14px; font-weight: 600; color: #010030; }
.cb-desc    { font-size: 13px; color: #6F6E8C; margin-top: 2px; line-height: 1.45; }

/* ── Fillable Fields ──────────────────────────────────────── */
.field {
  display: inline-block;
  min-width: 60px;
  padding: 1px 6px 2px;
  background: rgba(175,52,255,0.07);
  border-bottom: 1.5px solid rgba(175,52,255,0.7);
  border-radius: 3px;
  cursor: text;
  transition: background 140ms, box-shadow 140ms;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: #010030;
  vertical-align: baseline;
}
.field:empty::before {
  content: attr(data-placeholder);
  color: rgba(175,52,255,0.55);
  font-style: italic;
  font-size: 0.88em;
}
.field:focus {
  background: rgba(175,52,255,0.13);
  box-shadow: 0 0 0 2.5px rgba(175,52,255,0.22);
}
.field.filled {
  background: rgba(175,52,255,0.04);
  border-bottom-color: rgba(175,52,255,0.4);
}

.field-input {
  width: 100%;
  padding: 7px 11px;
  background: rgba(175,52,255,0.05);
  border: 1.5px dashed rgba(175,52,255,0.35);
  border-radius: 7px;
  font-family: 'Rubik', sans-serif;
  font-size: 13px;
  color: #010030;
  outline: none;
  transition: all 150ms;
}
.field-input:focus {
  background: rgba(175,52,255,0.09);
  border-color: #AF34FF;
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(175,52,255,0.15);
}
.field-input::placeholder { color: rgba(175,52,255,0.5); font-style: italic; }

/* ── Signature Page ───────────────────────────────────────── */
.sig-page {
  margin-top: 56px;
  padding-top: 36px;
  border-top: 2px solid rgba(1,0,48,0.09);
  page-break-before: auto;
  break-before: auto;
}

.sig-page-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #AF34FF;
  margin-bottom: 6px;
}

.sig-intro-text {
  font-size: 15px;
  line-height: 1.68;
  color: #010030;
  margin-bottom: 32px;
  max-width: 600px;
}

.sig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.sig-party {
  border: 1px solid rgba(1,0,48,0.11);
  border-radius: 12px;
  padding: 24px;
  background: #FAFAFA;
}

.sig-party-name {
  font-size: 14px;
  font-weight: 700;
  color: #010030;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(1,0,48,0.09);
  line-height: 1.3;
}

.sig-row {
  margin-bottom: 14px;
}

.sig-row label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #6F6E8C;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.sig-input {
  width: 100%;
  padding: 8px 11px;
  background: #FFFFFF;
  border: 1.5px solid rgba(1,0,48,0.12);
  border-radius: 7px;
  font-family: 'Rubik', sans-serif;
  font-size: 13.5px;
  color: #010030;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
.sig-input:focus {
  border-color: #AF34FF;
  box-shadow: 0 0 0 3px rgba(175,52,255,0.15);
}
.sig-input::placeholder { color: rgba(1,0,48,0.25); font-style: italic; }

.sig-fixed {
  font-size: 13px;
  color: #2B2A5E;
  padding: 8px 11px;
  background: rgba(1,0,48,0.03);
  border-radius: 7px;
  border: 1px solid rgba(1,0,48,0.07);
  line-height: 1.4;
}

.sig-line-container { margin-bottom: 18px; }

.sig-line-container label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #6F6E8C;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.sig-line {
  height: 1px;
  background: rgba(1,0,48,0.2);
  position: relative;
}
.sig-line::after {
  content: 'Sign here';
  position: absolute;
  right: 0; top: 4px;
  font-size: 10px;
  color: rgba(1,0,48,0.28);
  font-style: italic;
  letter-spacing: 0.05em;
}

/* ── Completion Bar ───────────────────────────────────────── */
.completion-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: #010030;
  padding: 0 24px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: rgba(252,252,252,0.5);
  font-family: 'Rubik', sans-serif;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.cb-progress {
  flex: 1;
  max-width: 160px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
}

.cb-fill {
  height: 100%;
  background: #AF34FF;
  border-radius: 99px;
  transition: width 500ms ease;
}

.cb-label { font-weight: 500; }

.cb-spacer { flex: 1; }

/* ── Print ────────────────────────────────────────────────── */
@media print {
  body { background: white; }

  .completion-bar,
  .cover-top-bar,
  .doc-header-actions { display: none !important; }

  .cover-page { min-height: 100vh; height: 100vh; page-break-after: always; }

  .doc-shell { box-shadow: none; padding: 0 40px; }

  .doc-header { padding-top: 20px; }

  .field {
    background: transparent !important;
    border-bottom-color: #ccc !important;
    box-shadow: none !important;
  }
  .field:empty::before { content: '' !important; }

  .sig-party { background: white !important; }

  .doc-section { page-break-inside: avoid; }
  h2, h3 { page-break-after: avoid; }

  @page { margin: 1in; size: letter; }
  @page :first { margin: 0; }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 700px) {
  .doc-shell { padding: 0 20px 60px; }
  .cover-page { padding: 48px 24px; }
  .cover-title { font-size: 28px; }
  .sig-grid { grid-template-columns: 1fr; }
  .def-term { width: 130px; min-width: 130px; }
}
