/*
|--------------------------------------------------------------------------
| Fromapp — Mes demandes
|--------------------------------------------------------------------------
*/

:root {
    --md-blue: #1d4ed8;
    --md-blue-dark: #1e3a8a;
    --md-blue-soft: #eff6ff;
    --md-text: #172033;
    --md-muted: #64748b;
    --md-border: #dbe3ee;
    --md-bg: #f3f6fb;

    --md-success: #15803d;
    --md-success-soft: #ecfdf3;
    --md-warning: #b45309;
    --md-warning-soft: #fff7ed;
    --md-danger: #b91c1c;
    --md-danger-soft: #fef2f2;
    --md-gray-soft: #f8fafc;

    --md-radius: 16px;
    --md-shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
    --md-transition: 160ms ease;
}


/*
|--------------------------------------------------------------------------
| Base
|--------------------------------------------------------------------------
*/

html.auth-locked body {
    overflow: hidden;
}

html.denied body {
    display: none !important;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;

    background:
        radial-gradient(
            circle at 10% 0%,
            rgba(37, 99, 235, 0.09),
            transparent 30%
        ),
        var(--md-bg);

    color: var(--md-text);

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.20);
    outline-offset: 2px;
}


/*
|--------------------------------------------------------------------------
| Header
|--------------------------------------------------------------------------
*/

.fa-header {
    position: sticky;
    top: 0;
    z-index: 80;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    padding: 17px clamp(18px, 4vw, 42px);

    border-bottom: 1px solid rgba(203, 213, 225, 0.75);

    background: rgba(255, 255, 255, 0.82);

    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.05);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.fa-header-left h1 {
    margin: 0;

    color: var(--md-blue);

    font-size: clamp(23px, 3vw, 33px);
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.fa-header-sub {
    margin: 7px 0 0;

    color: var(--md-muted);

    font-size: 14px;
    line-height: 1.4;
}

.fa-header-right {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-header {
    min-height: 41px;
    padding: 8px 13px;

    border: 1px solid #bfdbfe;
    border-radius: 12px;

    background: rgba(239, 246, 255, 0.90);
    color: var(--md-blue-dark);

    font-size: 12px;
    font-weight: 800;

    transition:
        transform var(--md-transition),
        background var(--md-transition);
}

.btn-header:hover {
    background: #dbeafe;
    transform: translateY(-1px);
}


/*
|--------------------------------------------------------------------------
| Main
|--------------------------------------------------------------------------
*/

.fa-main {
    width: min(1180px, calc(100% - 30px));

    margin: 0 auto;
    padding: 27px 0 46px;
}


/*
|--------------------------------------------------------------------------
| Welcome
|--------------------------------------------------------------------------
*/

.welcome-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    margin-bottom: 18px;
    padding: 20px 22px;

    border: 1px solid var(--md-border);
    border-radius: 21px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.98),
            rgba(239, 246, 255, 0.94)
        );

    box-shadow: var(--md-shadow);
}

.welcome-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.welcome-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    width: 56px;
    height: 56px;

    border: 1px solid #bfdbfe;
    border-radius: 18px;

    background: var(--md-blue-soft);
    color: var(--md-blue);

    font-size: 26px;
}

