/* ========================================
   SERIAL LOOKUP WIDGET
   ======================================== */

.ef-serial-lookup {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 32px;
  margin-bottom: 32px;
}

/* ── Search Input Section ── */
.ef-serial-search {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.ef-serial-search label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 250px;
}

.ef-serial-search label strong {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f1e5a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ef-serial-input {
  padding: 12px 16px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ef-serial-input:focus {
  outline: none;
  border-color: #00AECC;
  box-shadow: 0 0 0 3px rgba(0, 174, 204, 0.1);
}

.ef-serial-search-btn {
  background: #1B2F8A;
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  align-self: flex-end;
  transition: background 0.2s, transform 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ef-serial-search-btn:hover {
  background: #00AECC;
}

.ef-serial-search-btn:active {
  transform: translateY(1px);
}

.ef-serial-search-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Loading State ── */
.ef-serial-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px 24px;
  text-align: center;
}

.ef-serial-loading.hidden {
  display: none;
}

.ef-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #f0f0f0;
  border-top-color: #00AECC;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.ef-serial-loading p {
  color: #666;
  font-size: 0.95rem;
  margin: 0;
}

/* ── Error State ── */
.ef-serial-error {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFEBEE;
  border: 1px solid #FFCDD2;
  border-left: 4px solid #F44336;
  color: #C62828;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.ef-serial-error.hidden {
  display: none;
}

.ef-serial-error::before {
  content: '⚠';
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* ── Results Section ── */
.ef-serial-results {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.ef-serial-results.hidden {
  display: none;
}

/* Result Card */
.ef-serial-result-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  background: #fafbfc;
}

.ef-serial-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
}

.ef-serial-info h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f1e5a;
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.ef-serial-info p {
  font-size: 0.9rem;
  color: #666;
  margin: 4px 0 0;
}

.ef-warranty-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.ef-warranty-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.ef-warranty-badge.ef-warranty-success {
  background: #E8F5E9;
  color: #2E7D32;
}

.ef-warranty-badge.ef-warranty-danger {
  background: #FFEBEE;
  color: #C62828;
}

.ef-warranty-date {
  font-size: 0.8rem;
  color: #666;
  margin: 0;
  white-space: nowrap;
}

/* Serial Details */
.ef-serial-details {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.ef-detail-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ef-detail-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ef-detail-value {
  font-size: 0.95rem;
  color: #333;
  font-weight: 600;
}

/* ── BOM Section ── */
.ef-no-bom {
  padding: 32px;
  text-align: center;
  background: #f9f9f9;
  border: 1px dashed #ddd;
  border-radius: 6px;
  color: #999;
}

.ef-bom-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ef-bom-container h4 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f1e5a;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.ef-bom-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.ef-bom-item {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

.ef-bom-item:hover {
  border-color: #00AECC;
  box-shadow: 0 4px 12px rgba(0, 174, 204, 0.15);
  transform: translateY(-2px);
}

.ef-bom-image {
  width: 100%;
  height: 180px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid #e0e0e0;
}

.ef-bom-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ef-bom-placeholder {
  font-size: 3rem;
  color: #ddd;
}

.ef-bom-info {
  padding: 12px;
  flex: 1;
}

.ef-bom-description {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f1e5a;
  margin: 0 0 6px;
  line-height: 1.3;
}

.ef-bom-sku {
  font-size: 0.8rem;
  font-family: 'IBM Plex Mono', monospace;
  color: #999;
  margin: 4px 0;
}

.ef-bom-supplier {
  font-size: 0.8rem;
  color: #666;
  margin: 4px 0 0;
}

.ef-bom-price {
  padding: 12px;
  background: #fafbfc;
  border-top: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ef-bom-price-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #1B2F8A;
}

.ef-bom-stock {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.ef-bom-stock.in-stock {
  background: #E8F5E9;
  color: #2E7D32;
}

.ef-bom-stock.out-stock {
  background: #FFEBEE;
  color: #C62828;
}

.ef-bom-action-btn {
  padding: 12px;
  background: #1B2F8A;
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ef-bom-action-btn:hover {
  background: #00AECC;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .ef-serial-lookup {
    padding: 20px;
  }

  .ef-serial-search {
    flex-direction: column;
  }

  .ef-serial-search label {
    min-width: 100%;
  }

  .ef-serial-search-btn {
    width: 100%;
    align-self: flex-start;
  }

  .ef-serial-header {
    flex-direction: column;
    gap: 16px;
  }

  .ef-warranty-info {
    align-items: flex-start;
  }

  .ef-bom-items {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .ef-serial-lookup {
    padding: 16px;
  }

  .ef-serial-input {
    font-size: 16px; /* Evita zoom em iOS */
  }

  .ef-serial-header {
    padding: 16px;
  }

  .ef-serial-info h3 {
    font-size: 1.25rem;
  }

  .ef-bom-item {
    border-radius: 4px;
  }
}
