/* =======================================================
 *  Uncoder SEO Audit Tool — Refined Styles
 *  Complements Sketchy Bootswatch theme with cleaner layout
 *  Author: OshekharO
 * ======================================================= */

/* ── Theme variables ─────────────────────────────────── */
:root {
  --pass-green:   #28a745;
  --warn-amber:   #ffc107;
  --fail-red:     #dc3545;
  --grade-a-plus: #28a745;
  --grade-a:      #28a745;
  --grade-b:      #17a2b8;
  --grade-c:      #ffc107;
  --grade-d:      #fd7e14;
  --grade-f:      #dc3545;
  --card-shadow:  0 2px 8px rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.10);
}

/* ── Hero section ────────────────────────────────────── */
.hero-section {
  background: linear-gradient(135deg, #fff5f0 0%, #f0f4ff 100%);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: "";
  position: absolute;
  top: -20px; left: -20px;
  width: 60px; height: 60px;
  background: radial-gradient(circle, rgba(40,167,69,0.1) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-section::after {
  content: "";
  position: absolute;
  bottom: -30px; right: -30px;
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(13,110,253,0.1) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-title {
  position: relative;
  z-index: 2;
}

/* ── Audit form ──────────────────────────────────────── */
#audit-form .form-control {
  border: 2px solid var(--border-subtle);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: border-color 0.2s;
}
#audit-form .form-control:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 69, 255, 0.15);
}
#audit-form .btn {
  border: none;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 1rem;
}

/* ── Notice alert ────────────────────────────────────── */
.alert-warning {
  border-radius: 8px;
}
.alert-warning strong {
  font-size: 0.9rem;
}

/* ── Spinner / loading ───────────────────────────────── */
#spinner .spinner-border {
  width: 3rem; height: 3rem;
}

/* ── Progress list (live audit status) ───────────────── */
.progress-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.progress-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px;
  transition: all 0.2s ease;
}
.progress-item:last-child { border-bottom: none; }
.progress-item.completed {
  background: rgba(40, 167, 69, 0.03);
}
.progress-name { font-weight: 500; }
.progress-status { font-size: 12px; color: #6c757d; }
.progress-meta { display: flex; align-items: center; gap: 0.5rem; }
.progress-score { font-weight: 600; min-width: 36px; }
.progress-bar-container {
  width: 60px; height: 6px;
  background: rgba(0, 0, 0, 0.08); border-radius: 3px; overflow: hidden;
}
.progress-bar {
  height: 100%; background: #333; border-radius: 3px;
  transition: width 0.3s ease;
}
.progress-counts { font-size: 11px; color: #888; white-space: nowrap; }

/* ── Overall score card ───────────────────────────────── */
.overall-score-card {
  text-align: center;
  padding: 0 1rem;
}
.display-1 {
  font-size: 2.5rem;
  font-weight: 700;
}
.overall-score-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
}
.grade-badge {
  display: inline-block;
  min-width: 52px;
  height: 52px;
  line-height: 52px;
  font-size: 1.3rem;
  font-weight: 700;
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.grade-Aplus, .grade-A { background: var(--grade-a); }
.grade-B          { background: var(--grade-b); }
.grade-C          { background: var(--grade-c); color: #333; }
.grade-D          { background: var(--grade-d); }
.grade-F          { background: var(--grade-f); }
.progress {
  border-radius: 8px;
  overflow: hidden;
  height: 12px;
}

/* ── Category cards ──────────────────────────────────── */
.category-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.category-card {
  border: 2px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--card-shadow);
  transition: all 0.2s ease;
  cursor: pointer;
}
.category-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.18);
}
.category-card.clean { border-left: 4px solid var(--pass-green); }
.category-card.has-warnings { border-left: 4px solid var(--warn-amber); }
.category-card.has-failures { border-left: 4px solid var(--fail-red); }

.category-header {
  padding: 0.85rem 1.25rem;
}
.category-name {
  font-size: 1.1rem;
  margin-bottom: 0;
}
.category-score {
  font-size: 1.25rem;
  font-weight: 700;
  min-width: 48px;
}
.category-meta {
  text-align: center;
}
.category-meta .badge {
  font-size: 0.72rem;
}
.toggle-icon {
  transition: transform 0.2s;
  font-size: 0.85rem;
  color: #888;
}
.toggle-icon.rotated { transform: rotate(180deg); }

.category-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.category-body.expanded { max-height: 3000px; }

/* ── Rule items ──────────────────────────────────────── */
.rule-list { padding: 0; }
.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 1rem 0.5rem 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 13px;
  transition: background 0.15s;
}
.rule-item:hover { background: rgba(0, 0, 0, 0.03); }
.rule-item:last-child { border-bottom: none; }
.rule-icon {
  font-size: 1.1rem;
  margin-top: 0.5px;
  min-width: 20px; text-align: center;
}
.rule-pass .rule-icon { color: var(--pass-green); }
.rule-warn .rule-icon { color: var(--warn-amber); }
.rule-fail .rule-icon { color: var(--fail-red); }
.rule-content { flex: 1; }
.rule-id {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rule-msg {
  font-size: 12px;
  color: #444;
  margin-top: 1px;
  line-height: 1.4;
}
.rule-score {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  min-width: 36px;
  text-align: right;
}
.rule-pass .rule-score { color: var(--pass-green); }
.rule-fail .rule-score { color: var(--fail-red); }
.rule-warn .rule-score { color: var(--warn-amber); }

/* ── Badges ──────────────────────────────────────────── */
.grade-badge.gb-sm {
  min-width: 28px;
  height: 28px;
  line-height: 28px;
  font-size: 0.8rem;
}

/* ── Info section ────────────────────────────────────── */
.info-section {
  background: rgba(13, 69, 255, 0.04);
  border: 1px solid rgba(13, 69, 255, 0.12);
  border-radius: 8px;
}
.info-section .badge {
  font-size: 0.7rem;
  margin: 1px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .category-header { padding: 0.7rem 1rem; }
  .rule-item {
    padding: 0.4rem 0.75rem 0.4rem 1rem;
    gap: 0.4rem;
  }
  .display-1 { font-size: 2rem; }
  .hero-title h1 { font-size: 1.75rem; }
  .hero-section { padding: 1.25rem 1rem; }
}

@media (max-width: 576px) {
  .overall-score-card { padding: 0; }
  .display-1 { font-size: 1.75rem; }
  .grade-badge { min-width: 44px; height: 44px; line-height: 44px; font-size: 1.1rem; }
  .category-header h3 { font-size: 1rem; }
  .category-score { font-size: 1.1rem; }
  .progress-meta { gap: 0.25rem; }
  .progress-bar-container { width: 50px; }

  /* Keep form button inline within the search bar on mobile */
  .audit-form .form-control { flex: 1; }
  .audit-form .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }
  .audit-form .btn .me-2 { display: none; }  /* icon-only on small screens */
}

/* ── Custom scrollbar ────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.05); border-radius: 3px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.4); }
