/**
 * Demand Letter Generator - Shared Styles
 * Common CSS for all demand letter generators
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  --dl-primary: #0f766e;
  --dl-primary-dark: #0d5d57;
  --dl-primary-light: #14b8a6;
  --dl-secondary: #059669;
  --dl-accent: #2563eb;
  --dl-success: #10b981;
  --dl-warning: #f59e0b;
  --dl-danger: #ef4444;
  --dl-purple: #a855f7;

  --dl-bg: #f8fafc;
  --dl-card: #ffffff;
  --dl-border: #e2e8f0;
  --dl-text: #334155;
  --dl-text-muted: #64748b;
  --dl-text-light: #94a3b8;

  --dl-dark-bg: #0f172a;
  --dl-dark-card: #1e293b;
  --dl-dark-border: #334155;
  --dl-dark-text: #f1f5f9;
}

/* ============================================
   GENERATOR CONTAINER
   ============================================ */
.dl-generator {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--dl-text);
}

.dl-generator * {
  box-sizing: border-box;
}

/* ============================================
   DOCUMENT TYPE TABS
   ============================================ */
.dl-doc-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--dl-bg);
  border-radius: 12px;
  border: 1px solid var(--dl-border);
}

.dl-doc-tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dl-text-muted);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dl-doc-tab:hover {
  background: rgba(15, 118, 110, 0.1);
  color: var(--dl-primary);
}

.dl-doc-tab.active {
  background: var(--dl-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.3);
}

.dl-doc-tab-icon {
  font-size: 1.1rem;
}

/* ============================================
   TWO-PANEL LAYOUT
   ============================================ */
.dl-layout {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 16px;
  min-height: 600px;
}

@media (max-width: 1024px) {
  .dl-layout {
    grid-template-columns: 1fr;
  }
}

.dl-form-panel {
  background: var(--dl-card);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--dl-border);
  overflow-y: auto;
  max-height: 80vh;
}

.dl-preview-panel {
  background: linear-gradient(135deg, var(--dl-dark-bg) 0%, var(--dl-dark-card) 100%);
  border-radius: 8px;
  padding: 16px;
  color: var(--dl-dark-text);
  overflow-y: auto;
  max-height: 80vh;
}

/* ============================================
   FORM SECTIONS
   ============================================ */
.dl-form-section {
  margin-bottom: 24px;
}

.dl-form-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dl-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dl-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 600px) {
  .dl-form-grid {
    grid-template-columns: 1fr;
  }
}

.dl-form-grid.full-width {
  grid-template-columns: 1fr;
}

.dl-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dl-form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dl-text-muted);
}

