:root {
    --gold-main: #245291;
    --gold-gradient: linear-gradient(135deg, #245291 0%, #1A3C6B 100%);
    --gold-soft: rgba(36, 82, 145, 0.1);
    --gold-glow: rgba(36, 82, 145, 0.3);
    --text-dark: #1A3C6B;
    --border-color: #EAE7DC;
}

.tc-full-wrapper {
    width: 100%;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    background: #FAFAFA !important;
    position: relative;
    overflow: hidden;
    /* Contain animated background */
}

/* Animated Background */
.tc-animated-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(36, 82, 145, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(36, 82, 145, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center;
}

.tc-bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    z-index: -1;
    animation: tc-float 15s infinite alternate ease-in-out;
}

.tc-bg-shape-1 {
    width: 500px;
    height: 500px;
    background: rgba(36, 82, 145, 0.5);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.tc-bg-shape-2 {
    width: 400px;
    height: 400px;
    background: rgba(26, 60, 107, 0.15);
    bottom: 10%;
    right: -50px;
    animation-delay: -5s;
}

.tc-bg-shape-3 {
    width: 600px;
    height: 600px;
    background: rgba(36, 82, 145, 0.3);
    top: 30%;
    left: 30%;
    animation-delay: -10s;
}

@keyframes tc-float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(60px, 40px) scale(1.1);
    }
}

.tc-dashboard {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 60px 20px;
    position: relative;
    z-index: 1;
}

/* Form Side */
.tc-form-side {
    width: 100%;
    /* Increased to allow 4 items per row */
}

.tc-form-inner {
    width: 100%;
    background: #fff;
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.04);
}

/* Layout Wrapper for Sidebar and Content */
.tc-layout-wrapper {
    display: flex;
    gap: 50px;
}

/* Vertical Sidebar Stepper */
.tc-sidebar {
    flex: 0 0 220px;
    padding-right: 30px;
    border-right: 1px solid var(--border-color);
}

.tc-stepper-vertical {
    display: flex;
    flex-direction: column;
    gap: 30px;
    position: sticky;
    top: 40px;
}

.tc-stepper-vertical::before {
    content: '';
    position: absolute;
    left: 19px;
    /* center of 40px dot */
    top: 20px;
    bottom: 20px;
    width: 2px;
    background: var(--border-color);
    z-index: 0;
}

.tc-step {
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0.5;
    transition: 0.3s;
    position: relative;
    z-index: 1;
    cursor: pointer;
}

.tc-step:hover {
    opacity: 0.8;
}

.tc-step.active {
    opacity: 1;
}

.tc-step-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #F4F2EB;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--gold-main);
    transition: 0.3s;
    box-shadow: 0 0 0 4px #fff;
    /* Ensure line doesn't show over dot cleanly */
}

.tc-step.active .tc-step-dot {
    background: var(--gold-gradient);
    color: #fff;
    box-shadow: 0 5px 15px var(--gold-glow), 0 0 0 4px #fff;
}

.tc-step-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-dark);
}

.tc-step-label svg {
    color: var(--gold-main);
    transition: 0.3s;
}

.tc-step.active .tc-step-label svg {
    color: var(--gold-main);
    transform: scale(1.1);
}

/* Main Content Area */
.tc-content-area {
    flex: 1;
    min-width: 0;
}

.tc-pane {
    display: none;
}

.tc-pane.active {
    display: block;
    animation: tc-fade-up 0.6s ease;
}

@keyframes tc-fade-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tc-pane-title {
    font-size: 42px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 25px;
}

.tc-pane-title span {
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tc-tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.tc-tab-btn {
    background: #F4F2EB !important;
    border: none !important;
    padding: 12px 30px !important;
    border-radius: 30px !important;
    color: var(--gold-main) !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: 0.3s !important;
}

.tc-tab-btn.active {
    background: var(--gold-gradient) !important;
    color: #fff !important;
}

.tc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 cards per row */
    gap: 20px;
}

.tc-modern-card input {
    display: none !important;
}

.tc-card-ui {
    background: #fff;
    padding: 20px 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    transition: 0.4s;
    min-height: 140px;
}

.tc-card-ui span {
    font-size: 14px;
    /* Base font size */
    font-weight: 700;
    line-height: 1.2;
    /* color: var(--text-dark); */
    display: block;
    word-wrap: break-word;
    /* Added: Forces long words to wrap */
    overflow-wrap: break-word;
}

.tc-long-name {
    font-size: 11px !important;
    /* Decreased font size */
    line-height: 1.1 !important;
}

.tc-modern-card input:checked+.tc-card-ui span {
    color: #fff;
}

.tc-modern-card:hover .tc-card-ui {
    border-color: var(--gold-main);
    transform: translateY(-5px);
}

.tc-modern-card input:checked+.tc-card-ui {
    background: var(--gold-gradient);
    color: #fff;
    border-color: transparent;
}

.tc-card-icon {
    width: 50px;
    height: 50px;
    background: #F4F2EB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--gold-main);
    flex-shrink: 0;
    /* Prevent icon from shrinking */
}

