/* ══════════════════════════════════════
   WEM Ride Invoice Generator — Styles
   ══════════════════════════════════════ */

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1c1c28;
  --surface3: #252535;
  --accent: #00e5a0;
  --accent2: #7c3aed;
  --accent3: #f59e0b;
  --text: #f0f0f5;
  --text2: #9999bb;
  --text3: #555577;
  --border: #2a2a40;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  gap: 0;
}

/* ── FORM PANEL ── */
#form-panel {
  width: 480px;
  min-width: 480px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.panel-logo .logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.panel-logo .logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.panel-logo span {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.field label .required {
  color: var(--danger);
  margin-left: 2px;
  font-weight: 700;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.form-section {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form-row.three {
  grid-template-columns: 1fr 1fr 1fr;
}

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

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

.field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.field input,
.field select,
.field textarea {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 229, 160, 0.1);
}

.field textarea {
  resize: vertical;
  min-height: 60px;
}

.field select option {
  background: var(--surface2);
}

.field input[readonly] {
  color: var(--accent);
  font-weight: 600;
  cursor: not-allowed;
  background: rgba(0, 229, 160, 0.05);
}

/* Fare rows — no quantity column */
.fare-row {
  display: grid;
  grid-template-columns: 1fr 120px 40px;
  gap: 8px;
  align-items: end;
}

.fare-row .remove-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-bottom: 1px;
}

.fare-row .remove-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

.add-btn {
  background: rgba(0, 229, 160, 0.08);
  border: 1px dashed rgba(0, 229, 160, 0.4);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  width: 100%;
  transition: all 0.2s;
}

.add-btn:hover {
  background: rgba(0, 229, 160, 0.15);
  border-style: solid;
}

.gst-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  width: 40px;
  height: 22px;
  background: var(--surface3);
  border-radius: 11px;
  position: relative;
  border: 1px solid var(--border);
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch.on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.toggle-switch.on::after {
  transform: translateX(18px);
}

.gst-label {
  font-size: 13px;
  font-weight: 500;
}

.gst-fields {
  display: none;
}

.gst-fields.visible {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Generate btn */
.gen-btn {
  background: linear-gradient(135deg, var(--accent), #00b87a);
  color: #000;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 15px;
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  width: 100%;
  letter-spacing: 0.3px;
  transition: all 0.2s;
  box-shadow: 0 4px 24px rgba(0, 229, 160, 0.25);
}

.gen-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 32px rgba(0, 229, 160, 0.4);
}

.gen-btn:active {
  transform: translateY(0);
}

/* ── PREVIEW PANEL ── */
#preview-panel {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.preview-actions {
  display: flex;
  gap: 12px;
  align-self: flex-end;
}

.action-btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-btn:hover {
  background: var(--surface3);
  border-color: var(--accent);
  color: var(--accent);
}

.action-btn.primary {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #fff;
}

.action-btn.primary:hover {
  background: #6d28d9;
}

/* NEMBHARAT logo banner between header and body */
.inv-logo-banner {
  background: #ffffff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #e0e0e0;
}

.inv-logo-banner img {
  max-height: 60px;
  width: 100%;
  object-fit: contain;
}

/* ── INVOICE (Standard) ── */
#invoice {
  background: #ffffff;
  width: 750px;
  min-width: 750px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  color: #1a1a1a;
  font-family: 'DM Sans', sans-serif;
}

.inv-header {
  background: #1a237e;
  padding: 36px 40px 28px;
  position: relative;
  overflow: hidden;
}

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

.inv-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inv-brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inv-brand-logo .icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.inv-brand-logo .icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.inv-brand-name {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.inv-brand-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}

.inv-tag {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.inv-header-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 28px;
  position: relative;
  z-index: 1;
}

.inv-number {
  font-family: 'Space Mono', monospace;
  font-size: 26px;
  color: #fff;
  font-weight: 700;
}

