/* ============================================================
   Module Déclaration IA — UI moderne v2 (hero + accordéons)
   ============================================================ */

/* ---------- Shell ---------- */
.decl-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ---------- HERO Banner ---------- */
.decl-hero {
    position: relative;
    border-radius: 18px;
    padding: 1.75rem 1.75rem 1.25rem;
    color: #fff;
    background: linear-gradient(135deg, #2C6BE0 0%, #4F63E6 55%, #6E5BE8 100%);
    box-shadow: 0 12px 32px -12px rgba(44, 107, 224, .45);
    overflow: hidden;
}
.decl-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 92% -10%, rgba(255,255,255,.18) 0, transparent 45%),
        radial-gradient(circle at 5% 110%, rgba(255,255,255,.12) 0, transparent 50%);
    pointer-events: none;
}
.decl-hero-inner {
    position: relative;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
}
.decl-hero-main { flex: 1 1 420px; min-width: 0; width: 100%; }
.decl-hero-title {
    font-size: clamp(1.25rem, 2.4vw, 1.75rem);
    line-height: 1.25;
    font-weight: 800;
    margin: 0 0 .6rem;
    display: block;
    letter-spacing: -.01em;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
.decl-hero-title .decl-hero-icon {
    display: inline-flex;
    width: 34px; height: 34px;
    align-items: center; justify-content: center;
    background: rgba(255,255,255,.18);
    border-radius: 10px;
    font-size: 1.05rem;
    backdrop-filter: blur(6px);
    margin-right: .55rem;
    vertical-align: middle;
}
.decl-hero-meta {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    font-size: .9rem;
    opacity: .95;
    margin-bottom: 1rem;
}
.decl-hero-meta span { display: inline-flex; gap: .35rem; align-items: center; }
.decl-hero-progress {
    height: 6px;
    background: rgba(255,255,255,.25);
    border-radius: 999px;
    overflow: hidden;
    margin-top: .35rem;
}
.decl-hero-progress-bar {
    height: 100%;
    background: #fff;
    border-radius: 999px;
    transition: width .35s ease;
    box-shadow: 0 0 8px rgba(255,255,255,.6);
}
.decl-hero-progress-label {
    font-size: .82rem;
    margin-top: .5rem;
    opacity: .92;
}
.decl-hero-actions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    flex-shrink: 0;
}
.decl-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    border: none;
    transition: transform .15s ease, background .2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.decl-hero-btn.ghost {
    background: rgba(255,255,255,.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,.35);
}
.decl-hero-btn.ghost:hover { background: rgba(255,255,255,.25); }
.decl-hero-btn.primary {
    background: #fff;
    color: #1E3A8A;
}
.decl-hero-btn.primary:hover { transform: translateY(-1px); }
.decl-hero-btn:disabled { opacity: .6; cursor: not-allowed; }
.decl-hero-saved {
    position: relative;
    display: inline-block;
    margin-top: .75rem;
    font-size: .78rem;
    opacity: .9;
}

/* ---------- Accordéons ---------- */
.decl-acc {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px -16px rgba(15,23,42,.15);
    border: 1px solid #EEF1F5;
    overflow: hidden;
    transition: box-shadow .2s ease;
}
.decl-acc:hover { box-shadow: 0 2px 4px rgba(15,23,42,.05), 0 12px 32px -16px rgba(15,23,42,.2); }
.decl-acc[open] { box-shadow: 0 2px 6px rgba(15,23,42,.06), 0 16px 40px -20px rgba(44,107,224,.25); }

