/* ============================================================
   EasyBooking Invoice Generator — invoice.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --inv-green:       #10b981;
  --inv-green-dark:  #059669;
  --inv-green-light: #d1fae5;
  --inv-teal:        #06b6d4;
  --inv-red:         #ef4444;
  --inv-amber:       #f59e0b;

  --inv-bg:          #f8fafc;
  --inv-surface:     #ffffff;
  --inv-border:      #e2e8f0;
  --inv-border-focus:#10b981;

  --inv-text:        #0f172a;
  --inv-text-muted:  #64748b;
  --inv-text-light:  #94a3b8;

  --inv-radius:      10px;
  --inv-radius-sm:   6px;
  --inv-shadow:      0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --inv-shadow-lg:   0 4px 24px rgba(0,0,0,.12);

  --inv-transition:  .2s cubic-bezier(.4,0,.2,1);
}

/* ── Base ─────────────────────────────────────────────────── */
.ebi-inv-wrapper *,
.ebi-inv-wrapper *::before,
.ebi-inv-wrapper *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.ebi-inv-wrapper {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--inv-text);
  background: var(--inv-bg);
  border-radius: var(--inv-radius);
  max-width: 860px;
  margin: 0 auto;
  padding: 0 0 32px;
}

/* ── Page Header ──────────────────────────────────────────── */
.ebi-inv-page-header {
  text-align: center;
  padding: 40px 24px 28px;
}

.ebi-inv-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--inv-text-muted);
  margin-bottom: 14px;
}

.ebi-inv-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--inv-green);
}

.ebi-inv-page-title {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 700;
  color: var(--inv-text);
  line-height: 1.2;
  margin-bottom: 10px;
}

.ebi-inv-page-sub {
  font-size: 14px;
  color: var(--inv-text-muted);
  max-width: 480px;
  margin: 0 auto;
}

/* ── Mode Tabs ────────────────────────────────────────────── */
.ebi-inv-mode-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 0 20px 28px;
}

.ebi-inv-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 2px solid var(--inv-border);
  background: var(--inv-surface);
  color: var(--inv-text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--inv-transition);
}

.ebi-inv-tab:hover {
  border-color: var(--inv-green);
  color: var(--inv-green);
}

.ebi-inv-tab--active {
  background: var(--inv-green);
  border-color: var(--inv-green);
  color: #fff;
}

.ebi-inv-tab-icon {
  font-size: 16px;
}

/* ── Body ─────────────────────────────────────────────────── */
.ebi-inv-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 20px;
}

/* ── Sections ─────────────────────────────────────────────── */
.ebi-inv-section {
  background: var(--inv-surface);
  border: 1px solid var(--inv-border);
  border-radius: var(--inv-radius);
  padding: 24px;
  box-shadow: var(--inv-shadow);
}

.ebi-inv-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.ebi-inv-section-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--inv-green);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ebi-inv-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--inv-text);
  flex: 1;
}

.ebi-inv-section-save {
  font-size: 11px;
  color: var(--inv-green);
  font-weight: 500;
  letter-spacing: .03em;
}

/* ── Grid ─────────────────────────────────────────────────── */
.ebi-inv-grid {
  display: grid;
  gap: 16px;
}

.ebi-inv-grid--2 { grid-template-columns: 1fr 1fr; }
.ebi-inv-grid--3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Fields ───────────────────────────────────────────────── */
.ebi-inv-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}

.ebi-inv-section > .ebi-inv-field,
.ebi-inv-section > .ebi-inv-grid {
  margin-top: 12px;
}

.ebi-inv-section > .ebi-inv-field:first-of-type,
.ebi-inv-section > .ebi-inv-grid:first-of-type {
  margin-top: 0;
}

.ebi-inv-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--inv-text);
}

.ebi-inv-label-hint {
  font-weight: 400;
  color: var(--inv-text-muted);
}

.ebi-inv-req {
  color: var(--inv-red);
}