.inv-number-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.inv-dates {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inv-date-item {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.inv-date-item span {
  color: #fff;
  font-weight: 600;
  margin-left: 6px;
}

.inv-body {
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.inv-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.inv-party {
  background: #f8f8f8;
  border-radius: 10px;
  padding: 18px 20px;
  border: 1px solid #e0e0e0;
}

.inv-party-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #333;
  margin-bottom: 10px;
}

.inv-party-name {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.inv-party-detail {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
}

.inv-party-gstin {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #333;
  background: #f0f0f0;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 6px;
}

/* Ride summary strip */
.ride-strip {
  background: #1a237e;
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.ride-strip-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 120px;
}

.ride-strip-item label {
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.ride-strip-item value {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.ride-strip-divider {
  width: 1px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
}

/* Fare table — 2 columns only (description + amount) */
.fare-table {
  width: 100%;
  border-collapse: collapse;
}

.fare-table thead tr {
  background: #1a237e;
}

.fare-table thead th {
  padding: 12px 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  text-align: left;
}

.fare-table thead th:last-child {
  text-align: right;
}

.fare-table tbody tr {
  border-bottom: 1px solid #eee;
}

.fare-table tbody tr:last-child {
  border: none;
}

.fare-table tbody td {
  padding: 13px 16px;
  font-size: 13px;
  color: #333;
}

.fare-table tbody td:last-child {
  text-align: right;
  font-weight: 600;
  color: #1a1a1a;
}

.fare-table tbody tr:nth-child(even) td {
  background: #fafafa;
}

.fare-table tfoot {
  border-top: 2px solid #1a237e;
}

.totals-box {
  margin-left: auto;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid #eee;
}

.total-row:last-child {
  border: none;
}

.total-row .label {
  color: #666;
}

.total-row .value {
  font-weight: 600;
  color: #1a1a1a;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
}

.total-row.grand {
  background: #1a237e;
  padding: 14px 16px;
}

.total-row.grand .label {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
  font-size: 14px;
}

.total-row.grand .value {
  color: #ffffff;
  font-size: 15px;
  font-family: 'Space Mono', monospace;
}

.total-row.discount .value {
  color: #333;
}

.total-row.tax .label {
  font-size: 11px;
}

/* Payment status badge */
.payment-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 14px 20px;
}

.status-badge {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.status-badge.paid {
  background: #e0e0e0;
  color: #1a1a1a;
}

.status-badge.unpaid {
  background: #e0e0e0;
  color: #1a1a1a;
}

.status-badge.pending {
  background: #e0e0e0;
  color: #1a1a1a;
}

.payment-mode {
  font-size: 12px;
  color: #333;
}

.payment-mode strong {
  font-weight: 700;
}

.payment-amt {
  font-family: 'Space Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
}

.inv-footer {
  background: #f5f5f5;
  border-top: 1px solid #e0e0e0;
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inv-footer-note {
  font-size: 11px;
  color: #999;
  max-width: 380px;
  line-height: 1.6;
}

.inv-footer-brand {
  font-size: 11px;
  color: #bbb;
  text-align: right;
}

.inv-footer-brand strong {
  color: #333;
}

.gst-notice {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 11px;
  color: #333;
  line-height: 1.6;
}

.gst-notice strong {
  font-weight: 700;
}

.hsn-badge {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  background: #f0f0f0;
  color: #333;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Empty state */
.empty-invoice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 40px;
  color: var(--text2);
  text-align: center;
}

.empty-invoice .big-icon {
  font-size: 60px;
  opacity: 0.3;
}

.empty-invoice h3 {
  font-size: 18px;
  color: var(--text);
  font-weight: 600;
}

.empty-invoice p {
  font-size: 13px;
  max-width: 300px;
  line-height: 1.6;
}

@media print {
  body {
    background: white;
  }

  #form-panel,
  .preview-actions {
    display: none;
  }

  #preview-panel {
    padding: 0;
    background: white;
  }

  #invoice {
    box-shadow: none;
    border-radius: 0;
    min-width: 100%;
    width: 100%;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 3px;
}