/* ==========================================================================
   COGEFLANDRE — Scoped Styles for Use Cases Diagnostic Tool
   ========================================================================== */

/* ─── VARIABLES (Derived from main styles.css) ────────────────────────── */
:root {
    --primary-color: #133454;
    /* Navy Blue */
    --primary-light: #74a7c9;
    /* Accent Medium Blue */
    --primary-dark: #0a1d2f;
    --secondary-color: #9C1C18;
    /* Crimson Red */
    --secondary-light: #B82520;
    --accent-color: #74a7c9;
    --accent-light: #a6c7dd;
    /* Accent Light Blue */
    --white: #ffffff;
    --text-dark: #2D3748;
    --text-muted: #64748B;

    /* Semantic Colors */
    --green-dark: #2e7d5b;
    --green-light: #e8f5ee;
    --green-border: #b5ddc9;

    --orange-dark: #c06020;
    --orange-light: #fdf0e6;
    --orange-border: #f0c89a;

    --red-dark: #9C1C18;
    --red-light: #fce8e8;
    --red-border: #f0b8b8;

    /* Spacings, Radii, Shadows */
    --radius-sm: 4px;
    --radius-md: 8px;
    /* Standardized radius */
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 59, 92, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 59, 92, 0.06);
    --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.15s ease-in-out;
}

/* ─── CONTAINER & HERO ────────────────────────────────────────────────── */
.diagnostic-wrap {
    background-color: var(--white);
    min-height: 100vh;
    padding-bottom: 80px;
}

.diag-breadcrumb {
    background: var(--white);
    border-bottom: 1px solid #eef1f4;
    padding: 12px 0;
}

.diag-breadcrumb .container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.diag-breadcrumb a {
    color: var(--primary-light);
    font-weight: 500;
}

.diag-breadcrumb a:hover {
    color: var(--primary-color);
}

.diag-breadcrumb .sep {
    color: var(--text-muted);
    opacity: 0.5;
}

.diag-breadcrumb .current {
    color: var(--primary-color);
    font-weight: 600;
}

.diag-container {
    max-width: 960px;
    margin: 32px auto 0;
    padding: 36px 32px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(19, 52, 84, 0.08);
    border-top: 3px solid var(--primary-light);
    /* Blue line on top */
}

/* Hero styles are now handled by page-header-section from styles.css */

/* ─── PROGRESS BAR ────────────────────────────────────────────────────── */
.pw {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.pt {
    flex: 1;
    height: 6px;
    background: #d8dde3;
    border-radius: 99px;
    overflow: hidden;
}

.pf {
    height: 100%;
    background: var(--primary-light);
    border-radius: 99px;
    transition: width 0.35s ease;
    width: 0%;
}

.pl {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 64px;
    text-align: right;
    font-weight: 700;
}

/* ─── QUESTIONNAIRE ACCORDION CARDS ───────────────────────────────────── */
.section-card {
    background: var(--white);
    border: 1px solid #eef1f4;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition-smooth);
}

.section-card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(116, 167, 201, 0.3);
}

.section-header {
    padding: 8px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    user-select: none;
    background: var(--white);
    transition: var(--transition-fast);
}

.section-header:hover {
    background: rgba(116, 167, 201, 0.04);
}

.section-header.open {
    background: rgba(116, 167, 201, 0.04);
    border-bottom: 1px solid #eef1f4;
}

.section-title-block {
    flex: 1;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--primary-color);
    font-weight: 700;
    padding-top: 6px;
}

.section-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 1px;
    line-height: 1.2;
}