.dl-form-input,
.dl-form-select,
.dl-form-textarea {
  padding: 10px 12px;
  border: 1px solid var(--dl-border);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dl-form-input:focus,
.dl-form-select:focus,
.dl-form-textarea:focus {
  outline: none;
  border-color: var(--dl-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.dl-form-textarea {
  min-height: 80px;
  resize: vertical;
}

/* ============================================
   AMOUNT HERO
   ============================================ */
.dl-amount-hero {
  background: linear-gradient(135deg, var(--dl-primary) 0%, var(--dl-secondary) 100%);
  border-radius: 12px;
  padding: 20px;
  color: white;
  text-align: center;
  margin-bottom: 16px;
}

.dl-amount-label {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 4px;
}

.dl-amount-value {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.dl-amount-breakdown {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.2);
}

.dl-amount-item {
  text-align: center;
}

.dl-amount-item-value {
  font-size: 1.1rem;
  font-weight: 700;
}

.dl-amount-item-label {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* ============================================
   RISK GAUGE
   ============================================ */
.dl-risk-gauge {
  background: linear-gradient(135deg, var(--dl-dark-card) 0%, #334155 100%);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  color: white;
}

.dl-risk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dl-risk-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
}

.dl-risk-score {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.dl-risk-score-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.dl-risk-score-label {
  font-size: 0.75rem;
  opacity: 0.7;
}

.dl-risk-bar {
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  height: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.dl-risk-bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s ease;
}

.dl-risk-bar-fill.high { background: var(--dl-success); }
.dl-risk-bar-fill.medium { background: var(--dl-warning); }
.dl-risk-bar-fill.low { background: var(--dl-danger); }

.dl-risk-factors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.8rem;
}

.dl-risk-factor {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
}

.dl-risk-factor.positive {
  background: rgba(16, 185, 129, 0.2);
}

.dl-risk-factor.negative {
  background: rgba(239, 68, 68, 0.2);
}

.dl-risk-tip {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(16, 185, 129, 0.15);
  border-radius: 8px;
  font-size: 0.8rem;
  border-left: 3px solid var(--dl-success);
}

/* ============================================
   JURISDICTION BOX
   ============================================ */
.dl-jurisdiction-box {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.1);
}

.dl-jurisdiction-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.dl-jurisdiction-court {
  font-weight: 700;
  font-size: 1.1rem;
}

.dl-jurisdiction-location {
  font-size: 0.85rem;
  color: var(--dl-text-light);
  margin-top: 4px;
}

.dl-jurisdiction-fee {
  text-align: right;
}

.dl-jurisdiction-fee-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dl-warning);
}

.dl-jurisdiction-fee-label {
  font-size: 0.75rem;
  color: var(--dl-text-light);
}

/* ============================================
   PLEADING PAPER
   ============================================ */
.dl-pleading-paper {
  background: white;
  color: #000;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 24px 16px 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  line-height: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  border-radius: 4px;
}

.dl-pleading-lines-wrapper {
  display: flex;
  min-height: calc(28 * 24px);
}

.dl-pleading-line-numbers {
  width: 36px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0;
  color: #666;
  font-size: 10px;
}

.dl-pleading-line-numbers .line-num {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dl-pleading-vertical-line {
  width: 8px;
  flex-shrink: 0;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  margin-left: 4px;
}

.dl-pleading-content {
  flex: 1;
  padding-left: 16px;
}

.dl-pleading-content .content-line {
  height: 24px;
  line-height: 24px;
  white-space: pre;
  overflow: hidden;
}

/* Caption page (no line numbers) */
.dl-pleading-caption {
  padding: 0 40px;
}

.dl-pleading-caption .content-line {
  height: 24px;
  line-height: 24px;
  white-space: pre;
  overflow: hidden;
}

.dl-pleading-page-footer {
  text-align: center;
  padding-top: 12px;
  font-size: 10px;
  color: #666;
  border-top: 1px solid #ccc;
  margin-top: 12px;
}

/* ============================================
   DOCUMENT PREVIEW
   ============================================ */
.dl-document-preview {
  background: white;
  color: #000;
  border-radius: 8px;
  padding: 24px;
  font-family: 'Times New Roman', Times, serif;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 500px;
  overflow-y: auto;
}

.dl-document-preview.locked {
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================
   EXPORT TOOLBAR
   ============================================ */
.dl-export-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.dl-export-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.dl-export-btn.primary {
  background: var(--dl-primary);
  color: white;
}

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

.dl-export-btn.secondary {
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}

.dl-export-btn.secondary:hover {
  background: rgba(255,255,255,0.2);
}

.dl-export-btn.locked {
  opacity: 0.7;
}

.dl-export-btn .lock-icon {
  font-size: 0.9rem;
}

/* ============================================
   PAYPAL MODAL
   ============================================ */
.dl-paypal-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.dl-paypal-modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.dl-paypal-modal h3 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  color: var(--dl-text);
}

.dl-paypal-price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--dl-primary);
  margin-bottom: 16px;
}

.dl-paypal-features {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  text-align: left;
}

.dl-paypal-features li {
  padding: 8px 0;
  border-bottom: 1px solid var(--dl-border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.dl-paypal-features li::before {
  content: '✓';
  color: var(--dl-success);
  font-weight: bold;
}

.dl-paypal-attorney-note {
  background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 100%);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.85rem;
  color: var(--dl-text);
  margin-bottom: 20px;
  line-height: 1.5;
}

.dl-paypal-close-btn {
  margin-top: 16px;
  padding: 10px 24px;
  background: transparent;
  border: 1px solid var(--dl-border);
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--dl-text-muted);
  transition: all 0.2s;
}