.tc-card-check {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    margin: 0 auto;
}

.tc-modern-card input:checked+.tc-card-ui .tc-card-check {
    background: #fff;
}

/* Locked Card Style */
.tc-locked-card {
    cursor: default !important;
}

.tc-locked-card .tc-card-ui {
    border-color: var(--gold-main) !important;
    background: var(--gold-gradient) !important;
}

.tc-locked-card input:checked+.tc-card-ui {
    background: var(--gold-gradient) !important;
}

.tc-card-check.locked {
    background: #fff !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tc-card-check.locked::after {
    content: '🔒';
    font-size: 8px;
    color: var(--gold-main);
}

.tc-locked-card span small {
    display: block;
    font-size: 10px;
    opacity: 0.7;
    text-transform: uppercase;
}

/* Accordion */
.tc-crit-group {
    margin-bottom: 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: #fff;
    overflow: hidden;
}

.tc-crit-parent-card {
    padding: 22px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.tc-crit-parent-card:hover {
    background: #F4F2EB;
}

.tc-parent-name {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.tc-parent-badge {
    font-size: 0.75rem;
    background: var(--gold-soft);
    padding: 5px 15px;
    border-radius: 20px;
    color: var(--gold-main);
    font-weight: 700;
}

.tc-chevron {
    width: 10px;
    height: 10px;
    border-right: 2.5px solid var(--gold-main);
    border-bottom: 2.5px solid var(--gold-main);
    transform: rotate(45deg);
    transition: 0.4s;
}

.tc-crit-group.active .tc-chevron {
    transform: rotate(-135deg);
}

.tc-crit-children-grid {
    display: none;
    padding: 45px;
    /* Augmenté de 25px à 35px */
    background: #FAFAFA;
    border-top: 1px solid var(--border-color);
    flex-direction: column;
    gap: 20px;
}

.tc-child-card input {
    display: none;
}

/* Checkbox Style UI */
.tc-checkbox-style .tc-child-ui {
    background: #fff;
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    text-align: left;
    margin-bottom: 5px;

}

.tc-checkbox-box {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.tc-checkbox-style:hover .tc-child-ui {
    border-color: var(--gold-main);
    transform: translateX(5px);
}

.tc-child-card input:checked+.tc-child-ui {
    background: var(--gold-soft);
    border-color: var(--gold-main);
}

.tc-child-card input:checked+.tc-child-ui .tc-checkbox-box {
    background: var(--gold-gradient);
    border-color: transparent;
}

.tc-child-card input:checked+.tc-child-ui .tc-checkbox-box::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.tc-chart-box {
    position: relative !important;
    height: 450px !important;
    width: 100% !important;
    background: #fff;
    padding: 30px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    margin-bottom: 30px;
    height: 500px !important;
}

.tc-chart-box canvas {
    height: 100% !important;
    width: 100% !important;
}

.tc-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 20px;
    border-radius: 12px;
}

.tc-final-table {
    width: 100%;
    min-width: 500px;
    /* Prevents table from crushing on mobile */
    border-collapse: collapse;
}

.tc-final-table thead {
    background: var(--gold-gradient);
    color: #fff;
}

.tc-final-table th {
    padding: 20px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
}

.tc-final-table td small {
    color: #777;
    font-style: italic;
}

.tc-final-table td {
    padding: 18px 20px;
    border-bottom: 1px solid #F4F2EB;
    color: var(--text-dark);
}

/* Stepper & Actions */
.tc-actions {
    display: flex;
    gap: 20px;
    margin-top: 40px;
}

.tc-btn-next {
    background: var(--gold-gradient) !important;
    color: #fff !important;
    padding: 16px 45px !important;
    border-radius: 40px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    box-shadow: 0 10px 20px var(--gold-glow) !important;
    border: none !important;
}

.tc-btn-back {
    background: #F4F2EB !important;
    color: var(--gold-main) !important;
    padding: 16px 45px !important;
    border-radius: 40px !important;
    border: none !important;
    cursor: pointer !important;
}

/* Removed horizontal stepper styling */

@media (max-width: 992px) {
    .tc-dashboard {
        padding: 30px 15px;
    }

    .tc-form-inner {
        padding: 30px 20px;
    }

    .tc-layout-wrapper {
        flex-direction: column;
        gap: 30px;
    }

    .tc-sidebar {
        flex: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 20px;
    }

    .tc-stepper-vertical {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }

    .tc-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #tc-charts-wrapper {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .tc-grid {
        grid-template-columns: 1fr;
    }

    .tc-parent-name {
        font-size: 14px !important;
    }

    .tc-child-ui span {
        font-size: 12px !important;
    }
}

.tc-long-name {
    font-size: 11px !important;
    line-height: 1.1 !important;
}

.tc-card-ui span {
    word-wrap: break-word;
    overflow-wrap: break-word;
}


#tc-charts-wrapper {
    display: flex;
    flex-direction: column;
    gap: 40x;
    margin-bottom: 40px;
}

