/* ==========================================================================
   Kurb Legal & Account Management - Shared Design System
   Modern, responsive, accessible, mobile-first design system
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --brand-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 50%, #06b6d4 100%);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;
  
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-tag: #e2e8f0;
  
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --danger-hover: #b91c1c;

  --warning: #d97706;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;

  --success: #16a34a;
  --success-light: #f0fdf4;
  --success-border: #bbf7d0;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 10px 10px -5px rgba(15, 23, 42, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --container-max: 880px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text-main);
  background-color: var(--bg-page);
  line-height: 1.7;
  letter-spacing: -0.01em;
  padding-bottom: 60px;
  min-height: 100vh;
}

/* Header & Brand Banner */
.page-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.95);
}

.header-container {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.brand-logo {
  height: 42px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
}

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

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.3);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

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

.header-meta {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

/* Container */
.main-wrapper {
  max-width: var(--container-max);
  margin: 32px auto 0;
  padding: 0 20px;
}

/* Card Wrapper */
.doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 40px;
}

@media (max-width: 640px) {
  .doc-card {
    padding: 24px 18px;
    border-radius: var(--radius-md);
  }
  .page-header {
    padding: 16px;
  }
}

/* Document Title Header */
.doc-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
  margin-bottom: 28px;
}

.doc-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 12px;
}

.doc-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.doc-metadata-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

/* Summary Box / Callout */
.callout {
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 14px;
  line-height: 1.65;
}

.callout-info {
  background: #f0f7ff;
  border-left: 4px solid var(--primary);
  color: #1e3a8a;
}

.callout-warning {
  background: var(--warning-light);
  border-left: 4px solid var(--warning);
  color: #92400e;
}

.callout-danger {
  background: var(--danger-light);
  border-left: 4px solid var(--danger);
  color: #991b1b;
}

.callout-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Table of Contents */
.toc-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 32px;
}

.toc-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px 16px;
}

.toc-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  display: inline-block;
  transition: var(--transition);
}

.toc-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  transform: translateX(2px);
}

/* Content Typography */
.content-section {
  margin-bottom: 36px;
}

.content-section:last-child {
  margin-bottom: 0;
}

.section-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section-number {
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 16px;
}

.sub-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 20px 0 10px;
}

p {
  color: #334155;
  margin-bottom: 12px;
  font-size: 14.5px;
  line-height: 1.75;
}

p:last-child {
  margin-bottom: 0;
}

ul, ol {
  margin: 10px 0 16px 20px;
  color: #334155;
  font-size: 14.5px;
  line-height: 1.75;
}

li {
  margin-bottom: 8px;
}

li:last-child {
  margin-bottom: 0;
}

strong {
  color: var(--text-main);
  font-weight: 600;
}

/* Tables for SDK / Permissions */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.doc-table th {
  background: var(--bg-subtle);
  color: var(--text-main);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.doc-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  color: #334155;
  line-height: 1.6;
}

.doc-table tr:last-child td {
  border-bottom: none;
}

.doc-table tr:hover td {
  background-color: #fafbfc;
}

/* Footer Note */
.doc-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-outline {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-subtle);
}

.btn-block {
  width: 100%;
}

/* Delete Account Specific Elements */
.danger-zone {
  border: 2px dashed var(--danger-border);
  background: #fff8f8;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 24px 0;
}

.danger-zone-title {
  color: var(--danger);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.impact-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.impact-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.impact-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Step Guides */
.steps-container {
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.step-item {
  display: flex;
  gap: 16px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-content h4 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.step-content p {
  font-size: 13.5px;
  color: var(--text-muted);
}

/* Form Styles */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  transition: var(--transition);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--danger);
  margin-top: 2px;
  cursor: pointer;
}

.checkbox-label {
  font-size: 13.5px;
  color: #334155;
  cursor: pointer;
  line-height: 1.5;
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-xl);
  transform: translateY(10px);
  transition: transform 0.2s ease;
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 22px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Toast Notice */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  z-index: 999;
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition);
  pointer-events: none;
}

.toast-notice.show {
  opacity: 1;
  transform: translateY(0);
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 40;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--bg-subtle);
  transform: translateY(-2px);
}
