:root {
    --primary: #4f46e5;
    /* Indigo 600 */
    --primary-dark: #4338ca;
    /* Indigo 700 */

    --bg-page: #f8fafc;
    /* Slate 50 */
    --bg-card: #ffffff;

    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */

    --border: #e2e8f0;
    /* Slate 200 */

    --success: #10b981;
    /* Emerald 500 */
    --warning: #f59e0b;
    /* Amber 500 */
    --danger: #ef4444;
    /* Rose 500 */

    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    padding: 2rem;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Input Section */
.input-card {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 4rem auto;
    text-align: center;
}

.card-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.card-header p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.form-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

input[type="text"],
input[type="url"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.optional-upload {
    text-align: left;
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
    transition: background 0.2s;
}

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

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Report Document */
.report-document {
    background: var(--bg-card);
    padding: 4rem;
    border-radius: 0;
    box-shadow: var(--shadow);
    min-height: 100vh;
}

/* Header */
.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid var(--border);
    padding-bottom: 2rem;
    margin-bottom: 3rem;
}

.doc-meta h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.doc-meta a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: block;
    margin: 0.25rem 0;
}

.doc-meta span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.doc-branding {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.brand-tag {
    background: var(--text-main);
    color: white;
    padding: 0.25rem 0.75rem;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
}

/* Executive Summary */
.executive-summary {
    margin-bottom: 3rem;
}

.executive-summary h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-cards-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.score-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #f8fafc;
    /* Subtle contrasting bg */
}

.score-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 1rem;
}

.score-display {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.score-grade {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.25rem 1rem;
    border-radius: 20px;
    display: inline-block;
}

/* Tabs */
.device-tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Section Blocks */
.section-block {
    margin-bottom: 4rem;
}

.section-block h4 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* CWV Grid */
.cwv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.metric-box {
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: var(--radius);
    background: white;
}

.metric-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.metric-val {
    font-size: 2rem;
    font-weight: 700;
}

.metric-status {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 0.5rem;
    display: block;
}

/* History Charts */
.history-charts-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    /* Stacked */
    gap: 2rem;
}

.chart-container {
    height: 300px;
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: var(--radius);
}

/* Checklist */
.checklist-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    transition: transform 0.2s;
}

.checklist-item:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.check-input {
    margin-top: 0.4rem;
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.check-content {
    flex: 1;
}

.check-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.check-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.check-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.priority-tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.p-high {
    background: #fee2e2;
    color: #b91c1c;
}

.p-med {
    background: #ffedd5;
    color: #c2410c;
}

.p-low {
    background: #ecfccb;
    color: #4d7c0f;
}

/* Print */
@media print {
    body {
        padding: 0;
        background: white;
    }

    .input-card,
    .btn-text,
    .tab-btn {
        display: none;
    }

    .report-document {
        box-shadow: none;
        padding: 0;
        min-height: auto;
    }

    .page-break-before {
        page-break-before: always;
    }
}

/* Utility Colors for text */
.text-good {
    color: var(--success);
}

.text-avg {
    color: var(--warning);
}

.text-poor {
    color: var(--danger);
}/* Detailed Analysis Tables */
.details-table-container {
    margin-top: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    display: none;
    /* Hidden by default */
}

.details-table-container.open {
    display: block;
}

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

.details-table th {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
}

.details-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    word-break: break-all;
}

.details-table td:last-child {
    text-align: right;
    white-space: nowrap;
}

.details-toggle {
    margin-top: 0.5rem;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.details-toggle:hover {
    text-decoration: underline;
}

.url-cell {
    font-family: monospace;
    color: var(--text-muted);
}/* Business Impact Calculator */
.calculator-card {
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.calc-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.calc-inputs .form-group input {
    background: white;
}

.calc-results {
    display: flex;
    justify-content: space-around;
    align-items: center;
    text-align: center;
    margin-bottom: 1.5rem;
}

.calc-header {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.calc-metric strong {
    display: block;
    font-size: 2.5rem;
    line-height: 1.1;
    color: var(--text-main);
}

.calc-metric span {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.calc-metric.highlight strong {
    color: var(--success);
}

.calc-divider {
    width: 2px;
    height: 60px;
    background: var(--border);
}

.calc-disclaimer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.5);
    padding: 0.5rem;
    border-radius: 4px;
}

#calc-savings-note {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}/* Loading Tips Overlay */
.loading-tips-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 1000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

.loading-tips-overlay.active {
    display: flex;
}

.tips-container {
    max-width: 600px;
    animation: fadeIn 0.5s ease-out;
}

.tip-card {
    background: transparent;
    padding: 2rem;
    transition: opacity 0.5s ease-in-out;
}

.tip-title {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
    font-weight: 700;
}

.tip-content {
    font-size: 1.25rem;
    color: var(--text-main);
    line-height: 1.6;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 2rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .app-container {
        padding: 0;
    }

    /* Input Section */
    .input-card {
        padding: 1.5rem;
        margin: 2rem auto;
    }

    .card-header h2 {
        font-size: 1.5rem;
    }

    /* Report Document */
    .report-document {
        padding: 1.5rem;
    }

    /* Header Stack */
    .doc-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .doc-branding {
        align-items: flex-start;
        width: 100%;
        border-top: 1px solid var(--border);
        padding-top: 1rem;
    }

    /* Score Cards Stack */
    .score-cards-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Tabs Scrollable */
    .device-tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
    }

    .tab-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Calculator Stack */
    .calc-inputs {
        grid-template-columns: 1fr;
    }
    
    .calc-results {
        flex-direction: column;
        gap: 1.5rem;
    }

    .calc-divider {
        width: 100%;
        height: 1px;
    }

    /* Charts */
    .chart-container {
        height: 250px;
    }

    /* Metrics Grid */
    .cwv-grid {
        grid-template-columns: 1fr; /* Single column on very small screens */
    }
}
