/* Base variables */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #f97316;
  --text: #333;
  --text-light: #666;
  --background: #fff;
  --background-alt: #f9fafb;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --transition: all 0.2s ease;
}

/* Reset and base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body, html {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Header */
header {
  background: var(--background);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.tagline {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: -0.25rem;
}

/* URL Input */
.url-input-container {
  width: 100%;
  max-width: 800px;
}

.input-wrapper {
  display: flex;
  width: 100%;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
  overflow: hidden;
}

#urlInput {
  flex-grow: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 1rem;
}

#urlInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

#checkAccessibilityBtn {
  padding: 0.75rem 1.25rem;
  background: var(--primary);
  color: white;
  font-weight: 500;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  white-space: nowrap;
}

#checkAccessibilityBtn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Mobile message */
.mobile-only-message {
  display: none;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  color: #92400e;
  padding: 0.75rem;
  margin: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  text-align: center;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.mobile-text {
  display: none;
  text-align: center;
  padding: 0.5rem;
}

/* Feature tags */
.feature-tag {
  display: inline-block;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  margin: 0.25rem;
  border: 1px solid rgba(37, 99, 235, 0.1);
}

/* How it works */
.how-it-works {
    padding: 1rem;
    text-align: center;
    background: var(--background-alt);
    border-bottom: 1px solid var(--border);
  }
  
  .features {
    margin-bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .instructions {
    max-width: 100%;
    margin: 0 auto;
    background: var(--background);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
  }
  
  .instructions h2 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text);
    position: relative;
    display: inline-block;
    width: 100%;
  }
  
  .instructions h2::after {
    content: "";
    position: absolute;
    bottom: -0.25rem;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--primary);
    transform: none;
  }
  
  .instructions-content {
    flex: 1;
    min-width: 300px;
    text-align: left;
    padding-right: 1rem;
  }
  
  .instructions ol {
    text-align: left;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
  }
  
  .instructions ol li {
    margin-bottom: 0.4rem;
  }
  
  .instructions p {
    text-align: left;
  }
  
  .instructions code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.875em;
    color: var(--primary-dark);
  }
  
  .action-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0;
    min-width: 200px;
  }
  
  .github-link, .donate-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    text-decoration: none;
    justify-content: center;
  }

.github-link {
  background: #24292e;
  color: white;
}

.donate-link {
  background: var(--secondary);
  color: white;
}

.github-link:hover, .donate-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.github-link:hover { background: #1b1f23; }
.donate-link:hover { background: #ea580c; }

.learn-more {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 1rem;
  padding: 0.5rem;
  display: inline-block;
}

/* Loading states */
.time-estimate {
  text-align: center;
  padding: 0.75rem;
  font-size: 0.9rem;
  background: var(--background-alt);
  border-radius: var(--radius);
  margin: 1rem auto;
  max-width: 800px;
  display: none;
  border: 1px solid var(--border);
}

.time-estimate.active {
  display: block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.loading-container {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  min-height: 200px;
}

.loading-circle {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(37, 99, 235, 0.2);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
  margin-bottom: 1.5rem;
}

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

.accessibility-facts {
  font-size: 1.1rem;
  color: var(--primary);
  max-width: 700px;
  line-height: 1.6;
  background: rgba(37, 99, 235, 0.05);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(37, 99, 235, 0.1);
}

/* Main container */
.container {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: var(--background-alt);
  border-top: 1px solid var(--border);
  min-height: 500px;
}

/* Screenshot section */
.screenshot-section {
  position: relative;
  flex: 2;
  border-right: 1px solid var(--border);
  background: var(--background);
  overflow-y: auto;
  max-height: calc(100vh - 250px);
}

.screenshot-wrapper {
  width: 100%;
  height: auto;
  position: relative;
}

#screenshot {
  width: 100%;
  height: auto;
  display: block;
}

/* Overlays */
.overlay {
  position: absolute;
  z-index: 20;
  box-sizing: border-box;
  pointer-events: all;
  transition: all 0.2s ease;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.overlay.critical {
  border: 2px solid var(--error);
  background-color: rgba(239, 68, 68, 0.15);
}

.overlay.serious {
  border: 2px solid var(--warning);
  background-color: rgba(245, 158, 11, 0.15);
}

.overlay.moderate {
  border: 2px solid #eab308;
  background-color: rgba(234, 179, 8, 0.15);
}

.overlay.minor {
  border: 2px dashed var(--text-light);
  background-color: rgba(102, 102, 102, 0.1);
}

.overlay:hover {
  background-color: rgba(37, 99, 235, 0.25) !important;
  border-color: var(--primary) !important;
  z-index: 30 !important;
}

.overlay.hidden {
  display: none;
}

/* Tooltips */
.global-tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  max-width: 250px;
  z-index: 1000;
  visibility: hidden;
  font-size: 0.875rem;
  line-height: 1.5;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  border-left: 3px solid var(--primary);
}

/* Audit section */
.audit-section {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--background);
  max-height: calc(100vh - 250px);
  display: flex;
  flex-direction: column;
}

.audit-controls {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--background);
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-button {
  padding: 0.5rem 0.75rem;
  background: var(--background-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.control-button:hover {
  background: var(--border);
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-controls select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  font-size: 0.875rem;
  min-width: 130px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 12px) center;
  padding-right: 35px;
}

/* Audit details */
.audit-detail {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background-alt);
}

.audit-detail h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.audit-detail h3 .count {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.audit-detail p {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--text-light);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.description-toggle {
  font-size: 0.8rem;
  color: var(--primary);
  cursor: pointer;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.full-description {
  display: none;
}

.full-description.expanded {
  display: block;
}

/* Details listing */
.details-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.item-detail {
  padding: 0.75rem;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.item-detail:last-child {
  border-bottom: none;
}

.snippet-code {
  font-family: monospace;
  white-space: pre-wrap;
  background: #f8fafc;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
  margin: 0.5rem 0;
  max-height: 100px;
  overflow-y: auto;
}

.audit-detail button {
  width: 100%;
  padding: 0.5rem 0;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.5rem;
}

.audit-detail button:hover {
  background: var(--primary-dark);
}

/* Color indicators */
.color-box {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 0.25rem;
  border-radius: 2px;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.critical-indicator { background: var(--error); }
.serious-indicator { background: var(--warning); }
.moderate-indicator { background: #eab308; }
.minor-indicator { background: var(--text-light); }

/* Accessibility helpers */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.breakable-text {
  word-wrap: break-word;
  word-break: break-all;
  overflow-wrap: break-word;
}

/* Footer */
footer {
  text-align: center;
  padding: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  background: var(--background);
}

/* Responsive styles */
@media screen and (min-width: 768px) {
  header {
    flex-direction: row;
    justify-content: space-between;
    padding: 1rem 2rem;
  }
  
  .logo {
    margin-bottom: 0;
  }
  
  .url-input-container {
    max-width: 60%;
  }
}

@media screen and (max-width: 768px) {
  .container {
    flex-direction: column-reverse;
  }
  
  .how-it-works {
    display: none;
  }
  
  .mobile-only-message {
    display: flex;
  }
  
  .mobile-text {
    display: block;
  }
  
  .audit-controls {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  
  .filter-controls {
    justify-content: space-between;
  }
  
  .input-wrapper {
    flex-direction: column;
  }
  
  #urlInput {
    border-radius: var(--radius) var(--radius) 0 0;
  }
  
  #checkAccessibilityBtn {
    border-radius: 0 0 var(--radius) var(--radius);
  }
}