/* ===========================
   YourSEOToolbox.com - Main Stylesheet
   =========================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --green-50: #f0fdf4;
  --green-500: #22c55e;
  --green-700: #15803d;
  --red-50: #fef2f2;
  --red-500: #ef4444;
  --red-700: #b91c1c;
  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --amber-700: #b45309;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
}

/* Layout */
.site-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.site-logo span { color: var(--gray-700); }
.site-nav { display: flex; gap: 24px; }
.site-nav a {
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--primary); }

.wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Tool Page Layout */
.tool-page { max-width: 960px; margin: 0 auto; }

.tool-header {
  margin-bottom: 32px;
}
.tool-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}
.tool-header p {
  color: var(--gray-500);
  font-size: 1.05rem;
}

/* Tool Card / Interface */
.tool-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}
.tool-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--gray-800);
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: white;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-group .hint {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 4px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-200); }
.btn-success {
  background: var(--green-500);
  color: white;
}
.btn-danger {
  background: var(--red-500);
  color: white;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  padding: 10px 20px;
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  background: transparent;
  transition: all 0.15s;
  border-radius: 6px 6px 0 0;
  font-family: inherit;
}
.tab:hover { color: var(--gray-700); background: var(--gray-50); }
.tab.active {
  color: var(--primary);
  border-color: var(--border);
  border-bottom-color: white;
  background: white;
  margin-bottom: -1px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Results */
.result-card {
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 24px;
}

.result-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}
.result-item:last-child { border-bottom: none; }
.result-label {
  font-weight: 500;
  color: var(--gray-600);
  min-width: 160px;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.result-value {
  color: var(--gray-900);
  font-size: 0.9375rem;
  word-break: break-all;
}
.result-value.mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: 0.8125rem; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-pass { background: var(--green-50); color: var(--green-700); }
.badge-warning { background: var(--amber-50); color: var(--amber-700); }
.badge-fail { background: var(--red-50); color: var(--red-700); }
.badge-info { background: var(--primary-light); color: var(--primary-dark); }

/* Code block */
.code-block {
  background: var(--gray-800);
  color: #e5e7eb;
  padding: 16px;
  border-radius: 6px;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.8125rem;
  overflow-x: auto;
  white-space: pre-wrap;
  margin: 12px 0;
  position: relative;
}
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: 0.75rem;
  background: rgba(255,255,255,0.1);
  color: #d1d5db;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.copy-btn:hover { background: rgba(255,255,255,0.2); }

/* Table */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tr:hover td { background: var(--gray-50); }

/* Loading spinner */
.spinner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  color: var(--gray-400);
}
.spinner.active { display: flex; }
.spinner-icon {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Info and content sections */
.content-section {
  margin-bottom: 32px;
}
.content-section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--gray-900);
}
.content-section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--gray-800);
}
.content-section p {
  color: var(--gray-600);
  margin-bottom: 16px;
  line-height: 1.7;
}
.content-section ul {
  list-style: disc;
  padding-left: 24px;
  color: var(--gray-600);
  margin-bottom: 16px;
}
.content-section li { margin-bottom: 6px; }

/* FAQ */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.faq-question {
  padding: 16px 20px;
  font-weight: 500;
  cursor: pointer;
  background: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}
.faq-question:hover { background: var(--gray-50); }
.faq-question::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--gray-400);
  flex-shrink: 0;
}
.faq-question.open::after { content: '−'; }
.faq-answer {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: all 0.2s;
  color: var(--gray-600);
  font-size: 0.9375rem;
}
.faq-answer.open {
  padding: 16px 20px;
  max-height: 500px;
}

/* Related tools */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.related-tool {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--gray-700);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
}
.related-tool:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow);
}

/* Tools directory page */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.tool-grid-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}
.tool-grid-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.tool-grid-item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gray-900);
}
.tool-grid-item p {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.5;
}
.tool-grid-item .badge-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  margin-top: 64px;
  background: white;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  color: var(--gray-400);
  font-size: 0.8125rem;
}
.footer-inner a { color: var(--gray-500); text-decoration: none; }
.footer-inner a:hover { color: var(--primary); }

