/* ==========================================================
   LESCO Online Bill Checker styles
   Matches bill.pitc.com.pk / LESCO official portal UI
   ========================================================== */

:root {
  --lpv-primary: #003366;
  --lpv-primary-hover: #002244;
  --lpv-primary-focus: rgba(0, 51, 102, 0.16);
  --lpv-text-main: #1f2937;
  --lpv-text-muted: #64748b;
  --lpv-border-color: #cbd5e1;
  --lpv-bg-white: #ffffff;
  --lpv-error: #c0392b;

  /* Spacing Scale */
  --lpv-space-xs: 8px;
  --lpv-space-sm: 12px;
  --lpv-space-md: 16px;
  --lpv-space-lg: 24px;
  --lpv-space-xl: 32px;
  --lpv-space-xxl: 48px;
}

/* Google Fonts loaded via wp_enqueue_style for non-render-blocking delivery */

/* Base layout */
.lpv-wrap,
.lpv-wrap * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Page Wrapper ────────────────────────────────────────────────────────── */
.lpv-wrap {
  font-family: 'Inter', Arial, sans-serif;
  width: 100%;
  max-width: 760px;
  margin: var(--lpv-space-lg) auto;
  padding: 0 var(--lpv-space-md);
  color: var(--lpv-text-main);
  line-height: 1.5;
  overflow-x: hidden;
  overflow-x: clip;
  isolation: isolate;
}

/* ── Section Card ────────────────────────────────────────────────────────── */
.lpv-section {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin-bottom: var(--lpv-space-xxl);
  overflow: visible;
  box-shadow: none;
}

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

/* ── Section Heading ─────────────────────────────────────────────────────── */
.lpv-section-title {
  background: transparent;
  border-bottom: 0;
  padding: 0;
  text-align: center;
}

.lpv-section-title h2,
.lpv-section-title h3 {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--lpv-primary) !important;
  letter-spacing: 0;
  text-transform: none;
  text-wrap: balance;
}

/* ── Section Body ────────────────────────────────────────────────────────── */
.lpv-section-body {
  padding: var(--lpv-space-md) 0 0;
}

/* ── Reference Number Row ────────────────────────────────────────────────── */
.lpv-ref-row {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: var(--lpv-space-xs);
  width: 100%;
  max-width: 440px;
  margin: 0 auto var(--lpv-space-sm);
}

/* Always hidden — no dashes between inputs */
.lpv-ref-sep {
  display: none !important;
}

/* Segmented ref inputs */
.lpv-ref-part {
  height: 44px;
  flex: 1 1 0 !important;
  width: auto !important;
  min-width: 0 !important;
  background: var(--lpv-bg-white) !important;
  border: 1px solid var(--lpv-border-color) !important;
  border-radius: 7px;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a !important;
  text-align: center;
  padding: 0 6px !important;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: 'Courier New', monospace;
}

.lpv-ref-part[data-seg="0"] {
  flex: 2 1 0 !important;
}

.lpv-ref-part[data-seg="1"] {
  flex: 5 1 0 !important;
}

.lpv-ref-part[data-seg="2"] {
  flex: 7 1 0 !important;
}

.lpv-ref-part:focus {
  border-color: var(--lpv-primary) !important;
  box-shadow: 0 0 0 3px var(--lpv-primary-focus);
  background: var(--lpv-bg-white) !important;
}

.lpv-ref-part.is-valid { border-color: var(--lpv-primary) !important; }
.lpv-ref-part.is-error { border-color: var(--lpv-error) !important; }

/* Suffix dropdown (U/R) */
.lpv-ref-suffix {
  flex: 0 0 58px !important;
  width: 58px !important;
  height: 44px;
  background-color: var(--lpv-bg-white) !important;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333333' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 10px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid var(--lpv-border-color) !important;
  border-radius: 7px;
  font-size: 18px;
  font-weight: 800;
  color: #0f172a !important;
  padding: 0 20px 0 var(--lpv-space-xs);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.lpv-ref-suffix:focus {
  border-color: var(--lpv-primary) !important;
  box-shadow: 0 0 0 3px var(--lpv-primary-focus);
  background-color: var(--lpv-bg-white) !important;
}

/* ── Hidden master input (used by JS submit logic) ───────────────────────── */
#lescoebill-ref-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

/* ── Error message ───────────────────────────────────────────────────────── */
.lescoebill-error {
  display: none;
  text-align: center;
  font-size: 13px;
  color: var(--lpv-error);
  font-weight: 500;
  margin-top: 4px;
  margin-bottom: var(--lpv-space-sm);
}

.lescoebill-error.show {
  display: block;
}

/* ── Customer ID Input ───────────────────────────────────────────────────── */
.lpv-cid-row {
  display: flex;
  justify-content: center;
  margin-bottom: var(--lpv-space-sm);
}

.lpv-cid-input {
  width: 100%;
  max-width: 340px;
  height: 44px;
  background: var(--lpv-bg-white) !important;
  border: 1px solid var(--lpv-border-color) !important;
  border-radius: 7px;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a !important;
  padding: 0 var(--lpv-space-md);
  outline: none;
  letter-spacing: 1px;
  font-family: 'Courier New', monospace;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 0;
}

.lpv-cid-input:focus {
  border-color: var(--lpv-primary) !important;
  box-shadow: 0 0 0 3px var(--lpv-primary-focus);
  background: var(--lpv-bg-white) !important;
}

.lpv-cid-input.is-valid { border-color: var(--lpv-primary) !important; }
.lpv-cid-input.is-error { border-color: var(--lpv-error) !important; }

/* ── Action Buttons Row ──────────────────────────────────────────────────── */
.lpv-actions {
  display: flex;
  justify-content: center;
  gap: var(--lpv-space-sm);
  flex-wrap: wrap;
}

/* Base button */
.lpv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--lpv-space-xs);
  height: 44px;
  min-height: 44px;
  min-width: 80px;
  padding: 0 var(--lpv-space-lg);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  font-family: inherit;
  touch-action: manipulation;
  white-space: nowrap;
  background-image: none !important;
  letter-spacing: 0;
}