.section-badge {
    font-size: 0.72rem;
    background: #f8fafc;
    color: var(--text-muted);
    border: 1px solid #eef1f4;
    border-radius: 12px;
    padding: 3px 10px;
    font-weight: 700;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.section-badge.has-selection {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.chevron {
    color: var(--primary-light);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.chevron.open {
    transform: rotate(180deg);
}

.section-body {
    display: none;
    padding: 16px 20px;
    border-top: 1px solid #eef1f4;
}

.section-body.open {
    display: block;
}

/* ─── QUESTION GRID & ITEMS ───────────────────────────────────────────── */
.question-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.question-item {
    position: relative;
}

.question-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.question-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border: 1.5px solid #eef1f4;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    background-color: var(--white);
    user-select: none;
}

.question-label:hover {
    border-color: var(--primary-light);
    background: rgba(116, 167, 201, 0.02);
}

input[type="checkbox"]:checked+.question-label {
    border-color: var(--primary-color);
    background: rgba(116, 167, 201, 0.06);
}

.check-box {
    width: 20px;
    height: 20px;
    border: 2px solid #eef1f4;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    background: var(--white);
}

input[type="checkbox"]:checked+.question-label .check-box {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.check-icon {
    display: none;
}

input[type="checkbox"]:checked+.question-label .check-icon {
    display: block;
}

.question-text {
    font-size: 0.88rem;
    color: var(--text-dark);
    line-height: 1.45;
}

.question-cases {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.case-tag {
    font-size: 0.68rem;
    background: rgba(116, 167, 201, 0.15);
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* ─── ACTIONS BAR ─────────────────────────────────────────────────────── */
.actions-bar {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    padding: 20px 24px;
    background: var(--white);
    border: 1px solid #eef1f4;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    letter-spacing: 0.02em;
    outline: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(19, 52, 84, 0.15);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 14px rgba(19, 52, 84, 0.25);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 1.5px solid #eef1f4;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--primary-light);
}

.selection-count {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.selection-count span {
    color: var(--primary-color);
    font-weight: 700;
}

.actions-bar .btn-primary {
    margin-left: auto;
}

/* ─── RESULTS PANEL ───────────────────────────────────────────────────── */
#results-panel {
    display: none;
    margin-top: 32px;
    animation: fadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.results-title {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--primary-color);
}

.results-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.summary-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    border: 1.5px solid;
}

.chip-total {
    background: rgba(116, 167, 201, 0.08);
    color: var(--primary-color);
    border-color: rgba(116, 167, 201, 0.3);
}

.chip-simple {
    background: var(--green-light);
    color: var(--green-dark);
    border-color: var(--green-border);
}

.chip-moderate {
    background: var(--orange-light);
    color: var(--orange-dark);
    border-color: var(--orange-border);
}

.chip-complex {
    background: var(--red-light);
    color: var(--red-dark);
    border-color: var(--red-border);
}

.results-group {
    margin-bottom: 32px;
}

.results-group-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 700;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(116, 167, 201, 0.15);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* case cards print styling placeholder */

/* ─── CASE CARDS (IN RESULTS) ─────────────────────────────────────────── */
.case-card {
    background: var(--white);
    border: 1px solid #eef1f4;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.case-card:hover {
    border-color: var(--primary-light);
}

.case-card-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    user-select: none;
}

.case-card-header:hover {
    background: rgba(116, 167, 201, 0.02);
}

.case-number {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--white);
    background: var(--primary-color);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 48px;
    text-align: center;
}

.case-info {
    flex: 1;
    min-width: 0;
}

.case-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.case-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.4;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.case-card-header.open .case-desc {
    white-space: normal;
}

.complexity-badge {
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 12px;
    padding: 3px 10px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.02em;
    border: 1px solid;
}

.complexity-faible {
    background: var(--green-light);
    color: var(--green-dark);
    border-color: var(--green-border);
}

.complexity-modérée {
    background: var(--orange-light);
    color: var(--orange-dark);
    border-color: var(--orange-border);
}

.complexity-élevée {
    background: var(--red-light);
    color: var(--red-dark);
    border-color: var(--red-border);
}

.case-detail {
    display: none;
    padding: 20px 20px 20px 84px;
    border-top: 1px solid #eef1f4;
    background: #fafbfe;
}

.case-detail.open {
    display: block;
}

.detail-row {
    margin-bottom: 12px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.detail-content {
    font-size: 0.88rem;
    color: var(--text-dark);
    line-height: 1.5;
}

.detail-source {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--primary-color);
    background: rgba(116, 167, 201, 0.15);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-weight: 700;
    margin-top: 4px;
}

/* ─── EMPTY STATE ─────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-muted);
    background: var(--white);
    border: 1px solid #eef1f4;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.empty-state svg {
    margin-bottom: 16px;
    color: var(--primary-light);
    opacity: 0.6;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-weight: 700;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ─── LEGAL NOTE & ACCOMPANYING BLOCK ─────────────────────────────────── */
.legal-note {
    background: rgba(116, 167, 201, 0.06);
    border: 1.5px solid rgba(116, 167, 201, 0.2);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 32px;
    line-height: 1.55;
}

/* bottom cta is now styled by ux-safety-net from styles.css */

/* ─── PRINT OPTIMIZATIONS ─────────────────────────────────────────────── */
@media print {
    body {
        background: var(--white);
        color: #000000;
    }

    .main-header,
    .main-footer,
    .diag-breadcrumb,
    .pw,
    .actions-bar,
    .diag-hero,
    .ux-safety-net,
    .legal-note,
    #questionnaire-panel,
    .btn-secondary,
    .results-actions {
        display: none !important;
    }

    .diagnostic-wrap {
        padding-bottom: 0;
        background: var(--white);
    }

    .diag-container {
        margin-top: 0;
        max-width: 100%;
        padding: 0;
    }

    #results-panel {
        display: block !important;
        animation: none !important;
    }

    .results-header {
        margin-bottom: 30px;
    }

    .results-title::after {
        content: " — Rapport personnalisé Cogeflandre";
    }

    .case-card {
        page-break-inside: avoid;
        border: 1.5px solid #000000 !important;
        box-shadow: none !important;
        margin-bottom: 16px;
    }

    .case-card-header {
        background: #f8fafc !important;
    }

    .case-detail {
        display: block !important;
        padding-left: 20px;
        background: var(--white) !important;
    }

    .complexity-badge {
        border: 1.5px solid #000000 !important;
        color: #000000 !important;
        background: var(--white) !important;
    }

    .case-number {
        border: 1.5px solid #000000 !important;
        color: #000000 !important;
        background: var(--white) !important;
    }

    .detail-source {
        border: 1.5px solid #000000 !important;
        color: #000000 !important;
        background: var(--white) !important;
    }
}

/* ─── RESPONSIVE ADJUSTMENTS ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .diag-container {
        padding: 24px 16px;
        margin-top: 16px;
        border-radius: 0;
        border-top: none;
        box-shadow: none;
    }

    .section-header {
        padding: 10px 16px;
    }

    .section-body {
        padding: 12px 16px;
    }

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

    .case-detail {
        padding-left: 20px;
    }

    .actions-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-bar .btn-primary {
        margin-left: 0;
    }

    .selection-count {
        margin-left: 0;
        text-align: center;
        order: -1;
        margin-bottom: 12px;
    }

    .btn {
        width: 100%;
    }
}