.dl-paypal-close-btn:hover {
  background: var(--dl-bg);
}

/* ============================================
   UNLOCK BANNER
   ============================================ */
.dl-unlock-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dl-unlock-banner-text {
  font-size: 0.85rem;
  color: #92400e;
}

.dl-unlock-banner-btn {
  padding: 8px 16px;
  background: var(--dl-primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.dl-unlock-banner-btn:hover {
  background: var(--dl-primary-dark);
}

/* ============================================
   INTEREST CALCULATOR
   ============================================ */
.dl-interest-calc {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.1);
}

.dl-interest-calc-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dl-interest-calc-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.85rem;
}

.dl-interest-calc-row.total {
  border-top: 1px solid rgba(255,255,255,0.2);
  margin-top: 8px;
  padding-top: 12px;
  font-weight: 700;
  font-size: 1rem;
}

/* ============================================
   FORUM ANALYZER
   ============================================ */
.dl-forum-analyzer {
  margin-bottom: 16px;
}

.dl-forum-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dl-forum-option {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.dl-forum-option:hover {
  background: rgba(255,255,255,0.1);
}

.dl-forum-option.recommended {
  border-color: var(--dl-success);
  background: rgba(16, 185, 129, 0.1);
}

.dl-forum-option-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dl-forum-option-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.dl-forum-option-fee {
  font-size: 0.85rem;
  color: var(--dl-warning);
}

.dl-forum-option-desc {
  font-size: 0.8rem;
  color: var(--dl-text-light);
  margin-top: 4px;
}

.dl-forum-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--dl-success);
  color: white;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 8px;
}

/* ============================================
   TIMELINE
   ============================================ */
.dl-timeline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  margin-bottom: 16px;
  position: relative;
}

.dl-timeline::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 60px;
  right: 60px;
  height: 2px;
  background: rgba(255,255,255,0.2);
  transform: translateY(-50%);
}

.dl-timeline-point {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 1;
}

.dl-timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--dl-primary);
}

.dl-timeline-dot.past { background: var(--dl-success); }
.dl-timeline-dot.current { background: var(--dl-warning); }
.dl-timeline-dot.future { background: var(--dl-text-light); }

.dl-timeline-label {
  font-size: 0.7rem;
  color: var(--dl-text-light);
  text-align: center;
}

.dl-timeline-date {
  font-size: 0.75rem;
  font-weight: 600;
}

/* ============================================
   AI UPLOAD
   ============================================ */
.dl-ai-upload {
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.dl-ai-upload:hover {
  border-color: var(--dl-primary);
  background: rgba(15, 118, 110, 0.1);
}

.dl-ai-upload-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.dl-ai-upload-text {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.dl-ai-upload-hint {
  font-size: 0.8rem;
  color: var(--dl-text-light);
}

.dl-ai-analyzing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
}

.dl-ai-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--dl-primary);
  border-radius: 50%;
  animation: dl-spin 1s linear infinite;
}

@keyframes dl-spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   INVOICE TABLE
   ============================================ */
.dl-invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.dl-invoice-table th,
.dl-invoice-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--dl-border);
}

.dl-invoice-table th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--dl-text-muted);
  text-transform: uppercase;
}

.dl-invoice-table td {
  font-size: 0.9rem;
}

.dl-invoice-table .amount {
  font-weight: 600;
  text-align: right;
}

.dl-invoice-table .add-row {
  cursor: pointer;
  color: var(--dl-primary);
  font-weight: 600;
}

.dl-invoice-table .add-row:hover {
  color: var(--dl-primary-dark);
}

.dl-invoice-table .remove-btn {
  background: none;
  border: none;
  color: var(--dl-danger);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
  .dl-amount-value {
    font-size: 2rem;
  }

  .dl-paypal-modal {
    padding: 24px;
  }

  .dl-paypal-price {
    font-size: 2rem;
  }

  .dl-export-toolbar {
    flex-direction: column;
  }

  .dl-export-btn {
    justify-content: center;
  }

  .dl-pleading-paper {
    font-size: 9px;
    line-height: 20px;
  }
}