.decl-acc-summary {
    list-style: none;
    cursor: pointer;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .85rem;
    background: #F8FAFC;
    border-bottom: 1px solid transparent;
    transition: background .15s ease;
    user-select: none;
}
.decl-acc[open] > .decl-acc-summary {
    background: #fff;
    border-bottom-color: #EEF1F5;
}
.decl-acc-summary::-webkit-details-marker { display: none; }
.decl-acc-summary:hover { background: #F1F5F9; }
.decl-acc[open] > .decl-acc-summary:hover { background: #FAFBFC; }

.decl-acc-chevron {
    width: 18px; height: 18px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%232C6BE0'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%232C6BE0' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: transform .25s ease;
    transform: rotate(-90deg);
}
.decl-acc[open] > .decl-acc-summary .decl-acc-chevron { transform: rotate(0deg); }

.decl-acc-status {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .28rem .7rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.decl-acc-status.done { background: #E8F7EE; color: #16794C; }
.decl-acc-status.todo { background: #F1F5F9; color: #64748B; }
.decl-acc-status.optional { background: #EEF2FF; color: #4F46E5; }

.decl-acc-title {
    flex: 1;
    font-weight: 700;
    color: #0F172A;
    font-size: 1rem;
    min-width: 0;
}

.decl-acc-badge {
    display: inline-flex;
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.decl-acc-badge.required { background: #FEE2E2; color: #B91C1C; }
.decl-acc-badge.optional { background: #F1F5F9; color: #475569; }

.decl-acc-body {
    padding: 1.25rem 1.5rem 1.5rem;
    animation: declFade .25s ease;
}
@keyframes declFade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Grille formulaire ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* ---------- Sous-titres section ---------- */
.sub-h {
    color: #1E3A8A;
    font-size: .98rem;
    font-weight: 700;
    margin: 1.35rem 0 .6rem;
    letter-spacing: -.005em;
}
.sub-h:first-child { margin-top: 0; }

/* ---------- Radio cards ---------- */
.radio-stack { display: grid; gap: .75rem; }
.radio-card {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: 1rem 1.15rem;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s ease;
    background: #fff;
}
.radio-card input { margin-top: .2rem; accent-color: #2C6BE0; }
.radio-card small { display: block; color: #64748B; margin-top: .25rem; font-size: .82rem; }
.radio-card.active {
    border-color: #2C6BE0;
    background: #F0F5FF;
    box-shadow: 0 0 0 3px rgba(44,107,224,.12);
}

/* ---------- Check lines ---------- */
.check-line {
    display: flex;
    gap: .6rem;
    padding: .5rem .75rem;
    border-radius: 8px;
    align-items: flex-start;
    cursor: pointer;
    transition: background .15s;
}
.check-line:hover { background: #F8FAFC; }
.check-line input { margin-top: .25rem; accent-color: #2C6BE0; }
.check-line.strong {
    background: #F0F5FF;
    border: 1px solid #DBE5FA;
    padding: .8rem 1rem;
    font-weight: 500;
}

/* ---------- Hint (definitions) ---------- */
.hint-box {
    margin-top: .85rem;
    padding: .65rem .9rem;
    background: #F8FAFC;
    border: 1px dashed #CBD5E1;
    border-radius: 10px;
    font-size: .85rem;
    color: #475569;
}
.hint-box summary { cursor: pointer; font-weight: 600; color: #334155; }
.hint-box ul { margin: .5rem 0 0; padding-left: 1.1rem; }
.hint-box li { margin: .2rem 0; }

/* ---------- Boutons compacts ---------- */
.btn-mini {
    padding: .35rem .7rem;
    border-radius: 8px;
    border: none;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: .85rem;
    min-height: 34px;
    min-width: 34px;
}
.btn-mini.danger { background: #FEE2E2; color: #B91C1C; }
.btn-mini.danger:hover { background: #FCA5A5; color: #7F1D1D; }
.btn-mini.success { background: #DCFCE7; color: #15803D; }

.btn-add {
    margin-top: .85rem;
    padding: .55rem 1rem;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #2C6BE0, #4F63E6);
    color: #fff;
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
    box-shadow: 0 4px 12px -4px rgba(44,107,224,.5);
    transition: transform .15s ease;
}
.btn-add:hover { transform: translateY(-1px); }

/* ---------- Footer actions ---------- */
.decl-footer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: flex-end;
    padding: 1rem 0 .5rem;
}
.decl-btn {
    padding: .7rem 1.4rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: .95rem;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease;
}
.decl-btn.ghost {
    background: #F1F5F9;
    color: #334155;
    border: 1px solid #E2E8F0;
}
.decl-btn.ghost:hover { background: #E2E8F0; }
.decl-btn.primary {
    background: linear-gradient(135deg, #2C6BE0, #4F63E6);
    color: #fff;
    box-shadow: 0 6px 18px -6px rgba(44,107,224,.55);
}
.decl-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -8px rgba(44,107,224,.7); }
.decl-btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

/* ---------- Divers ---------- */
.form-control-uac.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .decl-hero { padding: 1rem; border-radius: 12px; }
    .decl-hero-title {
        font-size: clamp(1rem, 5.5vw, 1.35rem);
        line-height: 1.3;
    }
    .decl-hero-title .decl-hero-icon {
        width: 30px; height: 30px;
        font-size: .95rem;
        margin-right: .45rem;
    }
    .decl-hero-meta {
        gap: .65rem;
        font-size: .82rem;
        margin-bottom: .85rem;
    }
    .decl-hero-progress-label { font-size: .75rem; }
    .decl-hero-actions { width: 100%; flex-direction: column; gap: .5rem; margin-top: .75rem; }
    .decl-hero-btn { width: 100%; justify-content: center; white-space: normal; font-size: .85rem; }
    .decl-hero-saved { font-size: .72rem; }
    .decl-acc-summary { padding: .85rem 1rem; gap: .6rem; flex-wrap: wrap; }
    .decl-acc-title { flex: 1 1 100%; order: 3; margin-top: .25rem; }
    .decl-acc-badge { order: 2; }
    .decl-acc-body { padding: 1rem 1rem 1.2rem; }
    .decl-footer-actions { flex-direction: column-reverse; }
    .decl-btn { width: 100%; }
}

/* ============================================================
   INPUTS MODERNES SLIM — override .form-control-uac & labels
   À concaténer à la fin de public/assets/css/app.css
   (ou charger declaration.css après app.css)
   ============================================================ */

.decl-shell,
.decl-shell input,
.decl-shell select,
.decl-shell textarea,
.decl-shell button,
.decl-shell label {
    font-family: "Inter","DM Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
}

/* Labels */
.decl-shell .form-label {
    display: block;
    font-size: .74rem;
    font-weight: 500;
    color: #4b5568;
    margin-bottom: .35rem;
    letter-spacing: 0;
}
.decl-shell .form-required::after {
    content: " *";
    color: #E85D3A;
    font-weight: 500;
}

/* Inputs, selects, textareas — style slim */
.decl-shell .form-control-uac {
    width: 100%;
    display: block;
    box-sizing: border-box;
    padding: .55rem .8rem;
    font-size: .84rem;
    font-weight: 400;
    line-height: 1.4;
    color: #1A3560;
    background: #fff;
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 27, 61, .03);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}
.decl-shell .form-control-uac::placeholder {
    color: #a3adbf;
    font-weight: 400;
}
.decl-shell .form-control-uac:hover:not(:disabled):not([readonly]) {
    border-color: #c5cddc;
}
.decl-shell .form-control-uac:focus {
    border-color: #2C6BE0;
    box-shadow: 0 0 0 3px rgba(44, 107, 224, .12);
    background: #fff;
}
.decl-shell .form-control-uac[readonly],
.decl-shell .form-control-uac:disabled {
    background: #f5f7fb;
    color: #6b7280;
    cursor: default;
    box-shadow: none;
    border-color: #eceff5;
}

/* Textarea */
.decl-shell textarea.form-control-uac {
    min-height: 92px;
    resize: vertical;
    line-height: 1.55;
    font-size: .83rem;
}

/* Select — chevron custom SVG */
.decl-shell select.form-control-uac,
.decl-shell select.form-control-uac.form-select {
    padding-right: 2.4rem !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position: right .85rem center !important;
    background-size: 12px 12px !important;
    cursor: pointer;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}
.decl-shell select.form-control-uac:focus {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%232C6BE0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") !important;
}
/* Neutralise le chevron IE/Edge legacy */
.decl-shell select.form-control-uac::-ms-expand { display: none; }

/* Input mono (UUID etc.) */
.decl-shell .form-control-uac.mono {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .76rem;
    letter-spacing: 0;
    color: #4b5568;
}

/* Date input */
.decl-shell input[type="date"].form-control-uac {
    font-variant-numeric: tabular-nums;
}

/* Error text */
.decl-shell .form-error {
    margin-top: .3rem;
    font-size: .72rem;
    color: #E85D3A;
    font-weight: 500;
    letter-spacing: 0;
}

/* Tables (répétables) — inputs plus compacts */
.decl-shell table .form-control-uac {
    padding: .4rem .6rem;
    font-size: .78rem;
    border-radius: 6px;
}

/* Grille formulaire — respire plus */
.decl-shell .form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .95rem 1rem;
}
.decl-shell .form-grid .form-group.full { grid-column: 1 / -1; }
@media (max-width: 640px) {
    .decl-shell .form-grid { grid-template-columns: 1fr; gap: .8rem; }
}

/* Checkboxes / radios natifs — accent moderne */
.decl-shell input[type="checkbox"],
.decl-shell input[type="radio"] {
    accent-color: #2C6BE0;
    cursor: pointer;
}

/* ============================================================
   MODALE DE CONFIRMATION MODERNE
   ============================================================ */
.decl-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(4px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: decl-modal-fade .2s ease;
}
.decl-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .35);
    max-width: 420px;
    width: 100%;
    padding: 1.75rem 1.5rem 1.5rem;
    text-align: center;
    animation: decl-modal-scale .25s ease;
}
.decl-modal-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #EAF2FF 0%, #D6E5FF 100%);
    color: #2C6BE0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.decl-modal-icon svg { width: 28px; height: 28px; }
.decl-modal-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0F172A;
    margin: 0 0 .5rem;
    letter-spacing: -.01em;
}
.decl-modal-text {
    font-size: .94rem;
    color: #475569;
    line-height: 1.55;
    margin: 0 0 1.5rem;
}
.decl-modal-actions {
    display: flex;
    gap: .75rem;
    justify-content: center;
    flex-wrap: wrap;
}
.decl-modal-btn {
    border: none;
    border-radius: 10px;
    padding: .7rem 1.25rem;
    font-size: .94rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .2s ease, filter .2s ease, background .2s ease;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.decl-modal-btn:hover { transform: translateY(-1px); }
.decl-modal-btn.primary {
    background: linear-gradient(135deg, #2C6BE0 0%, #4F63E6 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(44, 107, 224, .35);
}
.decl-modal-btn.primary:hover { filter: brightness(1.08); box-shadow: 0 6px 18px rgba(44, 107, 224, .45); }
.decl-modal-btn.ghost {
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #E2E8F0;
}
.decl-modal-btn.ghost:hover { background: #E2E8F0; }

@media (max-width: 480px) {
    .decl-modal { padding: 1.5rem 1.25rem 1.25rem; border-radius: 14px; }
    .decl-modal-title { font-size: 1.05rem; }
    .decl-modal-text { font-size: .88rem; }
    .decl-modal-btn { width: 100%; min-width: auto; }
    .decl-modal-actions { flex-direction: column; gap: .5rem; }
}

@keyframes decl-modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes decl-modal-scale {
    from { opacity: 0; transform: scale(.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* Variantes d'icône pour la modale d'alerte */
.decl-modal-icon.info {
    background: linear-gradient(135deg, #EAF2FF 0%, #D6E5FF 100%);
    color: #2C6BE0;
}
.decl-modal-icon.success {
    background: linear-gradient(135deg, #E6F9F0 0%, #CFF5E4 100%);
    color: #16A34A;
}
.decl-modal-icon.error {
    background: linear-gradient(135deg, #FFF0EB 0%, #FFDCD4 100%);
    color: #E85D3A;
}
