/* Modal de detalhes dos serviços (página Serviços). Fonte única: não repetir estas regras em outro arquivo. */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    padding: 1rem;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
}

.modal.show {
    display: flex;
    animation: modal-fade 0.25s ease;
}

.modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 860px;
    max-height: min(88vh, 760px);
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.3);
    animation: modal-rise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Header: mantém o degradê azul da marca */
.modal-header {
    position: relative;
    flex: none;
    padding: 1.6rem 4.5rem 1.6rem 2rem;
    background: var(--primary-color);
}

.modal-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.2;
}

.close-modal {
    position: absolute;
    top: 50%;
    right: 1.25rem;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-content:focus {
    outline: none;
}

.close-modal:focus-visible,
.modal-cta:focus-visible,
.modal-secondary:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

/* Body: rola sozinho, header e rodapé ficam fixos */
.modal-body {
    flex: 1 1 auto;
    padding: 1.75rem 2rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #eef2f7;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #eef2f7;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.modal-full-description h2 {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 1.9rem 0 0.9rem;
    color: #0f172a;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: left;
}

.modal-full-description h2:first-child {
    margin-top: 0;
}

.modal-full-description h2::before {
    content: '';
    flex: none;
    width: 3px;
    height: 1.1em;
    background: var(--primary-color);
}

/* Itens em duas colunas: listas longas cabem sem rolar demais */
.modal-full-description ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.modal-full-description li {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0.9rem;
    color: #334155;
    font-size: 0.93rem;
    line-height: 1.4;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.modal-full-description li::before {
    content: '\2713';
    flex: none;
    color: var(--primary-color);
    font-weight: 700;
}

.modal-full-description li:hover {
    background: #eff6ff;
}

/* Rodapé fixo com a ação principal */
.modal-footer {
    flex: none;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}

.modal-cta,
.modal-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.modal-cta {
    border: 0;
    background: var(--primary-color);
    color: #ffffff;
}

.modal-cta:hover {
    background: var(--secondary-color);
}

.modal-secondary {
    border: 1px solid #cbd5e1;
    background: transparent;
    color: #475569;
}

.modal-secondary:hover {
    background: #eef2f7;
}

@keyframes modal-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modal-sheet {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Mobile: vira "bottom sheet" e a lista passa a uma coluna */
@media (max-width: 768px) {
    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-content {
        max-width: none;
        max-height: 92vh;
        border-radius: 8px 8px 0 0;
        animation: modal-sheet 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .modal-header {
        padding: 1.2rem 4rem 1.2rem 1.25rem;
    }

    .modal-header h3 {
        font-size: 1.3rem;
    }

    .modal-body {
        padding: 1.25rem;
    }

    .modal-full-description ul {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        padding: 0.9rem 1.25rem;
    }

    .modal-cta,
    .modal-secondary {
        flex: 1;
        padding: 0.8rem 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal.show,
    .modal-content {
        animation: none;
    }

    .modal-full-description li,
    .close-modal,
    .modal-cta {
        transition: none;
    }
}
