/* 
 * ScanTheThings - Public Homepage & AI Audit Design System
 */

:root {
    --bg-color: var(--bg-canvas);
    --card-bg: var(--surface-card);
    --text-main: var(--neutral-main);
    --text-muted: var(--neutral-muted);
    --border: var(--border-subtle);
    --border-light: var(--border-subtle);
    --teal-main: var(--color-primary);
    --teal-dark: var(--color-primary-hover);
    --teal-light: var(--bg-info-tint);
    --teal-accent: var(--accent-flash);
    --radius-lg: 12px;
    --radius-md: 8px;
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-canvas);
    color: var(--neutral-main);
    line-height: 1.6;
}

/* Header & Nav */
.header {
    background: var(--color-level1-bg);
    color: var(--color-level1-text);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-level1-text);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-badge {
    background: var(--accent-flash);
    color: #2C2621;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
}

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

.nav-link {
    color: var(--color-level1-text);
    opacity: 0.85;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

.nav-link:hover {
    opacity: 1;
}

.btn-nav {
    background: var(--color-primary);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.15s ease;
}

.btn-nav:hover {
    background: var(--color-primary-hover);
}

/* Container */
.container {
    max-width: 1050px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3.5rem 1rem 2.5rem;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-info-tint);
    color: var(--color-info);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-subtle);
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--neutral-main);
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
}

.hero h1 span {
    color: var(--color-primary);
}

.hero p {
    font-size: 1.15rem;
    color: var(--neutral-muted);
    max-width: 720px;
    margin: 0 auto 1.5rem;
}

/* Audit Workspace Card */
.audit-card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sample-loader-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sample-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--neutral-muted);
    white-space: nowrap;
}

.sample-dropdown {
    background: var(--surface-card-hover);
    color: var(--neutral-main);
    border: 1px solid var(--border-subtle);
    padding: 0.3rem 0.65rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.sample-dropdown:hover,
.sample-dropdown:focus {
    background: var(--surface-card);
    border-color: var(--color-primary);
    outline: none;
}

.btn-clear {
    background: transparent;
    color: var(--neutral-muted);
    border: 1px solid var(--border-subtle);
    padding: 0.28rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-clear:hover {
    background: var(--bg-danger-tint);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.workspace-box-frame {
    width: 100%;
    position: relative;
}

textarea.audit-input {
    width: 100%;
    height: 95px;
    min-height: 80px;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    background-color: var(--surface-card);
    color: var(--neutral-main);
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea.audit-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.review-box {
    background: var(--surface-card);
    color: var(--neutral-main);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    min-height: 95px;
    max-height: 360px;
    overflow-y: auto;
    line-height: 1.7;
    font-size: 0.98rem;
}

/* Compact Bottom Action Bar */
.audit-action-bar {
    margin-top: 0.65rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 500;
    min-width: 0;
    flex: 1;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    animation: statusPulse 2s infinite ease-in-out;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.85);
    }
}

.status-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-scan-primary {
    background-color: var(--teal-main);
    color: white;
    border: none;
    padding: 0.55rem 1.4rem;
    font-size: 0.92rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, transform 0.1s ease;
    box-shadow: 0 1px 3px rgba(15, 118, 110, 0.2);
}

.btn-scan-primary:hover:not(:disabled) {
    background-color: var(--teal-dark);
    transform: translateY(-1px);
}

.btn-scan-primary:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

/* Dedicated Active Scanning State */
.btn-scan-primary.btn-scanning {
    background-color: #0f766e !important;
    color: white !important;
    cursor: wait !important;
    pointer-events: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    animation: btnScanPulse 1.5s infinite ease-in-out;
}

.btn-spinner {
    width: 0.9rem;
    height: 0.9rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

@keyframes btnScanPulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }

    100% {
        opacity: 1;
    }
}

.btn-back-edit {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid var(--border);
    padding: 0.55rem 1.4rem;
    font-size: 0.92rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.btn-back-edit:hover {
    background-color: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

.status-bar {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Authenticity Section Below */
.authenticity-section {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-light);
    padding-top: 1.25rem;
}

/* Compact Detector Rules Toolbar & Grid */
.rules-toolbar-section {
    background: var(--surface-card-hover);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 2rem;
}

.toolbar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toolbar-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--neutral-main);
    letter-spacing: -0.02em;
}

.toolbar-actions {
    display: flex;
    gap: 0.4rem;
}

.btn-toggle-action {
    background: var(--surface-card);
    color: var(--neutral-main);
    border: 1px solid var(--border-subtle);
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-toggle-action:hover {
    background: var(--surface-card-hover);
    color: var(--neutral-main);
}

.compact-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

.subcategory-card {
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.85rem;
    background: var(--surface-card);
    color: var(--neutral-main);
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
    cursor: pointer;
}

.subcategory-card:hover {
    box-shadow: 0 2px 4px rgb(0 0 0 / 0.08);
}

#sub-legacy.triggered {
    border-left-color: #9333ea;
    background: var(--bg-legacy-tint, #faf5ff);
}

#sub-superficial.triggered {
    border-left-color: #2563eb;
    background: var(--bg-superficial-tint, #eff6ff);
}

#sub-promotional.triggered {
    border-left-color: #e11d48;
    background: var(--bg-promotional-tint, #fff1f2);
}

#sub-vocab.triggered {
    border-left-color: #d97706;
    background: var(--bg-vocab-tint, #fffbeb);
}

#sub-parallelism.triggered {
    border-left-color: #db2777;
    background: var(--bg-parallelism-tint, #fdf2f8);
}

#sub-three.triggered {
    border-left-color: #0d9488;
    background: var(--bg-three-tint, #f0fdfa);
}

/* Card Header Title with Switch */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.title-with-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
}

.subcategory-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--neutral-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Custom CSS Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 17px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-subtle);
    transition: .2s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 13px;
    width: 13px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--color-primary);
}