/* Utility */
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Alert / Notice */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 16px;
}
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #bfdbfe; }
.alert-warning { background: var(--amber-50); color: var(--amber-700); border: 1px solid #fde68a; }
.alert-success { background: var(--green-50); color: var(--green-700); border: 1px solid #bbf7d0; }
.alert-danger { background: var(--red-50); color: var(--red-700); border: 1px solid #fecaca; }

/* Canonical Checker Specific Styles */

/* Copy URL Button */
.copy-url-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 6px;
    flex-shrink: 0;
    line-height: 1;
    transition: all 0.15s;
}
.copy-url-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

/* Paste Button */
.paste-btn {
    flex-shrink: 0;
    margin-left: 4px;
    font-size: 0.75rem !important;
    padding: 8px 12px !important;
}

/* Score Ring Animation */
.score-section {
    text-align: center;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 16px;
    position: relative;
}
.score-ring {
    width: 120px;
    height: 120px;
    display: block;
    margin: 0 auto 12px;
}
.score-ring-bg {
    opacity: 0.3;
}
.score-ring-fill {
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(-90deg);
    transform-origin: 60px 60px;
}
.score-ring-number {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.score-ring-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Tooltip on Check Items */
.check-item[title] {
    position: relative;
    cursor: help;
}
.check-item[title]:hover::after,
.check-item[title]:focus::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: #f3f4f6;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 400;
    white-space: normal;
    max-width: 260px;
    width: max-content;
    z-index: 50;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
    animation: tooltipFadeIn 0.15s ease-out;
}
.check-item[title]:hover::before,
.check-item[title]:focus::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--gray-800);
    z-index: 50;
    pointer-events: none;
}
@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(3px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.check-info-icon {
    font-size: 0.7rem;
    color: var(--gray-400);
    flex-shrink: 0;
    margin-left: 2px;
}
.check-item.check-warn .check-info-icon { color: var(--amber-500); }
.check-item.check-fail .check-info-icon { color: var(--red-500); }

/* Score Section backgrounds */
.score-pass { background: var(--green-50); }
.score-warning { background: var(--amber-50); }
.score-fail { background: var(--red-50); }

.score-section .score-label {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 8px;
}
.score-pass .score-label { color: var(--green-700); }
.score-warning .score-label { color: var(--amber-700); }
.score-fail .score-label { color: var(--red-700); }
.score-summary {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.results-header {
    margin-bottom: 20px;
}
.result-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 16px;
}

/* Check Details List */
.check-details {
    margin-bottom: 24px;
}
.check-details h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--gray-700);
}
.check-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
@media (max-width: 640px) {
    .check-list { grid-template-columns: 1fr; }
}
.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8125rem;
}
.check-pass { background: var(--green-50); }
.check-warn { background: var(--amber-50); }
.check-fail { background: var(--red-50); }
.check-info { background: var(--primary-light); }
.check-icon { flex-shrink: 0; font-size: 0.875rem; }
.check-label { flex: 1; color: var(--gray-700); }
.check-points {
    font-weight: 600;
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Consolas', monospace;
}
.check-pass .check-points { color: var(--green-700); }
.check-fail .check-points { color: var(--red-700); }

/* Result Details Grid */
.result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 768px) {
    .result-details { grid-template-columns: 1fr; }
}
.detail-section h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.detail-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-100);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
    font-weight: 500;
    color: var(--gray-500);
    min-width: 130px;
    font-size: 0.8125rem;
    flex-shrink: 0;
}
.detail-value {
    color: var(--gray-900);
    font-size: 0.875rem;
    word-break: break-all;
}
.detail-value.mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: 0.8125rem; }

/* Issue Items */
.issue-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    background: white;
}
.issue-fail { border-left: 4px solid var(--red-500); }
.issue-warning { border-left: 4px solid var(--amber-500); }
.issue-info { border-left: 4px solid var(--primary); }
.issue-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.issue-badge { flex-shrink: 0; }
.issue-detail {
    color: var(--gray-600);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 8px;
}
.issue-fix {
    background: var(--gray-50);
    border-radius: 6px;
    padding: 12px;
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}
@media (max-width: 768px) {
    .feature-grid { grid-template-columns: 1fr; }
}
.feature-item {
    display: flex;
    gap: 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.feature-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}
.feature-item strong {
    display: block;
    font-size: 0.875rem;
    color: var(--gray-800);
    margin-bottom: 4px;
}
.feature-item p {
    font-size: 0.8125rem;
    color: var(--gray-500);
    line-height: 1.5;
    margin: 0;
}

/* Enhanced Results Animation */
.results-container {
    animation: resultsPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes resultsPop {
    0% { opacity: 0; transform: scale(0.97) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Result Actions button hierarchy */
.result-actions .btn-primary {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}
@media (max-width: 768px) {
    .feature-grid { grid-template-columns: 1fr; }
}
.feature-item {
    display: flex;
    gap: 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.feature-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}
.feature-item strong {
    display: block;
    font-size: 0.875rem;
    color: var(--gray-800);
    margin-bottom: 4px;
}
.feature-item p {
    font-size: 0.8125rem;
    color: var(--gray-500);
    line-height: 1.5;
    margin: 0;
}

/* URL Input with validation */
.url-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.url-input-wrap input {
    padding-right: 40px;
}
.url-validation-icon {
    position: absolute;
    right: 12px;
    font-size: 1.1rem;
    display: none;
}
.url-validation-icon.valid { display: block; }
.url-validation-icon.invalid { display: block; }
.url-feedback {
    font-size: 0.8125rem;
    margin-top: 4px;
    min-height: 20px;
}
.url-feedback.error { color: var(--red-500); }

/* Sample URL Buttons */
.sample-urls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
}
.sample-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.sample-btn {
    font-size: 0.75rem !important;
    padding: 4px 10px !important;
}

/* Loading state */
.loading-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}
.loading-spinner-lg {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
.loading-text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 4px;
}
.loading-text .hint {
    font-size: 0.8125rem;
}

/* Button spinner */
.spinner-icon-sm {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}
.btn-submit.loading .btn-text { display: none; }
.btn-submit.loading .btn-spinner { display: inline-flex !important; align-items: center; gap: 6px; }
.btn-submit.loading { pointer-events: none; opacity: 0.8; }

/* FAQ Accessibility */
.faq-question:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    border-radius: 6px;
}

/* Responsive */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 12px 0; gap: 12px; }
  .site-nav { flex-wrap: wrap; justify-content: center; }
  .wrapper { padding: 20px 16px; }
  .tool-card { padding: 20px; }
  .tool-header h1 { font-size: 1.5rem; }
  .result-item { flex-direction: column; gap: 4px; }
  .result-label { min-width: auto; }
}
