/* ============================================================
   Team Builder — Styles complémentaires au Design System SPW
   ============================================================ */

/* ---- Layout principal ---- */

.team-main {
    min-height: 60vh;
    padding: 2.5rem 1rem 5rem;
    background-color: #f5f7fa;
}

.team-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ---- Suppression menu burger mobile ---- */

spw-header::part(hamburger),
spw-header::part(nav-toggle) {
    display: none !important;
}

/* ---- En-tête de page ---- */

.team-page-header {
    margin-bottom: 2.5rem;
}

.team-page-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--spw-ds-primary-900, #003d73);
    margin: 0 0 0.625rem;
    line-height: 1.25;
}

.team-page-intro {
    font-size: 1rem;
    color: #4a5568;
    max-width: 780px;
    margin: 0;
    line-height: 1.6;
}

.team-step-intro {
    font-size: .875rem;
    color: #4a5568;
    margin: 0 0 1.25rem;
    line-height: 1.6;
}

/* ---- Wizard ---- */

spw-wizard {
    display: block;
    margin-bottom: 2rem;
}

/* ---- Zone de contenu (wrapper unique, une seule box blanche) ---- */

.team-step-content {
    background: #ffffff;
    border: 1px solid #dde3ec;
    border-radius: 8px;
    padding: 2.5rem;
    margin-bottom: 1.75rem;
    min-height: 320px;
}

/* ---- Panneaux individuels (montrés/cachés) ---- */

.team-step-panel {
    /* hérite du wrapper */
}

/* ---- Sections de formulaire ---- */

.team-form-section {
    padding: 1.75rem 0;
    border-bottom: 1px solid #eef1f7;
}

.team-form-section--last {
    border-bottom: none;
    padding-bottom: 0.25rem;
}

.team-section-subtitle {
    display: block;
    font-size: .875rem;
    font-weight: 700;
    color: var(--spw-ds-primary-900, #003d73);
    margin: 0 0 1.25rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--spw-ds-primary-900, #003d73);
}

.team-section-subtitle .fa {
    margin-right: .4rem;
}

/* ---- Grille de formulaire (2 colonnes) ---- */

.team-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 2rem;
    align-items: start;
}

.team-form-grid--3col {
    grid-template-columns: 1fr 1fr 1fr;
}

.team-form-col {
    min-width: 0;
}

.team-form-col--full {
    grid-column: 1 / -1;
}

/* ---- Labels ---- */

.team-group-label {
    margin: 0 0 .375rem;
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: #3a4554;
}

.team-required {
    color: #b00020;
}

/* ---- Inputs natifs ---- */

.team-native-select {
    display: block;
    width: 100%;
    padding: .5rem 2rem .5rem .75rem;
    border: 1px solid #c8d2e0;
    border-radius: 4px;
    font-size: .875rem;
    font-family: inherit;
    color: inherit;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234a5568'/%3E%3C/svg%3E") no-repeat right .75rem center;
    background-size: 10px 6px;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    cursor: pointer;
}