/* ── Inputs ───────────────────────────────────────────────── */
.ebi-inv-input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--inv-border);
  border-radius: var(--inv-radius-sm);
  background: var(--inv-bg);
  color: var(--inv-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  transition: border-color var(--inv-transition), box-shadow var(--inv-transition);
  appearance: none;
}

.ebi-inv-input:focus {
  outline: none;
  border-color: var(--inv-green);
  box-shadow: 0 0 0 3px rgba(16,185,129,.15);
  background: #fff;
}

.ebi-inv-input::placeholder {
  color: var(--inv-text-light);
}

.ebi-inv-textarea {
  resize: vertical;
  min-height: 76px;
}

.ebi-inv-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ── VAT Number ───────────────────────────────────────────── */
.ebi-inv-vat-wrap {
  display: flex;
  align-items: stretch;
}

.ebi-inv-vat-prefix {
  display: flex;
  align-items: center;
  padding: 0 11px;
  background: #f1f5f9;
  border: 1.5px solid var(--inv-border);
  border-right: none;
  border-radius: var(--inv-radius-sm) 0 0 var(--inv-radius-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--inv-text-muted);
  flex-shrink: 0;
}

.ebi-inv-vat-input {
  border-radius: 0 var(--inv-radius-sm) var(--inv-radius-sm) 0;
}

.ebi-inv-vat-msg {
  font-size: 12px;
  min-height: 16px;
}

.ebi-inv-vat-msg--ok    { color: var(--inv-green); }
.ebi-inv-vat-msg--error { color: var(--inv-red); }

/* ── Logo Upload ──────────────────────────────────────────── */
.ebi-inv-logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ebi-inv-logo-input {
  display: none;
}

.ebi-inv-logo-btn {
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  border-radius: var(--inv-radius-sm);
  border: 1.5px dashed var(--inv-border);
  background: var(--inv-bg);
  color: var(--inv-green);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--inv-transition), background var(--inv-transition);
}

.ebi-inv-logo-btn:hover {
  border-color: var(--inv-green);
  background: var(--inv-green-light);
}

.ebi-inv-logo-preview-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ebi-inv-logo-preview {
  max-height: 48px;
  max-width: 120px;
  border-radius: 4px;
  object-fit: contain;
  border: 1px solid var(--inv-border);
}

.ebi-inv-logo-remove {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #fee2e2;
  color: var(--inv-red);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--inv-transition);
}

.ebi-inv-logo-remove:hover {
  background: #fecaca;
}

/* ── Non-VAT notice ───────────────────────────────────────── */
.ebi-inv-novat-notice {
  padding: 10px 14px;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: var(--inv-radius-sm);
  font-size: 13px;
  color: #713f12;
  margin-bottom: 14px;
}

/* ── Line Items ───────────────────────────────────────────── */
.ebi-inv-items-head {
  display: grid;
  gap: 8px;
  padding: 0 0 8px;
  border-bottom: 2px solid var(--inv-border);
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--inv-text-muted);
}

/* With VAT column: 5 content cols + delete */
.ebi-inv-items-head.ebi-inv-vat-columns {
  grid-template-columns: 1fr 70px 100px 90px 90px 32px;
}

/* Without VAT column */
.ebi-inv-items-head.ebi-inv-novat-columns {
  grid-template-columns: 1fr 70px 100px 90px 32px;
}

.ebi-inv-col--vat { /* hidden when novat */ }

.ebi-inv-item-row {
  display: grid;
  gap: 8px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--inv-border);
}

.ebi-inv-item-row.ebi-inv-vat-columns {
  grid-template-columns: 1fr 70px 100px 90px 90px 32px;
}

.ebi-inv-item-row.ebi-inv-novat-columns {
  grid-template-columns: 1fr 70px 100px 90px 32px;
}

.ebi-inv-item-total {
  padding: 10px 13px;
  font-weight: 600;
  font-size: 14px;
  color: var(--inv-text);
  background: #f8fafc;
  border-radius: var(--inv-radius-sm);
  display: flex;
  align-items: center;
}

.ebi-inv-item-delete {
  width: 32px;
  height: 38px;
  border: none;
  border-radius: var(--inv-radius-sm);
  background: transparent;
  color: var(--inv-text-light);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--inv-transition), color var(--inv-transition);
  margin-top: 1px;
}

