/**
 * AVL Equipment Selector Styles v1.0
 * Participate Energy — Onboard Project Portal
 * Matches existing portal theme (dark navy/teal palette)
 */

/* ── Container ─────────────────────────────────────────────────────────── */
.avl-selector {
  margin: 24px 0;
  font-family: inherit;
}

.avl-header {
  margin-bottom: 20px;
}

.avl-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a2b3c;
  margin: 0 0 6px 0;
}

.avl-subtitle {
  font-size: 13px;
  color: #5a6a7a;
  margin: 0 0 12px 0;
  line-height: 1.5;
}

/* ── Inverter Status Badge ─────────────────────────────────────────────── */
.avl-inverter-status {
  padding: 8px 12px;
  background: #f0f5fa;
  border-left: 3px solid #3b82f6;
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  margin-bottom: 16px;
}

.avl-inv-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 12px;
  margin-right: 8px;
}

.avl-inv-mlpe {
  background: #dbeafe;
  color: #1d4ed8;
}

.avl-inv-string {
  background: #fef3c7;
  color: #92400e;
}

.avl-inv-note {
  color: #64748b;
  font-size: 12px;
}

/* ── Category Section ──────────────────────────────────────────────────── */
.avl-category {
  margin-bottom: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  transition: opacity 0.2s;
}

.avl-category-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #e2e8f0;
}

.avl-category-header:hover {
  background: #f1f5f9;
}

.avl-category-icon {
  font-size: 16px;
  margin-right: 8px;
  flex-shrink: 0;
}

.avl-category-label {
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
  flex-grow: 1;
}

.avl-category-count {
  font-size: 12px;
  color: #94a3b8;
  margin-right: 10px;
  transition: color 0.2s;
}

.avl-category-count.avl-has-selections {
  color: #059669;
  font-weight: 600;
}

.avl-category-toggle {
  font-size: 11px;
  color: #94a3b8;
  flex-shrink: 0;
}

/* Collapsed state */
.avl-category.avl-collapsed .avl-search-wrap,
.avl-category.avl-collapsed .avl-table {
  display: none;
}

/* Locked state (combo exclusion) */
.avl-category.avl-locked {
  opacity: 0.5;
  pointer-events: none;
}

.avl-category.avl-locked .avl-category-header {
  pointer-events: auto;
  opacity: 1;
}

.avl-exclusion-banner {
  padding: 8px 14px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid #fecaca;
}

/* ── Search ────────────────────────────────────────────────────────────── */
.avl-search-wrap {
  padding: 8px 14px;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
}

.avl-search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.avl-search:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.avl-search::placeholder {
  color: #9ca3af;
}

/* ── Table ─────────────────────────────────────────────────────────────── */
.avl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.avl-table thead th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.avl-table thead th.avl-qty-col,
.avl-table thead th.avl-pct-col {
  text-align: center;
}

.avl-table thead th.avl-serial-col {
  text-align: left;
}

.avl-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: top;
}

.avl-table tbody tr:hover {
  background: #f8fafc;
}

.avl-table tbody tr.avl-row-selected {
  background: #ecfdf5;
}

.avl-table tbody tr.avl-row-selected td {
  border-bottom-color: #d1fae5;
}

/* Percentage columns */
.avl-pct-col {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Quantity columns */
.avl-qty-col {
  text-align: center;
}

.avl-qty-input {
  width: 64px;
  padding: 4px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  outline: none;
  box-sizing: border-box;
}

.avl-qty-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.avl-qty-input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

/* Remove number input spinners */
.avl-qty-input::-webkit-outer-spin-button,
.avl-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.avl-qty-input[type=number] {
  -moz-appearance: textfield;
}

/* ── Serial Numbers ────────────────────────────────────────────────────── */
.avl-serial-col {
  min-width: 160px;
}

.avl-serial-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.avl-serial-placeholder {
  color: #94a3b8;
  font-size: 11px;
  font-style: italic;
}

.avl-serial-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.avl-serial-label {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  min-width: 42px;
  flex-shrink: 0;
}

.avl-serial-input {
  flex: 1;
  padding: 3px 6px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  outline: none;
  min-width: 0;
}

.avl-serial-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.avl-serial-input::placeholder {
  color: #cbd5e1;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .avl-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .avl-table thead th,
  .avl-table tbody td {
    padding: 6px 8px;
    font-size: 12px;
  }

  .avl-qty-input {
    width: 52px;
  }

  .avl-category-header {
    padding: 8px 10px;
  }

  .avl-category-label {
    font-size: 13px;
  }
}

/* ── Print ─────────────────────────────────────────────────────────────── */
@media print {
  .avl-search-wrap {
    display: none;
  }

  .avl-category.avl-collapsed .avl-table {
    display: table;
  }

  .avl-qty-input {
    border: none;
    text-align: center;
  }
}

/* ── Scrollable table body ─────────────────────────────────────────────── */
.avl-table {
  display: block;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: auto;
}

.avl-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
}

.avl-table thead,
.avl-table tbody {
  display: table;
  width: 100%;
  table-layout: fixed;
}
.avl-bess-summary{display:flex;gap:24px;padding:12px 16px;margin:8px 0;background:linear-gradient(135deg,#1a365d,#2563eb);border-radius:8px;color:#fff;}
.avl-summary-item{display:flex;flex-direction:column;align-items:center;flex:1;}
.avl-summary-label{font-size:11px;opacity:0.8;text-transform:uppercase;letter-spacing:0.5px;}
.avl-summary-value{font-size:20px;font-weight:700;margin-top:2px;}
.avl-qty-warn{color:#e74c3c;font-size:10px;display:block;margin-top:2px;}