/* Primary — navy blue matching Kadence btn or palette1 */
.lpv-btn-primary {
  background: var(--lpv-primary) !important;
  color: #ffffff !important;
  min-width: 130px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.lpv-btn-primary:hover {
  background: var(--lpv-primary-hover) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
}

/* Secondary action */
.lpv-btn-secondary {
  background: #eef2f7 !important;
  color: #344054 !important;
  border: 1px solid var(--lpv-border-color) !important;
  box-shadow: none;
}

.lpv-btn-secondary:hover {
  background: #dbe3ec !important;
  color: #ffffff !important;
  border-color: #b7c3d3 !important;
  transform: translateY(-1px);
}

/* Disabled state */
.lpv-btn[aria-disabled="true"],
.lpv-btn:disabled {
  background: #94a3b8 !important;
  color: #f8fafc !important;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Loading state */
.lpv-btn.is-loading {
  cursor: wait;
  pointer-events: none;
  background: var(--lpv-primary) !important;
  color: #fff !important;
}

/* ── Spinner animation ───────────────────────────────────────────────────── */
@keyframes lpv-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.lpv-spinner {
  animation: lpv-spin 0.75s linear infinite;
  flex-shrink: 0;
}

/* ── Divider between sections ────────────────────────────────────────────── */
.lpv-divider {
  text-align: center;
  font-size: 13px;
  color: var(--lpv-text-muted);
  margin: var(--lpv-space-xs) 0 var(--lpv-space-lg);
  position: relative;
}

.lpv-divider::before,
.lpv-divider::after {
  content: '';
  display: inline-block;
  width: 80px;
  height: 1px;
  background: #d8e1ea;
  vertical-align: middle;
  margin: 0 10px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .lpv-wrap {
    max-width: 100%;
    margin: var(--lpv-space-md) auto;
    padding: 0 var(--lpv-space-md);
  }

  .lpv-section {
    margin-bottom: var(--lpv-space-xxl);
  }

  .lpv-section-body {
    padding: var(--lpv-space-xs) 0 0;
  }

  .lpv-section-title {
    padding: 0;
  }

  .lpv-section-title h2,
  .lpv-section-title h3 {
    font-size: 19px;
    font-weight: 700;
  }

  /* Flex already handles all screen sizes — just reduce the gap */
  .lpv-ref-row {
    gap: 6px;
    margin-bottom: var(--lpv-space-xs);
  }

  .lpv-ref-part {
    height: 42px;
    width: auto !important;
    font-size: 18px;
    letter-spacing: 0;
    padding: 0 6px !important;
  }

  .lpv-ref-suffix {
    width: 100%;
    min-width: 0;
    height: 42px;
    min-height: 0;
    font-size: 16px;
    padding: 0 20px 0 6px;
    background-position: right 6px center;
    background-size: 9px;
  }

  .lpv-btn {
    height: 42px;
    min-height: 42px;
    padding: 0 var(--lpv-space-md);
    font-size: 14px;
  }

  .lpv-cid-row {
    margin-bottom: var(--lpv-space-xs);
  }

  .lpv-cid-input {
    height: 42px;
    font-size: 18px;
    padding: 0 var(--lpv-space-sm);
  }

  .lpv-divider {
    margin: 4px 0 var(--lpv-space-md);
  }
}

@media (max-width: 460px) {
  .lpv-wrap {
    padding: 0 var(--lpv-space-sm);
  }

  .lpv-section {
    margin-bottom: var(--lpv-space-xl);
  }

  .lpv-ref-row {
    gap: 4px;
    margin-bottom: var(--lpv-space-xs);
  }

  .lpv-cid-row {
    margin-bottom: var(--lpv-space-xs);
  }

  .lpv-actions {
    display: flex;
    width: min(100%, 340px);
    margin-right: auto;
    margin-left: auto;
    gap: var(--lpv-space-sm);
  }

  .lpv-btn-primary {
    flex: 1;
    min-width: 0;
  }

  .lpv-btn-secondary {
    min-width: 80px;
  }
}

@media (max-width: 340px) {
  .lpv-section-title h2,
  .lpv-section-title h3 {
    font-size: 16px;
  }

  .lpv-ref-row {
    gap: 4px;
  }

  .lpv-ref-part,
  .lpv-ref-suffix,
  .lpv-cid-input {
    font-size: 15px;
  }

  .lpv-btn {
    padding: 0 10px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lpv-wrap *,
  .lpv-wrap *::before,
  .lpv-wrap *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