.ebi-inv-item-delete:hover {
  background: #fee2e2;
  color: var(--inv-red);
}

.ebi-inv-add-item {
  margin-top: 12px;
  padding: 9px 16px;
  border-radius: var(--inv-radius-sm);
  border: 1.5px dashed var(--inv-border);
  background: transparent;
  color: var(--inv-green);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--inv-transition), background var(--inv-transition);
}

.ebi-inv-add-item:hover {
  border-color: var(--inv-green);
  background: var(--inv-green-light);
}

/* ── Totals ───────────────────────────────────────────────── */
.ebi-inv-totals {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.ebi-inv-totals-inner {
  min-width: 280px;
  background: #f8fafc;
  border: 1px solid var(--inv-border);
  border-radius: var(--inv-radius-sm);
  overflow: hidden;
}

.ebi-inv-totals-rows {
  padding: 4px 0;
}

.ebi-inv-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--inv-text-muted);
}

.ebi-inv-total-row--vat {
  font-size: 12px;
  color: var(--inv-text-light);
}

.ebi-inv-total-row--divider {
  border-top: 1px solid var(--inv-border);
  margin-top: 4px;
  padding-top: 12px;
}

.ebi-inv-total-row--grand {
  background: var(--inv-green);
  color: #fff;
  padding: 12px 16px;
  margin-top: 4px;
}

.ebi-inv-total-label { font-weight: 600; }
.ebi-inv-total-row--grand .ebi-inv-total-label,
.ebi-inv-total-row--grand .ebi-inv-total-value {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

/* ── Actions ──────────────────────────────────────────────── */
.ebi-inv-actions {
  text-align: center;
  padding: 8px 0 0;
}

.ebi-inv-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--inv-green) 0%, var(--inv-teal) 100%);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16,185,129,.35);
  transition: transform var(--inv-transition), box-shadow var(--inv-transition);
}

.ebi-inv-generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16,185,129,.45);
}

.ebi-inv-generate-btn:active {
  transform: translateY(0);
}

.ebi-inv-btn-icon {
  font-size: 18px;
}

.ebi-inv-privacy-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--inv-text-muted);
}

/* ── Footer ───────────────────────────────────────────────── */
.ebi-inv-footer {
  text-align: center;
  font-size: 12px;
  color: var(--inv-text-light);
  padding: 24px 20px 0;
  line-height: 1.6;
}

.ebi-inv-footer a {
  color: var(--inv-green);
  text-decoration: none;
}

.ebi-inv-footer a:hover {
  text-decoration: underline;
}

/* ── Input error state ────────────────────────────────────── */
.ebi-inv-input--error {
  border-color: var(--inv-red) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.12) !important;
}

/* ── Shake animation (validation) ─────────────────────────── */
@keyframes ebi-inv-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

.ebi-inv-shake {
  animation: ebi-inv-shake .4s ease-out;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .ebi-inv-mode-tabs {
    flex-direction: column;
    align-items: stretch;
    padding: 0 16px 20px;
  }

  .ebi-inv-tab {
    justify-content: center;
  }

  .ebi-inv-body {
    padding: 0 12px;
  }

  .ebi-inv-section {
    padding: 18px 14px;
  }

  .ebi-inv-grid--2,
  .ebi-inv-grid--3 {
    grid-template-columns: 1fr;
  }

  .ebi-inv-items-head { display: none; }

  .ebi-inv-item-row.ebi-inv-vat-columns,
  .ebi-inv-item-row.ebi-inv-novat-columns {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }

  .ebi-inv-item-row > .ebi-inv-input:first-child {
    grid-column: 1 / -1;
  }

  .ebi-inv-item-delete {
    margin-top: 0;
  }

  .ebi-inv-generate-btn {
    width: 100%;
    justify-content: center;
    padding: 16px 24px;
  }

  .ebi-inv-totals-inner {
    min-width: unset;
    width: 100%;
  }

  .ebi-inv-totals {
    justify-content: stretch;
  }
}
