/* Lighthouse Widget CSS - Vanilla JavaScript Version */

.lighthouse-widget {
  padding: 40px;
  border-radius: 16px;
  background-color: #ffffff;
  border: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  margin: 32px auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  max-width: 600px;
}

.lighthouse-widget__title {
  color: #1a1a1a;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 32px 0;
  line-height: 1.2;
  text-align: center;
  letter-spacing: -0.02em;
}

.lighthouse-widget__form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lighthouse-widget__input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lighthouse-widget__label {
  color: #374151;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.lighthouse-widget__input {
  padding: 16px 20px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 1.1rem;
  font-family: inherit;
  background-color: #f9fafb;
  transition: all 0.3s ease;
  font-weight: 500;
}

.lighthouse-widget__input:focus {
  outline: none;
  border-color: #000000;
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.lighthouse-widget__input:disabled {
  background-color: #f3f4f6;
  cursor: not-allowed;
  opacity: 0.6;
  border-color: #d1d5db;
}

.lighthouse-widget__submit-btn {
  padding: 16px 32px;
  background: #000000;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  align-self: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  letter-spacing: -0.01em;
}

.lighthouse-widget__submit-btn:hover:not(:disabled) {
  background: #1a1a1a;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.lighthouse-widget__submit-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.lighthouse-widget__loading {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #f1f3f4 100%);
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  margin-top: 16px;
}

.lighthouse-widget__loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e5e7eb;
  border-top: 3px solid #000000;
  border-radius: 50%;
  animation: lighthouse-spin 1s linear infinite;
}

.lighthouse-widget__loading-text {
  color: #374151;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

@keyframes lighthouse-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.lighthouse-widget__results {
  margin-top: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.lighthouse-widget__results-title {
  color: #1a1a1a;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 24px 0;
  border-bottom: 3px solid #e5e7eb;
  padding-bottom: 12px;
  letter-spacing: -0.02em;
  text-align: center;
}

.lighthouse-widget__results-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lighthouse-widget__result-container {
  border-radius: 16px;
  border: 2px solid #f3f4f6;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}

.lighthouse-widget__result-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  cursor: pointer;
  transition: all 0.3s ease;
}

.lighthouse-widget__result-row:hover {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  transform: translateY(-1px);
}

.lighthouse-widget__result-row--expanded {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-bottom: 2px solid #d1d5db;
}

.lighthouse-widget__score {
  min-width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.4rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.lighthouse-widget__score--good {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.lighthouse-widget__score--needs-improvement {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
}

.lighthouse-widget__score--poor {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.lighthouse-widget__result-info {
  flex: 1;
}

.lighthouse-widget__result-title {
  color: #1a1a1a;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: -0.01em;
}

.lighthouse-widget__expand-icon {
  font-size: 1.4rem;
  font-weight: bold;
  color: #000000;
  margin-left: 12px;
  transition: transform 0.2s ease;
}

.lighthouse-widget__result-description {
  color: #6b7280;
  font-size: 1rem;
  margin: 0;
  line-height: 1.5;
  font-weight: 500;
}

.lighthouse-widget__suggestions {
  background-color: #ffffff;
  padding: 20px;
  border-top: 1px solid #d1d5db;
}

.lighthouse-widget__suggestions-title {
  color: #1a1a1a;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 16px 0;
}

.lighthouse-widget__suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lighthouse-widget__suggestion {
  padding: 12px;
  background-color: #f8f9fa;
  border-radius: 4px;
  border-left: 3px solid #000000;
}

.lighthouse-widget__suggestion-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 12px;
}

.lighthouse-widget__suggestion-title {
  color: #1a1a1a;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.lighthouse-widget__impact {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.lighthouse-widget__impact--high {
  background-color: #dc3545;
  color: white;
}

.lighthouse-widget__impact--medium {
  background-color: #ffc107;
  color: #212529;
}

.lighthouse-widget__impact--low {
  background-color: #28a745;
  color: white;
}

.lighthouse-widget__suggestion-description {
  color: #6c757d;
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.4;
}

.lighthouse-widget__results-meta {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.lighthouse-widget__analyzed-url,
.lighthouse-widget__analysis-time {
  color: #6c757d;
  font-size: 0.85rem;
  margin: 4px 0;
}

.lighthouse-widget__analyzed-url strong,
.lighthouse-widget__analysis-time strong {
  color: #495057;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .lighthouse-widget {
    padding: 24px;
    margin: 20px 16px;
    max-width: 100%;
    border-radius: 20px;
  }
  
  .lighthouse-widget__title {
    font-size: 1.75rem;
    margin-bottom: 24px;
  }

  .lighthouse-widget__input {
    padding: 14px 18px;
    font-size: 1rem;
  }

  .lighthouse-widget__submit-btn {
    padding: 14px 28px;
    align-self: stretch;
    font-size: 1rem;
  }

  .lighthouse-widget__results {
    margin-top: 24px;
    padding: 24px;
    border-radius: 16px;
  }

  .lighthouse-widget__result-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
  }

  .lighthouse-widget__score {
    align-self: center;
    min-width: 60px;
    height: 60px;
    font-size: 1.2rem;
  }

  .lighthouse-widget__result-info {
    text-align: center;
    width: 100%;
  }

  .lighthouse-widget__results-title {
    font-size: 1.3rem;
  }

  .lighthouse-widget__suggestions {
    padding: 20px;
  }

  .lighthouse-widget__suggestion-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .lighthouse-widget__expand-icon {
    font-size: 1.2rem;
  }

  .lighthouse-widget__loading {
    padding: 16px;
    border-radius: 12px;
  }
}

/* API Recommendations Styles */
.lighthouse-widget__api-recommendations {
  margin-top: 16px;
}

.lighthouse-widget__recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lighthouse-widget__recommendation {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.lighthouse-widget__recommendation:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: #0ea5e9;
}

.lighthouse-widget__recommendation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 16px;
  flex-wrap: wrap;
}

.lighthouse-widget__recommendation-title {
  color: #1e293b;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
  flex: 1;
  min-width: 200px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.lighthouse-widget__recommendation-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.lighthouse-widget__audit-score {
  background: #f1f5f9;
  color: #475569;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
}

.lighthouse-widget__recommendation-description {
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.lighthouse-widget__recommendation-value {
  color: #0ea5e9;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 12px 0 0 0;
  padding: 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.lighthouse-widget__learn-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 12px;
  padding: 8px 16px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.lighthouse-widget__learn-more:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #4b5563;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.lighthouse-widget__learn-more:after {
  content: '→';
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.lighthouse-widget__learn-more:hover:after {
  transform: translateX(2px);
}

/* Success Message Styles */
.lighthouse-widget__no-recommendations {
  margin-top: 16px;
}

.lighthouse-widget__success-message {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 2px solid #22c55e;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  position: relative;
}

.lighthouse-widget__success-message::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: 12px;
  z-index: -1;
  opacity: 0.1;
}

.lighthouse-widget__success-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.lighthouse-widget__success-title {
  color: #166534;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 8px 0;
}

.lighthouse-widget__success-description {
  color: #15803d;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

/* Mobile responsiveness for API recommendations */
@media (max-width: 640px) {
  .lighthouse-widget__recommendation-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .lighthouse-widget__recommendation-meta {
    align-items: flex-start;
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
  }
  
  .lighthouse-widget__recommendation {
    padding: 16px;
  }
  
  .lighthouse-widget__success-message {
    padding: 20px;
  }
  
  .lighthouse-widget__success-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
}