﻿/* Original dark theme CSS adapted for current HTML structure */
/* Source: static/index.html.before-modularization */

/* Base styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f13;
    color: #e4e4e7;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 36px;
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 12px;
    color: #ffffff;
}

.subtitle {
    font-size: 1.1rem;
    color: #a1a1aa;
}

/* Cards */
.card {
    background: #18181b;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid #27272a;
}

.hidden {
    display: none !important;
}

/* Upload area (original: .upload-zone) */
.upload-area {
    border: 2px dashed #27272a;
    border-radius: 16px;
    padding: 50px 30px;
    margin: 28px 0;
    background: #18181b;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.upload-area.highlight {
    border-color: #6366f1;
    background: #1e1e24;
}

.upload-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
}

.upload-hint {
    font-size: 0.85rem;
    color: #71717a;
    margin-top: 6px;
}

/* Buttons */
.btn-primary {
    padding: 14px 38px;
    font-size: 1.1rem;
    font-weight: 600;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: inline-block;
    margin-top: 8px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #5558e6;
}

.btn-secondary {
    padding: 10px 18px;
    border: 1px solid #27272a;
    border-radius: 10px;
    background: transparent;
    color: #a1a1aa;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: #6366f1;
    color: #e4e4e7;
}

/* Demo section */
.demo-section {
    margin-top: 36px;
    padding-top: 28px;
    border-top: 1px solid #27272a;
}

.demo-section h3 {
    color: #71717a;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.demo-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-demo {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.btn-demo.safe {
    background: #065f46;
    color: #6ee7b7;
}

.btn-demo.changes {
    background: #78350f;
    color: #fbbf24;
}

.btn-demo.reject {
    background: #7f1d1d;
    color: #fca5a5;
}

.btn-demo:hover {
    opacity: 0.9;
}

/* Privacy notice */
.privacy-notice {
    margin-top: 36px;
    padding: 20px;
    background: #1a1a1e;
    border-radius: 12px;
    border-left: 3px solid #6366f1;
    text-align: left;
}

.privacy-notice h3 {
    color: #e4e4e7;
    margin-bottom: 8px;
    font-size: 1rem;
}

.privacy-notice p {
    color: #a1a1aa;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 8px;
}

/* Loading section (original: .status) */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #27272a;
    border-top-color: #6366f1;
    border-radius: 50%;
    margin: 2rem auto;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error section */
.error-icon {
    font-size: 3rem;
    margin: 1rem 0;
}

/* Result section */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Traffic light - MAIN VISUAL ELEMENT */
.traffic-light {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin: 3rem 0;
    padding: 2rem;
    background: #1a1a1e;
    border-radius: 16px;
    border: 1px solid #27272a;
}

.light {
    text-align: center;
    opacity: 0.3;
    transition: all 0.3s;
    flex: 1;
}

.light.active {
    opacity: 1;
    transform: scale(1.05);
}

.bulb {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    background: #3f3f46;
    transition: all 0.3s;
}

#traffic-light-safe.active .bulb {
    background: #10b981;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.7);
}

#traffic-light-changes.active .bulb {
    background: #f59e0b;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.7);
}

#traffic-light-reject.active .bulb {
    background: #ef4444;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.7);
}

.light .label {
    font-weight: 600;
    font-size: 1rem;
    color: #a1a1aa;
}

.light.active .label {
    color: #e4e4e7;
}

/* Decision summary */
.decision-summary {
    text-align: center;
    margin: 2rem 0;
    padding: 2rem;
    background: #1a1a1e;
    border-radius: 16px;
    border: 1px solid #27272a;
}

#decision-text {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

#confidence-text {
    font-size: 1.2rem;
    color: #a1a1aa;
}

/* Analysis grid (original: .meta-grid) */
.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

.analysis-card {
    background: #1a1a1e;
    border-radius: 10px;
    padding: 16px;
}

.analysis-card.full-width {
    grid-column: 1 / -1;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #27272a;
}

.info-row .label {
    font-size: 0.9rem;
    color: #71717a;
}

.info-row .value {
    font-size: 1rem;
    color: #e4e4e7;
}

/* Findings */
.findings-section, .reasons-section {
    margin-top: 20px;
}

.findings-section h4, .reasons-section h4 {
    font-weight: 600;
    margin: 16px 0 8px;
    color: #e4e4e7;
}

.finding {
    background: #1a1a1e;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 3px solid #3f3f46;
}

.finding.severity-high {
    border-left-color: #ef4444;
}

.finding.severity-medium {
    border-left-color: #f59e0b;
}