.welcome-label {
    display: block;

    color: var(--md-muted);

    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.welcome-card h2 {
    margin: 3px 0 0;

    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.025em;
}

.welcome-card p {
    margin: 5px 0 0;

    color: var(--md-muted);

    font-size: 13px;
    line-height: 1.4;
}


/*
|--------------------------------------------------------------------------
| Boutons
|--------------------------------------------------------------------------
*/

.btn-primary,
.btn-secondary,
.btn-danger {
    min-height: 41px;
    padding: 8px 14px;

    border-radius: 11px;

    font-size: 13px;
    font-weight: 850;

    transition:
        transform var(--md-transition),
        filter var(--md-transition),
        box-shadow var(--md-transition);
}

.btn-large {
    min-height: 46px;
    padding-inline: 18px;
}

.btn-primary {
    border: 1px solid #1d4ed8;

    background: linear-gradient(145deg, #2563eb, #1d4ed8);
    color: #ffffff;

    box-shadow: 0 8px 18px rgba(29, 78, 216, 0.20);
}

.btn-secondary {
    border: 1px solid var(--md-border);

    background: #ffffff;
    color: #334155;
}

.btn-danger {
    border: 1px solid #dc2626;

    background: linear-gradient(145deg, #ef4444, #dc2626);
    color: #ffffff;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}


/*
|--------------------------------------------------------------------------
| Résumé
|--------------------------------------------------------------------------
*/

.resume-demandes {
    display: grid;

    grid-template-columns:
        repeat(5, minmax(0, 1fr));

    gap: 11px;

    margin-bottom: 18px;
}

.resume-card {
    padding: 14px 15px;

    border: 1px solid var(--md-border);
    border-radius: 14px;

    background: #ffffff;

    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.05);
}

.resume-card span {
    display: block;

    color: var(--md-muted);

    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.resume-card strong {
    display: block;

    margin-top: 8px;

    color: var(--md-blue);

    font-size: 27px;
    font-weight: 900;
    line-height: 1;
}

.resume-attente strong {
    color: var(--md-warning);
}

.resume-approuvees strong {
    color: var(--md-success);
}

.resume-refusees strong {
    color: var(--md-danger);
}

.resume-annulees strong {
    color: #64748b;
}


/*
|--------------------------------------------------------------------------
| Carte historique
|--------------------------------------------------------------------------
*/

.fa-card {
    overflow: hidden;

    border: 1px solid var(--md-border);
    border-radius: 21px;

    background: rgba(255, 255, 255, 0.95);

    box-shadow: var(--md-shadow);
}

.fa-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    padding: 18px 20px;

    border-bottom: 1px solid var(--md-border);

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.98),
            rgba(248, 250, 252, 0.92)
        );
}

.fa-card-header h2 {
    margin: 0;

    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.fa-card-subtitle {
    margin: 4px 0 0;

    color: var(--md-muted);

    font-size: 12px;
}

.fa-card-body {
    padding: 20px;
}


/*
|--------------------------------------------------------------------------
| Filtres
|--------------------------------------------------------------------------
*/

.mes-demandes-filters {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr))
        auto;

    gap: 11px;

    margin-bottom: 18px;
    padding: 14px;

    border: 1px solid var(--md-border);
    border-radius: var(--md-radius);

    background: var(--md-gray-soft);
}

.fa-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.fa-form-field label {
    color: #475569;

    font-size: 11px;
    font-weight: 800;
}

.fa-form-field input,
.fa-form-field select,
.fa-form-field textarea {
    width: 100%;
    min-height: 41px;
    padding: 8px 10px;

    border: 1px solid #cbd5e1;
    border-radius: 10px;

    background: #ffffff;
    color: var(--md-text);

    font-size: 13px;

    transition:
        border-color var(--md-transition),
        box-shadow var(--md-transition);
}

.fa-form-field textarea {
    min-height: 96px;
    resize: vertical;
}

.fa-form-field input:focus,
.fa-form-field select:focus,
.fa-form-field textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.10);
}

.fa-form-actions {
    display: flex;
    align-items: end;
}

.form-grid {
    display: grid;
    gap: 13px;
}

.form-grid-2 {
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
}

.fa-help-text {
    color: var(--md-muted);

    font-size: 11px;
    line-height: 1.4;
}


/*
|--------------------------------------------------------------------------
| Timeline
|--------------------------------------------------------------------------
*/

.timeline-demandes {
    position: relative;

    display: flex;
    flex-direction: column;
    gap: 14px;

    padding-left: 28px;
}

.timeline-demandes::before {
    content: '';

    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 9px;

    width: 2px;

    background: #dbeafe;
}

.timeline-item {
    position: relative;

    padding: 16px;

    border: 1px solid var(--md-border);
    border-radius: 15px;

    background: #ffffff;

    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.05);

    transition:
        transform var(--md-transition),
        box-shadow var(--md-transition),
        border-color var(--md-transition);
}

.timeline-item:hover {
    border-color: #bfdbfe;

    box-shadow: 0 11px 24px rgba(15, 23, 42, 0.08);

    transform: translateY(-1px);
}

.timeline-marker {
    position: absolute;
    top: 20px;
    left: -27px;

    width: 18px;
    height: 18px;

    border: 4px solid #ffffff;
    border-radius: 999px;

    background: var(--md-blue);

    box-shadow:
        0 0 0 2px #bfdbfe,
        0 4px 10px rgba(29, 78, 216, 0.16);
}

.timeline-item.en-attente .timeline-marker {
    background: #f59e0b;
    box-shadow:
        0 0 0 2px #fed7aa,
        0 4px 10px rgba(245, 158, 11, 0.16);
}

.timeline-item.approuvee .timeline-marker {
    background: #22c55e;
    box-shadow:
        0 0 0 2px #bbf7d0,
        0 4px 10px rgba(34, 197, 94, 0.16);
}

.timeline-item.refusee .timeline-marker {
    background: #ef4444;
    box-shadow:
        0 0 0 2px #fecaca,
        0 4px 10px rgba(239, 68, 68, 0.16);
}

