/* === RESET & BASE === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0C1220;
  --surface: #151E30;
  --surface2: #1A2540;
  --border: #243052;
  --border-emphasis: #2E3D66;
  --text: #E8EFF7;
  --text-muted: #8A9BBF;
  --accent: #E8913A;
  --accent-dim: rgba(232,145,58,0.12);
  --accent-border: rgba(232,145,58,0.4);
  --amber: #E8913A;
  --radius-sm: 8px;
  --radius: 12px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === LAYOUT === */
.app {
  display: flex;
  min-height: 100vh;
}

/* === LEFT PANEL === */
.left-panel {
  width: 380px;
  min-width: 380px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.panel-header {
  position: relative;
  margin-bottom: 28px;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-claim { color: #fff; }
.logo-tight { color: var(--accent); }
.logo-ai { color: #fff; opacity: 0.7; }

.tagline {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.3px;
}

.live-badge {
  position: absolute;
  top: 4px;
  right: 0;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* === SAMPLES === */
.samples-section {
  margin-bottom: 18px;
}

.section-label {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 10px;
}

.sample-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sample-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.88rem;
  font-weight: 400;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  text-align: left;
}

.sample-btn:hover {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  transform: translateX(3px);
}

.sample-btn:active {
  transform: translateX(1px);
}

.sample-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.sample-text {
  line-height: 1.3;
}

/* === DIVIDER === */
.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* === FORM === */
.claim-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

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

.form-group label {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.form-group input,
.form-group textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(138,155,191,0.4);
}

.form-group textarea {
  min-height: 200px;
  resize: vertical;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  line-height: 1.7;
}

/* === SUBMIT BUTTON === */
.submit-btn {
  width: 100%;
  background: var(--accent);
  color: #0C1220;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

.submit-btn:hover:not(:disabled) {
  background: #D17E2E;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(232,145,58,0.3);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.btn-loading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(12,18,32,0.3);
  border-top-color: #0C1220;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-status {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  animation: statusFade 1.8s ease-in-out infinite;
}

@keyframes statusFade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* === RIGHT PANEL === */
.right-panel {
  flex: 1;
  padding: 36px 48px;
  overflow-y: auto;
}

/* === PLACEHOLDER === */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  gap: 20px;
  opacity: 0.6;
}

.placeholder svg {
  opacity: 0.4;
}

.placeholder p {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* === RESULTS === */
.results {
  animation: fadeIn 0.6s ease-out;
}

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

/* === STAGGERED SECTION ANIMATIONS === */
.result-section {
  margin-bottom: 40px;
  opacity: 0;
  transform: translateY(16px);
  animation: sectionReveal 0.5s ease-out forwards;
}

.result-section:nth-child(1) { animation-delay: 0.1s; }
.result-section:nth-child(2) { animation-delay: 0.25s; }
.result-section:nth-child(3) { animation-delay: 0.4s; }
.result-section:nth-child(4) { animation-delay: 0.55s; }

@keyframes sectionReveal {
  to { opacity: 1; transform: translateY(0); }
}

/* === PACKAGE HEADER === */
.package-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 36px;
  position: relative;
  animation: headerSlide 0.5s ease-out;
}

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

.package-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 var(--radius) var(--radius);
}

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

.pkg-left .pkg-claim-number {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.pkg-left .pkg-claimant {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.pkg-left .pkg-address {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.88rem;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

.pkg-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.pkg-right .pkg-meta {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.draft-badge {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--amber);
  background: rgba(210,153,34,0.12);
  border: 1px solid rgba(210,153,34,0.3);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  margin-top: 4px;
  letter-spacing: 1px;
}

/* === SECTION HEADINGS === */
.section-heading {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-number {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  display: block;
  margin-bottom: 4px;
}

.section-subtitle {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  color: rgba(138,155,191,0.5);
  display: block;
}

/* === PHOTO GRID === */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.photo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  opacity: 0;
  transform: scale(0.95);
  animation: cardPop 0.4s ease-out forwards;
}

.photo-card:nth-child(1) { animation-delay: 0.15s; }
.photo-card:nth-child(2) { animation-delay: 0.2s; }
.photo-card:nth-child(3) { animation-delay: 0.25s; }
.photo-card:nth-child(4) { animation-delay: 0.3s; }
.photo-card:nth-child(5) { animation-delay: 0.35s; }
.photo-card:nth-child(6) { animation-delay: 0.4s; }
.photo-card:nth-child(7) { animation-delay: 0.45s; }
.photo-card:nth-child(8) { animation-delay: 0.5s; }
.photo-card:nth-child(9) { animation-delay: 0.55s; }

@keyframes cardPop {
  to { opacity: 1; transform: scale(1); }
}

.photo-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.photo-placeholder {
  aspect-ratio: 4 / 3;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.photo-placeholder svg.photo-scene {
  opacity: 1;
}

.photo-scene {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.photo-slot-num {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.78rem;
  color: #fff;
  background: rgba(0,0,0,0.55);
  padding: 2px 7px;
  border-radius: 3px;
  z-index: 2;
  backdrop-filter: blur(4px);
}

.photo-info {
  padding: 12px 14px;
}

.photo-area {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.3;
}

.photo-damage-type {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.photo-caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* === LOSS SUMMARY TABLE === */
.loss-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.loss-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.loss-table th {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-emphasis);
  background: rgba(255,255,255,0.02);
}

.loss-table th.cost-col {
  text-align: right;
}

.loss-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  line-height: 1.4;
}

.loss-table tbody tr {
  transition: background 0.15s;
}

.loss-table tbody tr:hover:not(.total-row) {
  background: rgba(255,255,255,0.03);
}

.loss-table tr:nth-child(even) td {
  background: rgba(255,255,255,0.015);
}

.loss-table td.cost-cell {
  text-align: right;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.loss-table td.notes-cell {
  color: var(--text-muted);
  font-size: 0.82rem;
  max-width: 280px;
}

.loss-table .total-row td {
  border-top: 2px solid var(--accent-border);
  border-bottom: none;
  font-weight: 500;
  padding-top: 16px;
  padding-bottom: 16px;
  background: var(--accent-dim);
}

.loss-table .total-row td.total-label {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1.5px;
}

.loss-table .total-row td.cost-cell {
  font-size: 1.25rem;
  color: var(--accent);
}

/* === NARRATIVE === */
.narrative {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
}

.narrative p {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.85;
  color: rgba(232,239,247,0.9);
  margin-bottom: 22px;
}

.narrative p:first-child::first-letter {
  font-size: 2em;
  font-weight: 500;
  color: var(--accent);
  float: left;
  line-height: 1;
  margin-right: 6px;
  margin-top: 4px;
}

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

/* === DOCUMENT INDEX === */
.doc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  transition: border-color 0.2s, transform 0.15s;
  opacity: 0;
  transform: translateX(-8px);
  animation: docSlide 0.35s ease-out forwards;
}

.doc-item:nth-child(1) { animation-delay: 0.6s; }
.doc-item:nth-child(2) { animation-delay: 0.65s; }
.doc-item:nth-child(3) { animation-delay: 0.7s; }
.doc-item:nth-child(4) { animation-delay: 0.75s; }
.doc-item:nth-child(5) { animation-delay: 0.8s; }
.doc-item:nth-child(6) { animation-delay: 0.85s; }
.doc-item:nth-child(7) { animation-delay: 0.9s; }
.doc-item:nth-child(8) { animation-delay: 0.95s; }

@keyframes docSlide {
  to { opacity: 1; transform: translateX(0); }
}

.doc-item:hover {
  border-color: var(--accent-border);
  transform: translateX(3px);
}

.doc-number {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  color: var(--accent);
  min-width: 24px;
  font-weight: 500;
}

.doc-checkbox {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-emphasis);
  border-radius: 3px;
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.doc-item:hover .doc-checkbox {
  border-color: var(--accent-border);
}

.doc-name {
  color: var(--text);
  line-height: 1.3;
}

.doc-note {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 16px;
  padding-left: 4px;
  opacity: 0.7;
}

/* === FOOTER === */
.results-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.footer-left {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.print-btn {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.print-btn:hover {
  border-color: var(--accent-border);
  color: var(--text);
  background: var(--accent-dim);
}

/* === ERROR === */
.error-display {
  background: rgba(248,81,73,0.08);
  border: 1px solid rgba(248,81,73,0.25);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.88rem;
  color: #f85149;
  margin-top: 40px;
  animation: fadeIn 0.3s ease-out;
}

/* === SCROLLBAR === */
.left-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar {
  width: 6px;
}

.left-panel::-webkit-scrollbar-track,
.right-panel::-webkit-scrollbar-track {
  background: transparent;
}

.left-panel::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
}

.left-panel::-webkit-scrollbar-thumb:hover,
.right-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.15);
}

/* === PRINT STYLES === */
@media print {
  body {
    background: #fff;
    color: #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .left-panel {
    display: none !important;
  }

  .right-panel {
    padding: 20px;
  }

  .app {
    display: block;
  }

  .package-header,
  .result-section,
  .photo-card,
  .doc-item {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .package-header {
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: none;
  }

  .package-header::after {
    background: #E8913A;
  }

  .pkg-left .pkg-claimant,
  .photo-area {
    color: #000;
  }

  .pkg-left .pkg-claim-number,
  .photo-damage-type,
  .loss-table td.cost-cell,
  .loss-table .total-row td.cost-cell,
  .doc-number {
    color: #E8913A;
  }

  .pkg-left .pkg-address,
  .pkg-right .pkg-meta,
  .section-number,
  .section-subtitle,
  .photo-caption,
  .loss-table th,
  .doc-note,
  .footer-left,
  .loss-table td.notes-cell,
  .loss-table .total-row td.total-label {
    color: #666;
  }

  .photo-card,
  .doc-item,
  .loss-summary,
  .narrative {
    background: #fff;
    border-color: #ddd;
  }

  .photo-placeholder {
    background: #f0f0f0;
  }

  .section-heading {
    border-bottom-color: #ddd;
  }

  .loss-table td {
    color: #000;
    border-color: #ddd;
  }

  .loss-table th {
    background: #f5f5f5;
  }

  .loss-table tr:nth-child(even) td {
    background: #f8f8f8;
  }

  .loss-table .total-row td {
    border-top-color: #E8913A;
    background: rgba(232,145,58,0.05);
  }

  .narrative p {
    color: #000;
  }

  .doc-name {
    color: #000;
  }

  .doc-checkbox {
    border-color: #999;
  }

  .results-footer {
    border-top-color: #ddd;
  }

  .print-btn {
    display: none;
  }

  .placeholder,
  .error-display {
    display: none !important;
  }
}