.finding.severity-low {
    border-left-color: #10b981;
}

.finding-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.finding-type {
    font-weight: 600;
}

.finding-confidence {
    color: #71717a;
    font-size: 0.8rem;
}

.suggested-rewrite {
    background: #27272a;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.rewrite-header {
    font-size: 0.8rem;
    color: #71717a;
    margin-bottom: 6px;
}

.copy-btn {
    padding: 6px 14px;
    background: #27272a;
    border: none;
    border-radius: 6px;
    color: #a1a1aa;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 8px;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #3f3f46;
}

/* Footer */
footer {
    margin-top: 32px;
    text-align: center;
    font-size: 0.8rem;
    color: #52525b;
}

.footer-link {
    color: #6366f1;
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
    h1 { font-size: 1.8rem; }
    .demo-buttons { flex-direction: column; }
    .analysis-grid { grid-template-columns: 1fr; }
    .traffic-light { 
        flex-direction: column; 
        gap: 1rem; 
        padding: 1.5rem;
    }
    .result-header { flex-direction: column; gap: 1rem; }
    .upload-area { padding: 30px 20px; }
    .bulb { width: 60px; height: 60px; }
}

/* Main layout */
main {
    margin: 2rem 0;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #ffffff;
}

h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #e4e4e7;
}

p {
    line-height: 1.5;
    margin-bottom: 1rem;
}

ul {
    list-style: none;
    padding: 0;
}

li {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}

li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #71717a;
}

/* ===== Templates UI (minimal patch) ===== */

.site-header {
    background: #18181b;
    border-bottom: 1px solid #27272a;
}

.site-header .container {
    max-width: 1100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
}

.site-header .logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
}

.site-header nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.site-header nav a {
    color: #a1a1aa;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 14px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.site-header nav a:hover {
    color: #e4e4e7;
    background: #1e1e24;
}

.site-header nav a.active {
    color: #ffffff;
    background: #6366f1;
}

/* Buttons used on Templates pages */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-primary {
    background: #6366f1;
    color: #ffffff;
}

.btn-primary:hover {
    background: #5558e6;
}

.btn-secondary {
    background: transparent;
    color: #a1a1aa;
    border-color: #27272a;
}

.btn-secondary:hover {
    color: #e4e4e7;
    border-color: #6366f1;
}

/* Download — most prominent action */
.btn-ghost {
    background: #6366f1;
    color: #ffffff;
    font-weight: 600;
}

.btn-ghost:hover {
    background: #5558e6;
}

/* View Template — normal clickable link */
.btn-outline {
    background: transparent;
    color: #e4e4e7;
    border-color: #27272a;
}

.btn-outline:hover {
    border-color: #6366f1;
    color: #ffffff;
    background: #1e1e24;
}

.btn-large {
    padding: 14px 32px;
    font-size: 1.05rem;
}

/* Template catalog/detail layout */
.templates-hero,
.template-hero,
.templates-catalog,
.template-viewer,
.clause-watch,
.template-faq,
.conversion-bridge,
.related-templates,
.bottom-cta,
.template-disclaimer,
.cta-section {
    padding: 32px 0;
}

.container {
    max-width: 1100px;
}

.templates-grid,
.templates-catalog .container,
.template-card {
    width: 100%;
}

.template-card {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 20px;
}

.template-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.template-jurisdiction,
.template-updated {
    font-size: 0.78rem;
    color: #71717a;
}

.template-title {
    font-size: 1.25rem;
    color: #ffffff;
    margin-bottom: 8px;
}

.template-subtitle {
    color: #a1a1aa;
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.template-card-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Filter buttons */
.catalog-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.filter-label {
    color: #a1a1aa;
    font-size: 0.9rem;
    margin-right: 6px;
}

.filter-btn {
    background: transparent;
    color: #a1a1aa;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.85rem;
    cursor: pointer;
}

.filter-btn:hover {
    color: #e4e4e7;
    border-color: #6366f1;
}

.filter-btn.active {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
}

/* Responsive */
@media (max-width: 640px) {
    .site-header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .site-header nav {
        flex-wrap: wrap;
    }
    .template-card-footer {
        flex-direction: column;
    }
    .template-card-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===== Templates CTA on main page (minimal) ===== */
.templates-cta {
    text-align: center;
    margin: 24px 0 16px;
    padding: 20px 24px;
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 14px;
}

.templates-cta span {
    display: block;
    font-size: 0.95rem;
    color: #a1a1aa;
    margin-bottom: 8px;
}

.templates-cta a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
}

.templates-cta a:hover {
    color: #818cf8;
    text-decoration: underline;
}