.timeline-item.annulee .timeline-marker {
    background: #94a3b8;
    box-shadow:
        0 0 0 2px #dbe3ee,
        0 4px 10px rgba(100, 116, 139, 0.12);
}

.timeline-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.timeline-title {
    min-width: 0;
}

.timeline-title strong {
    display: block;

    font-size: 15px;
    font-weight: 900;
}

.timeline-title small {
    display: block;

    margin-top: 4px;

    color: var(--md-muted);

    font-size: 11px;
}

.timeline-period {
    margin-top: 11px;

    color: #334155;

    font-size: 13px;
    font-weight: 800;
}

.timeline-response {
    margin-top: 12px;
    padding: 11px 12px;

    border: 1px solid var(--md-border);
    border-radius: 11px;

    background: var(--md-gray-soft);

    color: #475569;

    font-size: 12px;
    line-height: 1.45;
}

.timeline-response strong {
    display: block;

    margin-bottom: 3px;

    color: #334155;

    font-size: 11px;
    text-transform: uppercase;
}

.timeline-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;

    margin-top: 13px;
}

.btn-timeline {
    min-height: 33px;
    padding: 5px 9px;

    border: 1px solid var(--md-border);
    border-radius: 9px;

    background: #ffffff;
    color: #334155;

    font-size: 11px;
    font-weight: 800;
}

.btn-timeline:hover {
    border-color: #bfdbfe;
    background: var(--md-blue-soft);
    color: var(--md-blue-dark);
}

.btn-timeline.danger {
    border-color: #fecaca;
    background: var(--md-danger-soft);
    color: var(--md-danger);
}


/*
|--------------------------------------------------------------------------
| Badges
|--------------------------------------------------------------------------
*/

.badge-demande {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    padding: 5px 9px;

    border: 1px solid transparent;
    border-radius: 999px;

    font-size: 11px;
    font-weight: 850;
    white-space: nowrap;
}

.badge-en-attente {
    border-color: #fed7aa;
    background: var(--md-warning-soft);
    color: var(--md-warning);
}

.badge-approuvee {
    border-color: #bbf7d0;
    background: var(--md-success-soft);
    color: var(--md-success);
}

.badge-refusee {
    border-color: #fecaca;
    background: var(--md-danger-soft);
    color: var(--md-danger);
}

.badge-annulee {
    border-color: #dbe3ee;
    background: #f1f5f9;
    color: #64748b;
}


/*
|--------------------------------------------------------------------------
| États
|--------------------------------------------------------------------------
*/

.demandes-statut,
.demandes-vides {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;

    min-height: 180px;
    padding: 22px;

    border: 1px dashed #cbd5e1;
    border-radius: var(--md-radius);

    background: rgba(248, 250, 252, 0.75);
    color: var(--md-muted);
}

.demandes-statut-icone,
.demandes-vides-icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 49px;
    height: 49px;

    border-radius: 15px;

    background: var(--md-blue-soft);
    color: var(--md-blue);

    font-size: 23px;
}

.demandes-statut strong,
.demandes-vides h3 {
    margin: 0;

    color: #334155;

    font-size: 16px;
    font-weight: 850;
}

.demandes-statut p,
.demandes-vides p {
    margin: 4px 0 0;

    font-size: 13px;
}

.demandes-vides {
    flex-direction: column;
    text-align: center;
}


/*
|--------------------------------------------------------------------------
| Modales
|--------------------------------------------------------------------------
*/

.fa-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 18px;

    background: rgba(15, 23, 42, 0.48);

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.fa-modal-dialog {
    width: min(580px, 100%);
    max-height: calc(100vh - 36px);

    overflow: auto;

    border: 1px solid rgba(255, 255, 255, 0.80);
    border-radius: 20px;

    background: rgba(255, 255, 255, 0.98);

    box-shadow: 0 26px 65px rgba(15, 23, 42, 0.28);

    animation: mes-demandes-modal 180ms ease-out;
}

.modal-demande-dialog {
    width: min(650px, 100%);
}

.modal-detail-dialog {
    width: min(620px, 100%);
}

.modal-annulation-dialog {
    width: min(470px, 100%);
}