input:checked+.slider:before {
    transform: translateX(15px);
}

.subcategory-card.disabled {
    opacity: 0.5;
    background: var(--surface-card-hover) !important;
    border-left-color: var(--border-subtle) !important;
    filter: grayscale(0.5);
}

.layer-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.18rem 0.55rem;
    border-radius: 9999px;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    letter-spacing: 0.02em;
    transition: all 0.15s ease;
}

.layer-none {
    background: var(--surface-card-hover);
    color: var(--neutral-muted);
    border: 1px solid var(--border-subtle);
}

.layer-triggered {
    background: var(--bg-danger-tint);
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
}

.explanation-text {
    font-size: 0.85rem;
    color: var(--neutral-muted);
    line-height: 1.4;
}

.findings-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.match-pill {
    background: var(--surface-card);
    color: var(--neutral-main);
    border: 1px solid var(--border-subtle);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}

.match-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgb(0 0 0 / 0.08);
    filter: brightness(0.95);
}

.match-pill.pill-ignored {
    opacity: 0.55;
    text-decoration: line-through;
    filter: grayscale(0.85);
    background-color: var(--surface-card-hover) !important;
    border-color: var(--border-subtle) !important;
    color: var(--neutral-muted) !important;
    box-shadow: none !important;
}

.match-pill.pill-ignored:hover {
    opacity: 0.85;
    background-color: var(--surface-card-hover) !important;
    border-color: var(--neutral-muted) !important;
    transform: none;
}

#sub-legacy .match-pill {
    background: #faf5ff;
    border-color: #d8b4fe;
    color: #581c87;
}

#sub-superficial .match-pill {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e40af;
}

#sub-promotional .match-pill {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #9f1239;
}

#sub-vocab .match-pill {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

#sub-parallelism .match-pill {
    background: #fdf2f8;
    border-color: #fbcfe8;
    color: #9d174d;
}

#sub-three .match-pill {
    background: #f0fdfa;
    border-color: #99f6e4;
    color: #115e59;
}

.pill-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pill-icon {
    font-size: 0.7rem;
    opacity: 0.75;
    flex-shrink: 0;
}

/* Annotated Text Review Box */
.section-heading {
    font-size: 1.2rem;
    color: var(--neutral-main);
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-subtle);
}

.review-box {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    line-height: 1.8;
    font-size: 1.05rem;
    color: var(--neutral-main);
}

/* Category-Based Slop Markers */
mark.mark-slop {
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-weight: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline;
    margin: 0;
    position: relative;
}