.tc-chart-box {

    /* Important for flex child with chart */

}

/* Style des titres au dessus des graphiques */
.tc-chart-box h3 {
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media print {
    body * {
        visibility: hidden;
    }

    #tc-main-container, #tc-main-container * {
        visibility: visible;
    }

    #tc-main-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        min-height: auto;
    }

    .tc-dashboard {
        padding: 0;
    }

    .tc-sidebar, .tc-tab-nav, .tc-actions, .tc-step, .tc-pane-title, .tc-export-tools, .tc-btn-export, .tc-tab-btn {
        display: none !important;
    }

    .tc-content-area, .tc-form-inner, .tc-layout-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        width: 100% !important;
    }

    .tc-chart-box {
        break-inside: avoid;
        height: 300px;
    }

    .tc-final-table th, .tc-final-table td {
        color: #000 !important;
        border-color: #ddd !important;
    }

    .tc-final-table thead {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .tc-final-table th {
        color: #000 !important;
    }

    .tc-chart-box h3 {
        display: none;
    }
}

/* Container for buttons */
.tc-export-tools {
    margin-top: 25px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* Base style for both buttons */
.tc-btn-export {
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Specific Style: Print Button (White/Gold Border) */
#btn-print {
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--gold-main);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

#btn-print:hover {
    border-color: var(--gold-main);
    background: #fdfdfd;
    transform: translateY(-2px);
}

/* Specific Style: Download CSV Button (Gold Gradient) */
#btn-download-csv {
    border: none;
    background: var(--gold-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--gold-glow);
}

#btn-download-csv:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px var(--gold-glow);
    opacity: 0.9;
}

/* Source text style */
.tc-source {
    margin-top: 15px;
    font-size: 13px;
    color: #666;
    font-style: italic;
    text-align: right;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

/* Print Media Query to hide buttons when printing */
@media print {
    .tc-export-tools, .tc-actions, .tc-sidebar, .tc-tab-nav {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .tc-chart-box {
        height: 400px;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .tc-chart-box {
        height: 450px !important;
        padding: 15px 10px;
        margin-bottom: 20px;
    }

    .tc-charts-wrapper {
        gap: 20px;
    }

    .tc-pane-title {
        font-size: 24px !important;
        margin-bottom: 15px;
    }

    .tc-final-table th {
        padding: 10px !important;
        font-size: 9px !important;
        /* Smaller headers */
    }

    .tc-final-table td {
        padding: 10px !important;
        font-size: 11px !important;
        /* Smaller cell text */
    }

    /* Target the first column (Critères) specifically */
    .tc-final-table td:first-child {
        font-size: 10px !important;
        min-width: 120px;
    }

    .tc-crit-children-grid {
        padding: 15px 10px !important;
        /* Small padding is better than zero for touch targets */
    }

    .tc-sidebar {
        flex: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 20px;
        margin-bottom: 20px;
    }

    .tc-stepper-vertical {
        flex-direction: row !important;
        /* Force horizontal */
        justify-content: space-around;
        align-items: flex-start;
        gap: 5px;
        position: relative;
    }

    .tc-stepper-vertical::before {
        display: none;
    }

    .tc-step {
        flex-direction: column;
        /* Stack dot above text */
        gap: 8px;
        flex: 1;
        text-align: center;
        opacity: 0.4;
    }

    .tc-step.active {
        opacity: 1;
    }

    .tc-step-dot {
        width: 30px;
        /* Smaller dots for mobile */
        height: 30px;
        font-size: 12px;
        margin: 0 auto;
    }

    .tc-step-label {
        font-size: 10px !important;
        /* Small, readable font */
        flex-direction: column;
        /* Stack icon and text */
        gap: 4px;
        justify-content: center;
        white-space: nowrap;
    }

    .tc-step-label svg {
        width: 14px;
        height: 14px;
    }

    /* 3. Adjust Pane Title for Mobile */
    .tc-pane-title {
        font-size: 22px !important;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .tc-chart-box {
        height: 700px !important;
        padding: 15px 5px !important;
        margin-bottom: 30px;
        display: block;
    }

    .tc-chart-box h3 {
        margin-bottom: 25px;
        font-size: 14px;
    }



    .tc-chart-box canvas {

        height: 100% !important;
        width: 100% !important;
        /* Ensures chart doesn't get too squashed */
    }


}

@media (max-width: 480px) {


    /* Adjust legend and labels for very small screens */
    .tc-chart-box canvas {
        min-width: 320px;
    }

    .tc-chart-box {
        height: 400px !important;
        padding: 10px 5px;
        border-radius: 16px;
    }

    .tc-results-view {
        overflow-x: hidden;
    }

    .tc-chart-box h3 {
        font-size: 12px !important;
        margin-bottom: 10px;
    }

    .tc-table-wrapper {
        margin-top: 20px;
    }

    .tc-step-label span {
        display: block;
    }

    .tc-step-label svg {
        display: none;
    }

    .tc-form-inner {
        padding: 20px 15px;
    }
}