/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #ffffff;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(219, 0, 205, 0.2);
}

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

#root {
  width: 100%;
  min-height: 100vh;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: #ffffff;
  color: #333;
  padding: 20px;
  border-bottom: 1px solid #21252921;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  flex-direction: column;
}

.header-logo {
  width: 150px;
  height: auto;
  flex-shrink: 0;
  margin-bottom: 12px;
}

.header-content {
  position: relative;
  left: auto;
  transform: none;
  text-align: center;
  width: 100%;
}

.header-content h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: #333;
}

.header p {
  font-size: 0.85rem;
  color: #666;
  margin: 0;
}

/* Input Form */
.input-section {
  background: white;
  padding: 30px 20px;
  border-radius: 12px;
  border: 1px solid #21252921;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
  margin: 30px auto;
  max-width: 600px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.input-field {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e6ed;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  font-family: 'Poppins', sans-serif;
}

.input-field:focus {
  outline: none;
  border-color: #DB00CD;
  box-shadow: 0 0 0 3px rgba(219, 0, 205, 0.1);
}

.button {
  padding: 14px 32px;
  background: linear-gradient(117deg, #DB00CD 0%, #72086B 100%);
  color: white;
  border: 2px solid #DB00CD;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Poppins', sans-serif;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.button:hover {
  box-shadow: 0 8px 20px rgba(219, 0, 205, 0.3);
}

.button:active {
  transform: scale(0.98);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Error and Message Styles */
.error-message {
  color: #dc3545;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 15px;
}

.success-message {
  color: #155724;
  background: #d4edda;
  border: 1px solid #c3e6cb;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 15px;
}

/* Loading */
.loading-container {
  text-align: center;
  padding: 60px 20px;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #DB00CD;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.loading-text {
  color: #DB00CD;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Report Styles */
.report {
  background: white;
  border-radius: 12px;
  border: 1px solid #21252921;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
  margin: 40px auto;
  padding: 40px;
  max-width: 1000px;
  transition: filter 0.3s ease;
}

.report.blurred {
  filter: blur(8px);
  pointer-events: none;
  opacity: 0.8;
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e6ed;
}

.report-title {
  font-size: 1.8rem;
  color: #333;
}

.action-buttons {
  display: flex;
  gap: 10px;
}

.button-secondary {
  padding: 10px 20px;
  background: #f0f3f7;
  color: #DB00CD;
  border: 2px solid #DB00CD;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  font-family: 'Poppins', sans-serif;
}

.button-secondary:hover {
  background: linear-gradient(117deg, #DB00CD 0%, #72086B 100%);
  color: white;
}

/* Summary Section */
.summary-section {
  background: linear-gradient(117deg, #DB00CD 0%, #72086B 100%);
  color: white;
  padding: 30px;
  border-radius: 12px;
  margin-bottom: 30px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.summary-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.summary-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.summary-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Health Score */
.health-score {
  text-align: center;
  margin-bottom: 20px;
}

.health-score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: white;
  color: #DB00CD;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 auto 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.health-label {
  font-size: 1rem;
  opacity: 0.9;
}

/* Issues Section */
.issues-section {
  margin-bottom: 40px;
}

.section-title {
  font-size: 1.5rem;
  color: #333;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 3px solid #DB00CD;
  font-weight: 700;
}

.issues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.issue-category {
  background: #f8f9fa;
  border-left: 4px solid #dc3545;
  padding: 20px;
  border-radius: 8px;
}

.issue-category.warning {
  border-left-color: #ffc107;
}

.issue-category.info {
  border-left-color: #17a2b8;
}

.issue-category-title {
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
}

.issue-item {
  background: white;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #555;
  border: 1px solid #e0e6ed;
}

.issue-url {
  color: #667eea;
  word-break: break-all;
  font-size: 0.85rem;
  margin-top: 5px;
  font-family: 'Courier New', monospace;
}

/* Badge Styles */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 5px;
  margin-bottom: 5px;
}

.badge-error {
  background: #f8d7da;
  color: #721c24;
}

.badge-warning {
  background: #fff3cd;
  color: #856404;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-info {
  background: #d1ecf1;
  color: #0c5460;
}

/* Pages Table */
.pages-section {
  margin-top: 40px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pages-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 0.9rem;
  min-width: 600px;
}

.pages-table thead {
  background: #f8f9fa;
  border-bottom: 2px solid #e0e6ed;
}

.pages-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #333;
}

.pages-table td {
  padding: 12px;
  border-bottom: 1px solid #e0e6ed;
  color: #555;
}

.pages-table tbody tr:hover {
  background: #f8f9fa;
}

.url-cell {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: #DB00CD;
  word-break: break-all;
  max-width: 300px;
}

.status-cell {
  font-weight: 600;
}

.status-cell.success {
  color: #28a745;
}

.status-cell.error {
  color: #dc3545;
}

.status-cell.warning {
  color: #ffc107;
}

.issues-cell {
  max-width: 250px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 30px 20px;
  color: #666;
  font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header {
    padding: 15px;
  }

  .header-content h1 {
    font-size: 1.2rem;
  }

  .header p {
    font-size: 0.75rem;
  }

  .header-logo {
    width: 120px;
  }

  .input-section {
    padding: 20px;
    margin: 20px auto;
  }

  .form-group {
    flex-direction: column;
  }

  .input-field {
    font-size: 16px;
  }

  .button {
    width: 100%;
    padding: 12px 16px;
  }

  .report {
    padding: 15px;
    margin: 20px auto;
  }

  .report-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .report-title {
    font-size: 1.5rem;
  }

  .action-buttons {
    flex-direction: column;
    width: 100%;
    margin-top: 15px;
  }

  .button-secondary {
    width: 100%;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .summary-value {
    font-size: 2rem;
  }

  .summary-label {
    font-size: 0.8rem;
  }

  .issues-grid {
    grid-template-columns: 1fr;
  }

  .section-title {
    font-size: 1.3rem;
  }

  .pages-table {
    font-size: 0.75rem;
    min-width: 500px;
  }

  .pages-table th,
  .pages-table td {
    padding: 6px 4px;
  }

  .url-cell {
    max-width: 150px;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 12px;
  }

  .header-logo {
    width: 100px;
    margin-bottom: 8px;
  }

  .header-content h1 {
    font-size: 1rem;
  }

  .header p {
    font-size: 0.7rem;
  }

  .input-section {
    padding: 15px;
    margin: 15px auto;
    border-radius: 8px;
  }

  .input-field {
    font-size: 16px;
    padding: 10px 12px;
  }

  .button {
    padding: 12px;
    font-size: 0.95rem;
  }

  .report {
    padding: 12px;
    margin: 15px auto;
  }

  .report-title {
    font-size: 1.3rem;
  }

  .summary-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .summary-item {
    padding: 15px;
  }

  .summary-value {
    font-size: 1.8rem;
  }

  .summary-label {
    font-size: 0.75rem;
  }

  .section-title {
    font-size: 1.1rem;
    margin-bottom: 15px;
  }

  .issue-category {
    padding: 15px;
  }

  .issue-item {
    font-size: 0.85rem;
  }

  .pages-table {
    font-size: 0.65rem;
    min-width: 450px;
  }

  .pages-table th,
  .pages-table td {
    padding: 4px 3px;
  }

  .url-cell {
    max-width: 100px;
    font-size: 0.65rem;
  }

  .badge {
    font-size: 0.65rem;
    padding: 2px 8px;
  }

  .health-score-circle {
    width: 100px;
    height: 100px;
    font-size: 2rem;
  }

  .gauge-container canvas {
    max-width: 150px !important;
    max-height: 150px !important;
  }

  .gauge-label {
    font-size: 1.3rem;
  }

  .chart-title {
    font-size: 0.9rem;
  }

  .chart-container {
    padding: 15px;
  }
}

/* Top Issues Highlight */
.top-issues-highlight {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.top-issues-title {
  font-weight: 600;
  color: #856404;
  margin-bottom: 10px;
}

.top-issue-item {
  background: white;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 4px;
  border-left: 3px solid #ffc107;
  font-size: 0.9rem;
}

.top-issue-item.critical {
  border-left-color: #dc3545;
  background: #fff5f5;
}

/* Charts Section */
.charts-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
  margin-top: 30px;
}

.chart-container {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chart-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
  width: 100%;
  text-align: center;
}

.gauge-container {
  position: relative;
  justify-content: center;
}

.gauge-container canvas {
  max-width: 220px;
  max-height: 220px;
}

.gauge-label {
  position: absolute;
  font-size: 1.8rem;
  font-weight: 700;
  color: #DB00CD;
  text-align: center;
  width: 100%;
  top: 50%;
  transform: translateY(-50%);
}

.bar-container {
  align-items: stretch;
  position: relative;
}

.bar-container canvas {
  width: 100% !important;
  height: auto !important;
}

/* Responsive design for charts */
@media (max-width: 1024px) {
  .charts-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .charts-section {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
  }

  .chart-container {
    padding: 20px;
  }

  .chart-title {
    font-size: 1rem;
    margin-bottom: 15px;
  }

  .gauge-container canvas {
    max-width: 180px;
    max-height: 180px;
  }

  .gauge-label {
    font-size: 1.5rem;
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: 12px;
  padding: 40px;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
  z-index: 1001;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  margin-bottom: 25px;
  text-align: center;
}

.modal-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 8px;
}

.modal-header p {
  font-size: 0.95rem;
  color: #666;
  margin: 0;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
}

.form-field label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.form-field input {
  padding: 12px 16px;
  border: 2px solid #e0e6ed;
  border-radius: 8px;
  font-size: 1rem;
  font-family: 'Poppins', sans-serif;
  transition: border-color 0.2s;
}

.form-field input:focus {
  outline: none;
  border-color: #DB00CD;
  box-shadow: 0 0 0 3px rgba(219, 0, 205, 0.1);
}

.form-field input::placeholder {
  color: #999;
}

.modal-footer {
  margin-top: 25px;
  display: flex;
  gap: 10px;
}

.modal-footer button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-footer .btn-submit {
  background: linear-gradient(117deg, #DB00CD 0%, #72086B 100%);
  color: white;
  border: 2px solid #DB00CD;
}

.modal-footer .btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(219, 0, 205, 0.3);
}

.modal-footer .btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.form-error {
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 4px;
  display: none;
}

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

@media (max-width: 600px) {
  .modal-overlay {
    align-items: flex-end;
  }

  .modal {
    padding: 20px;
    max-width: 100%;
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    overflow-y: auto;
  }

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

  .modal-header h2 {
    font-size: 1.4rem;
  }

  .modal-header p {
    font-size: 0.9rem;
  }

  .modal-footer {
    flex-direction: column;
    gap: 10px;
  }

  .modal-footer button {
    width: 100%;
  }

  .form-field input {
    font-size: 16px;
    padding: 12px;
  }
}

/* Hidden buttons until form submission */
.action-buttons .button-secondary.hidden {
  display: none;
}