.team-native-select:focus {
    outline: 2px solid var(--spw-ds-primary-900, #003d73);
    outline-offset: 2px;
    border-color: var(--spw-ds-primary-900, #003d73);
}

.team-native-input,
.team-native-textarea {
    display: block;
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid #c8d2e0;
    border-radius: 4px;
    font-size: .875rem;
    font-family: inherit;
    color: inherit;
    background: #fff;
    box-sizing: border-box;
}

.team-native-input:focus,
.team-native-textarea:focus {
    outline: 2px solid var(--spw-ds-primary-900, #003d73);
    outline-offset: 2px;
    border-color: var(--spw-ds-primary-900, #003d73);
}

.team-native-textarea {
    resize: vertical;
    min-height: 4rem;
}

.team-native-input--count {
    width: 110px;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
}

.team-field-hint {
    display: block;
    font-size: .78rem;
    color: #9aa5b4;
    margin-top: .25rem;
}

/* ================================================================
   ÉTAPE 2 — EXIGENCES FONCTIONNELLES
   ================================================================ */

/* En-tête des colonnes */
.team-req-header,
.team-req-row {
    display: grid;
    grid-template-columns: 28px 1fr 130px 100px 80px 78px;
    gap: .5rem;
    align-items: center;
    padding: .375rem .25rem;
}

.team-req-header {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7a8d;
    border-bottom: 2px solid #eef1f7;
    padding-bottom: .5rem;
    margin-bottom: .25rem;
}

.team-req-row {
    border-bottom: 1px solid #f0f3f8;
}

.team-req-row:hover {
    background: #f8f9fc;
    border-radius: 4px;
}

.team-req-col-num {
    text-align: center;
    font-size: .8rem;
    color: #9aa5b4;
    font-weight: 600;
}

.team-req-col-estimate,
.team-req-col-adjusted {
    text-align: center;
}

.team-req-col-adjusted {
    font-weight: 700;
    color: var(--spw-ds-primary-900, #003d73);
}

/* Colonne actions (✨ + ×) */
.team-req-col-actions {
    display: flex;
    gap: .25rem;
    align-items: center;
}

/* Bouton supprimer une ligne */
.team-person-remove {
    background: none;
    border: 1px solid #c8d2e0;
    border-radius: 4px;
    width: 1.75rem;
    height: 1.75rem;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: #4a5568;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.team-person-remove:hover {
    background: #fee2e2;
    border-color: #b00020;
    color: #b00020;
}

/* Barre d'actions (ajouter + estimer tout) */
.team-req-actions-bar {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: .75rem;
}

/* Bouton "Ajouter une ligne" */
.team-add-row-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: .75rem;
    padding: .45rem .9rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--spw-ds-primary-700, #0059a5);
    background: transparent;
    border: 1.5px solid var(--spw-ds-primary-700, #0059a5);
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.team-add-row-btn:hover {
    background: var(--spw-ds-primary-700, #0059a5);
    color: #fff;
}

/* Bouton "Estimer tout avec Claude" */
.team-estimate-all-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .9rem;
    font-size: .85rem;
    font-weight: 600;
    color: #6d28d9;
    background: transparent;
    border: 1.5px solid #6d28d9;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.team-estimate-all-btn:hover {
    background: #6d28d9;
    color: #fff;
}
.team-estimate-all-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Bouton ✨ par ligne */
.team-estimate-btn {
    background: none;
    border: 1px solid #c4b5fd;
    border-radius: 4px;
    width: 1.75rem;
    height: 1.75rem;
    cursor: pointer;
    font-size: .9rem;
    line-height: 1;
    color: #6d28d9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .12s;
}
.team-estimate-btn:hover { background: #ede9fe; }
.team-estimate-btn:disabled { opacity: .4; cursor: wait; }

/* Note Claude sous la ligne */
.team-req-claude-note {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    background: #f5f3ff;
    border: 1px solid #c4b5fd;
    border-radius: 4px;
    padding: .4rem .75rem;
    font-size: .82rem;
    color: #4c1d95;
    margin: .1rem 0 .35rem;
}
.team-req-claude-note .fa-robot { flex-shrink: 0; margin-top: .1rem; }

/* Totaux */
.team-req-totals {
    display: flex;
    gap: 2rem;
    justify-content: flex-end;
    padding: 1rem 0 .25rem;
    border-top: 2px solid #eef1f7;
    margin-top: 1rem;
}

.team-req-totals__item {
    text-align: right;
}

.team-req-totals__label {
    font-size: .78rem;
    color: #6b7a8d;
    display: block;
}

.team-req-totals__value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #4a5568;
}

.team-req-totals__value--primary {
    color: var(--spw-ds-primary-900, #003d73);
    font-size: 1.35rem;
}

/* Badges de complexité */
.team-complexity-badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 10px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

.team-complexity-badge--faible {
    background: #d1fae5;
    color: #065f46;
}

.team-complexity-badge--moyenne {
    background: #fef3c7;
    color: #92400e;
}

.team-complexity-badge--elevee {
    background: #fee2e2;
    color: #991b1b;
}

/* ================================================================
   ÉTAPE 3 — SYNTHÈSE DE CHARGE
   ================================================================ */

.team-calc-summary {
    margin-top: 2rem;
    background: #f0f5fb;
    border: 1px solid #c8d2e0;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
}

.team-calc-summary__title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--spw-ds-primary-900, #003d73);
    margin-bottom: 1rem;
}

.team-calc-summary__title .fa {
    margin-right: .4rem;
}

.team-calc-grid {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

.team-calc-item {
    flex: 1;
    min-width: 120px;
    background: #fff;
    border: 1px solid #dde3ec;
    border-radius: 6px;
    padding: .75rem 1rem;
    text-align: center;
}

.team-calc-item--primary {
    background: var(--spw-ds-primary-900, #003d73);
    border-color: var(--spw-ds-primary-900, #003d73);
    color: #fff;
}

.team-calc-item__label {
    font-size: .72rem;
    color: #6b7a8d;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.team-calc-item--primary .team-calc-item__label {
    color: rgba(255, 255, 255, .7);
}

.team-calc-item__value {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: .25rem;
}

/* ================================================================
   ÉTAPE 4 — COMPOSITION D'ÉQUIPE
   ================================================================ */

/* Barre de stats */
.team-stats-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.team-stat {
    flex: 1;
    min-width: 130px;
    background: #f7f9fb;
    border: 1px solid #dde3ec;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-align: center;
}

.team-stat__value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--spw-ds-primary-900, #003d73);
    line-height: 1.1;
}

.team-stat__label {
    font-size: .75rem;
    color: #6b7a8d;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-top: .3rem;
}

/* Grille suggestion (input + suggestion text) */
.team-suggestion-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
    align-items: center;
}

.team-suggestion {
    padding-left: .5rem;
}

.team-suggestion-text {
    display: inline-block;
    font-size: .85rem;
    color: #4a5568;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: .45rem .85rem;
    line-height: 1.5;
}

.team-suggestion-text .fa {
    color: #d97706;
    margin-right: .3rem;
}

/* Timeline */
.team-timeline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
    margin-top: .75rem;
}

.team-timeline-table th {
    background: #eef1f7;
    color: var(--spw-ds-primary-900, #003d73);
    font-weight: 700;
    padding: .5rem .85rem;
    text-align: left;
    border: 1px solid #c8d2e0;
}

.team-timeline-table td {
    padding: .5rem .85rem;
    border: 1px solid #c8d2e0;
    vertical-align: middle;
}

.team-timeline-total td {
    font-weight: 700;
    background: #eef1f7 !important;
}

.team-timeline-phase-bar {
    display: flex;
    height: 14px;
    border-radius: 3px;
    overflow: hidden;
    background: #e2e8f0;
    min-width: 60px;
}

.team-timeline-phase-bar__fill {
    height: 100%;
}

/* ================================================================
   ÉTAPE 5 — RÉCAPITULATIF
   ================================================================ */

.team-recap-section {
    margin-bottom: 2rem;
}

.team-recap-heading {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--spw-ds-primary-900, #003d73);
    border-bottom: 2px solid var(--spw-ds-primary-700, #005f9e);
    padding-bottom: .4rem;
    margin: 0 0 .75rem;
}

.team-recap-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--spw-ds-primary-700, #005f9e);
    color: #fff;
    border-radius: 50%;
    font-size: .75rem;
    flex-shrink: 0;
}

.team-recap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.team-recap-table th {
    width: 42%;
    text-align: left;
    font-weight: 600;
    padding: .35rem .75rem .35rem 0;
    color: #4a5568;
    vertical-align: top;
}

.team-recap-table td {
    padding: .35rem 0;
    color: #111;
    vertical-align: top;
}

.team-recap-table tr:not(:last-child) th,
.team-recap-table tr:not(:last-child) td {
    border-bottom: 1px solid #edf0f4;
}

/* Table des exigences dans le recap */
.team-recap-req-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

.team-recap-req-table th {
    background: #eef1f7;
    color: var(--spw-ds-primary-900, #003d73);
    font-weight: 700;
    padding: .4rem .75rem;
    text-align: left;
    border: 1px solid #dde3ec;
}

.team-recap-req-table td {
    padding: .4rem .75rem;
    border: 1px solid #dde3ec;
    vertical-align: middle;
}

.team-recap-req-table tbody tr:nth-child(even) td {
    background: #f8f9fc;
}

/* Bloc d'équipe dans le recap */
.team-recap-team-box {
    background: #f0f5fb;
    border: 1px solid #c8d2e0;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.team-recap-team-box__title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--spw-ds-primary-900, #003d73);
    margin: 0 0 .75rem;
}

/* ================================================================
   BARRE DE SAUVEGARDE
   ================================================================ */

.team-save-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    padding: .5rem 0 .75rem;
    border-bottom: 1px solid #e0e6ee;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.team-save-bar__status {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    color: #1a7a4a;
    font-weight: 600;
    margin-right: auto;
}

.team-save-bar__actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ================================================================
   NAVIGATION DU WIZARD
   ================================================================ */

.team-wizard-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

/* ================================================================
   OVERLAY DE CHARGEMENT PDF
   ================================================================ */

#pdf-loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 25, 60, .55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pdf-loader-overlay[hidden] { display: none !important; }

.pdf-loader-box {
    background: #fff;
    border-radius: 8px;
    padding: 2rem 2.5rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
    min-width: 220px;
}

.pdf-loader-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid var(--spw-ds-primary-100, #cce0f5);
    border-top-color: var(--spw-ds-primary-700, #0059a5);
    border-radius: 50%;
    margin: 0 auto .75rem;
    animation: pdf-spin .8s linear infinite;
}

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

.pdf-loader-text {
    font-size: .9rem;
    font-weight: 600;
    color: var(--spw-ds-primary-900, #003d73);
    margin: 0;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 900px) {
    .team-req-header,
    .team-req-row {
        grid-template-columns: 24px 1fr 110px 85px 70px 72px;
    }
}

@media (max-width: 768px) {
    .team-main { padding: 1.5rem .5rem 4rem; }
    .team-container { padding: 0 1rem; }
    .team-page-header h1 { font-size: 1.5rem; }
    .team-step-content { padding: 1.5rem; }

    .team-form-grid,
    .team-form-grid--3col { grid-template-columns: 1fr; }
    .team-form-col--full { grid-column: 1; }

    .team-suggestion-grid { grid-template-columns: 1fr; }

    .team-req-header,
    .team-req-row {
        grid-template-columns: 24px 1fr 95px 80px 70px 32px;
        font-size: .8rem;
    }

    .team-calc-grid { flex-direction: column; }
    .team-calc-item { min-width: unset; }

    .team-stats-bar { flex-direction: column; }
}

@media (max-width: 480px) {
    .team-page-header h1 { font-size: 1.25rem; }
    .team-step-content { padding: 1.25rem; min-height: 240px; }
    .team-wizard-nav { flex-direction: column-reverse; align-items: stretch; }

    .team-req-header { display: none; }
    .team-req-row {
        grid-template-columns: 1fr auto auto;
        grid-template-rows: auto auto;
        gap: .35rem;
        padding: .75rem .25rem;
        border-bottom: 2px solid #eef1f7;
    }
    .team-req-col-label { grid-column: 1 / -1; }
    .team-req-col-num { display: none; }
    .team-req-col-adjusted { font-size: .8rem; }
}

/* ================================================================
   IMPRESSION / EXPORT PDF
   ================================================================ */

@media print {
    spw-header,
    spw-footer-bottom,
    spw-wizard,
    .team-wizard-nav,
    .team-save-bar,
    .team-page-intro,
    .team-step-panel[data-step="1"],
    .team-step-panel[data-step="2"],
    .team-step-panel[data-step="3"],
    .team-step-panel[data-step="4"] {
        display: none !important;
    }

    .team-step-panel[data-step="5"] {
        display: block !important;
    }

    body { font-size: 10pt; background: white; }

    .team-main { padding: 0; background: white; min-height: 0; }
    .team-container { max-width: 100%; padding: 0; }
    .team-step-content { border: none; padding: 0; min-height: 0; margin: 0; }
    .team-page-header { margin-bottom: .75rem; }
    .team-page-header h1 { font-size: 1rem; margin-bottom: .2rem; }

    .team-recap-section { page-break-inside: avoid; margin-bottom: 1rem; }

    .team-recap-heading {
        color: #003d73 !important;
        border-bottom-color: #003d73 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .team-recap-num {
        background: #003d73 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .team-calc-item--primary {
        background: #003d73 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    a::after { content: none !important; }
}
