/* SEO Audit Tool - Dark Glassmorphism Theme */
/* ========================================== */

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(22, 22, 48, 0.6);
    --bg-card-hover: rgba(30, 30, 60, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(100, 100, 255, 0.15);
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a82;
    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-green: #34c759;
    --accent-yellow: #ffd60a;
    --accent-orange: #ff9500;
    --accent-red: #ff3b30;
    --glass-bg: rgba(18, 18, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0a0a1a 0%, #12122a 50%, #0e0e24 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Mouse Glow Effect */
.mouse-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    transform: translate(-50%, -50%);
    transition: left 0.3s ease, top 0.3s ease;
}

/* Navigation */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.nav-brand svg {
    color: var(--accent-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tier-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tier-free { background: rgba(100, 100, 120, 0.3); color: var(--text-secondary); }
.tier-pro { background: rgba(99, 102, 241, 0.2); color: var(--accent-primary); }
.tier-agency { background: rgba(255, 215, 0, 0.15); color: #ffd700; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-primary-hover), #6366f1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.4rem 0.6rem;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Main Content */
.main-content {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 64px - 60px);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s ease;
}

.glass-card:hover {
    border-color: var(--border-glow);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Forms */
.form-card {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* Advanced Settings */
.toggle-btn {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.advanced-settings {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-bottom: 0;
}

.advanced-settings.visible {
    max-height: 500px;
    opacity: 1;
    margin-bottom: 1rem;
}

/* Loader */
.loader {
    text-align: center;
    padding: 3rem 0;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 0.8s linear infinite;
}

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

.loader-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.loader-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Error Card */
.error-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-color: rgba(255, 59, 48, 0.3);
    background: rgba(255, 59, 48, 0.08);
}

.error-icon {
    color: var(--accent-red);
    flex-shrink: 0;
}

.error-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.2);
    border-radius: var(--radius-sm);
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Score Card */
.score-card {
    text-align: center;
}

.score-circle-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0.5rem auto;
}

.score-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-circle-bg {
    stroke: rgba(255, 255, 255, 0.05);
}

.score-circle-fill {
    transition: stroke-dasharray 1.5s ease-out;
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-value span:first-child {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

.score-max {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Category Bars */
.categories-card {
    display: flex;
    flex-direction: column;
}

.category-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
}

.category-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cat-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.cat-score {
    font-size: 0.85rem;
    font-weight: 700;
}

.cat-progress-bg {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.cat-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease-out;
    box-shadow: 0 0 10px currentColor;
}

/* Issue Summary */
.issue-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.issue-summary-item {
    text-align: center;
    padding: 1.25rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.p0-bg { background: rgba(255, 59, 48, 0.08); border-color: rgba(255, 59, 48, 0.2); }
.p1-bg { background: rgba(255, 149, 0, 0.08); border-color: rgba(255, 149, 0, 0.2); }
.p2-bg { background: rgba(255, 214, 10, 0.08); border-color: rgba(255, 214, 10, 0.2); }

.issue-count {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.3rem;
}

.p0-bg .issue-count { color: var(--accent-red); }
.p1-bg .issue-count { color: var(--accent-orange); }
.p2-bg .issue-count { color: var(--accent-yellow); }

.issue-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Vitals Grid */
.vitals-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    font-size: 0.9rem;
}

/* Top Issues / Action Plan */
.top-issues-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.top-issue-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.top-issue-link:hover {
    background: rgba(255, 255, 255, 0.06);
}

.p0-border { border-left: 3px solid var(--accent-red); }
.p1-border { border-left: 3px solid var(--accent-orange); }
.p2-border { border-left: 3px solid var(--accent-yellow); }

.top-issue-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 200px;
}

.top-issue-url {
    font-size: 0.75rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Issue Items */
.issue-section-title {
    font-size: 1rem;
}

.p0-text { color: var(--accent-red); }
.p1-text { color: var(--accent-orange); }
.p2-text { color: var(--accent-yellow); }

.issue-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.issue-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
}

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

.issue-item.p0-issue { border-left: 3px solid var(--accent-red); }
.issue-item.p1-issue { border-left: 3px solid var(--accent-orange); }
.issue-item.p2-issue { border-left: 3px solid var(--accent-yellow); }

.issue-icon-wrapper {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.p0-issue .issue-icon-wrapper { color: var(--accent-red); }
.p1-issue .issue-icon-wrapper { color: var(--accent-orange); }
.p2-issue .issue-icon-wrapper { color: var(--accent-yellow); }

.issue-status-icon {
    width: 20px;
    height: 20px;
}

.issue-content {
    flex: 1;
    min-width: 0;
}

.issue-header-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
}

.issue-cat {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.impact-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.impact-crit { background: rgba(255, 59, 48, 0.15); color: var(--accent-red); }
.impact-high { background: rgba(255, 149, 0, 0.15); color: var(--accent-orange); }
.impact-med { background: rgba(255, 214, 10, 0.15); color: var(--accent-yellow); }
.impact-low { background: rgba(100, 100, 120, 0.15); color: var(--text-secondary); }

.issue-desc {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.issue-url {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
}

.issue-solution {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: rgba(99, 102, 241, 0.06);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.issue-solution svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--accent-primary);
}

.btn-get-help {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.btn-get-help:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

/* Scan Meta */
.scan-url {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-all;
    margin-bottom: 0.25rem;
}

.scan-stats {
    font-size: 0.85rem;
}

/* History */
.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.history-list li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

/* History Table */
.history-table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-table td {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.history-url {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
}

/* JSON Payload */
.json-details {
    cursor: pointer;
}

.json-details summary {
    cursor: pointer;
    list-style: none;
}

.json-details summary::-webkit-details-marker {
    display: none;
}

.json-payload {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    max-width: 420px;
    width: 100%;
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
}

/* Utility */
.text-muted { color: var(--text-muted); }

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .issue-summary-grid {
        grid-template-columns: 1fr;
    }

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

    .glass-card {
        padding: 1rem;
    }

    .score-circle-wrapper {
        width: 150px;
        height: 150px;
    }

    .score-value span:first-child {
        font-size: 2rem;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.score-circle-fill {
    animation: drawCircle 1.5s ease-out forwards;
}

@keyframes drawCircle {
    from { stroke-dasharray: 0, 100; }
}