@keyframes mes-demandes-modal {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

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

.fa-modal-header,
.fa-modal-footer {
    position: sticky;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 16px 18px;

    background: rgba(255, 255, 255, 0.95);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.fa-modal-header {
    top: 0;
    border-bottom: 1px solid var(--md-border);
}

.fa-modal-footer {
    bottom: 0;
    justify-content: flex-end;
    border-top: 1px solid var(--md-border);
}

.fa-modal-header h3 {
    margin: 0;

    font-size: 18px;
    font-weight: 900;
}

.modal-subtitle {
    margin: 3px 0 0;

    color: var(--md-muted);

    font-size: 11px;
}

.fa-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    width: 34px;
    height: 34px;

    border: 1px solid var(--md-border);
    border-radius: 10px;

    background: #f8fafc;
    color: #64748b;

    font-weight: 900;
}

.fa-modal-close:hover {
    border-color: #fecaca;
    background: var(--md-danger-soft);
    color: var(--md-danger);
}

.fa-modal-body {
    display: flex;
    flex-direction: column;
    gap: 15px;

    padding: 18px;
}

.info-demande {
    padding: 11px 13px;

    border: 1px solid #bfdbfe;
    border-radius: 12px;

    background: var(--md-blue-soft);
    color: var(--md-blue-dark);

    font-size: 12px;
    line-height: 1.45;
}


/*
|--------------------------------------------------------------------------
| Détail
|--------------------------------------------------------------------------
*/

.detail-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 10px;
}

.detail-item {
    padding: 11px 12px;

    border: 1px solid var(--md-border);
    border-radius: 12px;

    background: #f8fafc;
}

.detail-item.large {
    grid-column: 1 / -1;
}

.detail-item span {
    display: block;

    color: var(--md-muted);

    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
}

.detail-item strong,
.detail-item p {
    display: block;

    margin: 4px 0 0;

    color: #334155;

    font-size: 13px;
    line-height: 1.45;
}


/*
|--------------------------------------------------------------------------
| Annulation
|--------------------------------------------------------------------------
*/

.annulation-icone {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 62px;
    height: 62px;

    margin: 0 auto;

    border: 1px solid #fed7aa;
    border-radius: 19px;

    background: var(--md-warning-soft);
    color: var(--md-warning);

    font-size: 28px;
}

.annulation-resume {
    padding: 12px 14px;

    border: 1px solid var(--md-border);
    border-radius: 13px;

    background: #f8fafc;
}

.annulation-resume span,
.annulation-resume small {
    display: block;

    color: var(--md-muted);

    font-size: 11px;
}

.annulation-resume strong {
    display: block;

    margin: 3px 0;

    font-size: 15px;
    font-weight: 900;
}

.annulation-message {
    margin: 0;

    color: #475569;

    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}


/*
|--------------------------------------------------------------------------
| Toast et hidden
|--------------------------------------------------------------------------
*/

.fa-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2000;

    max-width: min(420px, calc(100vw - 40px));

    padding: 12px 15px;

    border-radius: 13px;

    background: rgba(29, 78, 216, 0.96);
    color: #ffffff;

    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.22);

    font-size: 13px;
    font-weight: 800;
}

.fa-toast.success {
    background: rgba(21, 128, 61, 0.96);
}

.fa-toast.error {
    background: rgba(185, 28, 28, 0.96);
}

.resume-demandes[hidden],
.timeline-demandes[hidden],
.demandes-statut[hidden],
.demandes-vides[hidden],
.fa-modal[hidden],
.fa-toast[hidden],
#champMotifAbsence[hidden],
#champsHeuresPartielles[hidden],
button[hidden] {
    display: none !important;
}


/*
|--------------------------------------------------------------------------
| Responsive
|--------------------------------------------------------------------------
*/

@media (max-width: 950px) {
    .resume-demandes {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

    .mes-demandes-filters {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .fa-header {
        position: relative;
        align-items: flex-start;
        flex-direction: column;
    }

    .fa-header-right {
        width: 100%;
        justify-content: flex-start;
    }

    .welcome-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .welcome-card .btn-primary {
        width: 100%;
    }

    .fa-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .resume-demandes,
    .mes-demandes-filters,
    .form-grid-2,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-item.large {
        grid-column: auto;
    }

    .fa-form-actions {
        align-items: stretch;
    }

    .fa-form-actions .btn-secondary {
        width: 100%;
    }
}

@media (max-width: 540px) {
    .fa-main {
        width: calc(100% - 12px);
        padding-top: 10px;
    }

    .fa-card-body,
    .fa-card-header,
    .welcome-card {
        padding: 14px;
    }

    .fa-header-right .btn-header {
        width: 100%;
    }

    .timeline-demandes {
        padding-left: 24px;
    }

    .timeline-marker {
        left: -23px;
    }

    .fa-modal {
        align-items: flex-end;
        padding: 8px;
    }

    .fa-modal-dialog {
        max-height: calc(100vh - 16px);
        border-radius: 19px 19px 12px 12px;
    }

    .fa-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .fa-modal-footer button {
        width: 100%;
    }
}