mark.mark-slop.mark-disabled {
    background-color: transparent !important;
    color: inherit !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    pointer-events: none !important;
    font-weight: inherit !important;
}

mark.mark-slop.mark-disabled .tag-label {
    display: none !important;
}

.tag-label {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.08rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    margin-left: 0.35rem;
    letter-spacing: 0.02em;
    pointer-events: none;
}

/* Category Specific Color Fills & Borders */
mark.mark-cat-legacy {
    background-color: #f3e8ff;
    color: #581c87;
    border: 1px solid #d8b4fe;
}

mark.mark-cat-legacy .tag-label {
    background: #d8b4fe;
    color: #581c87;
}

mark.mark-cat-superficial {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

mark.mark-cat-superficial .tag-label {
    background: #93c5fd;
    color: #1e40af;
}

mark.mark-cat-promotional {
    background-color: #ffe4e6;
    color: #9f1239;
    border: 1px solid #fecdd3;
}

mark.mark-cat-promotional .tag-label {
    background: #fecdd3;
    color: #9f1239;
}

mark.mark-cat-vocab {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

mark.mark-cat-vocab .tag-label {
    background: #fde68a;
    color: #92400e;
}

mark.mark-cat-parallelism {
    background-color: #fce7f3;
    color: #9d174d;
    border: 1px solid #fbcfe8;
}

mark.mark-cat-parallelism .tag-label {
    background: #fbcfe8;
    color: #9d174d;
}

mark.mark-cat-three {
    background-color: #ccfbf1;
    color: #115e59;
    border: 1px solid #99f6e4;
}

mark.mark-cat-three .tag-label {
    background: #99f6e4;
    color: #115e59;
}

/* Dark Mode Overrides for Categories */
:root[data-theme="dark"] #sub-legacy.triggered {
    border-left-color: #c084fc;
    background: #2e1065;
}
:root[data-theme="dark"] #sub-superficial.triggered {
    border-left-color: #60a5fa;
    background: #172554;
}
:root[data-theme="dark"] #sub-promotional.triggered {
    border-left-color: #fb7185;
    background: #4c0519;
}
:root[data-theme="dark"] #sub-vocab.triggered {
    border-left-color: #fbbf24;
    background: #451a03;
}
:root[data-theme="dark"] #sub-parallelism.triggered {
    border-left-color: #f472b6;
    background: #500724;
}
:root[data-theme="dark"] #sub-three.triggered {
    border-left-color: #2dd4bf;
    background: #042f2e;
}

:root[data-theme="dark"] #sub-legacy .match-pill {
    background: #2e1065;
    border-color: #c084fc;
    color: #e9d5ff;
}
:root[data-theme="dark"] #sub-superficial .match-pill {
    background: #172554;
    border-color: #60a5fa;
    color: #dbeafe;
}
:root[data-theme="dark"] #sub-promotional .match-pill {
    background: #4c0519;
    border-color: #fb7185;
    color: #ffe4e6;
}
:root[data-theme="dark"] #sub-vocab .match-pill {
    background: #451a03;
    border-color: #fbbf24;
    color: #fef3c7;
}
:root[data-theme="dark"] #sub-parallelism .match-pill {
    background: #500724;
    border-color: #f472b6;
    color: #fce7f3;
}
:root[data-theme="dark"] #sub-three .match-pill {
    background: #042f2e;
    border-color: #2dd4bf;
    color: #ccfbf1;
}

/* Feature Showcase Grid */
.features-section {
    margin: 4rem 0 2rem;
    text-align: center;
}

.features-section h2 {
    font-size: 1.8rem;
    color: var(--neutral-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.features-section p.subtitle {
    color: var(--neutral-muted);
    margin-bottom: 2.5rem;
    font-size: 1.05rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    text-align: left;
}

.feature-card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    color: var(--neutral-main);
    margin-bottom: 0.4rem;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--neutral-muted);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border-subtle);
    margin-top: 4rem;
    padding-top: 2rem;
    text-align: center;
    color: var(--neutral-muted);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .sponsor-card {
        flex-direction: column;
        text-align: center;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .scorecard-banner {
        flex-direction: column;
        text-align: center;
    }
}