/* ============================
   Arquivo: equipe.css
   Ajustes mínimos para corrigir scroll/modal no mobile (evitar "dança" e travamentos)
   Mantive todo o restante do seu CSS — só adicionei/ajustei regras relacionadas ao modal/scroll.
   ============================ */

/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 300;
}

.header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.content {
    padding: 40px;
}

.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 7px 14px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.93rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: unset;
    height: 32px;
    box-shadow: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: #fff;
    font-weight: 500;
    display: inline-flex !important;
    align-items: center;
    visibility: visible !important;
    opacity: 1 !important;
}

.btn-danger .icon-trash {
    font-size: 1.1rem;
    margin-right: 4px;
}

.btn-secondary {
    background: linear-gradient(135deg, #a8a8a8 0%, #7f8c8d 100%);
}

.btn-profile {
    background: linear-gradient(135deg, #ffa726 0%, #ff7043 100%);
    color: #fff;
    font-weight: 500;
}

.btn-edit {
    background: linear-gradient(135deg, #FFD54F 0%, #FFA726 100%);
    color: #333;
    font-weight: 500;
}

.equipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.profissional-card {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    position: relative;
    min-width: 0;
}

.profissional-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.profissional-foto {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid #4facfe;
    align-self: flex-start;
}

.profissional-foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profissional-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.profissional-nome {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 5px;
}

.profissional-status {
    display: inline-block;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.profissional-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* MODAL CENTRALIZADO */
.modal {
    position: fixed;
    left: 0; top: 0;
    width: 100vw; height: 100vh;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.55);
    z-index: 9999;
    backdrop-filter: blur(2px);

    /* Bloquear gestures de scroll fora do modal (evita tocar o body por baixo) */
    touch-action: none;
}
.modal.show {
    display: flex !important;
    /* Garante overlay cobrindo e impede scroll do fundo por toque */
    position: fixed;
    inset: 0;
    overflow: hidden;
}
.modal-content {
    background: white;
    border-radius: 18px;
    padding: 32px;
    width: 95%;
    max-width: 540px;

    /* usar svh para lidar com barras móveis onde suportado (fallback para vh) */
    max-height: calc(100svh - 40px);
    min-height: 120px;
    overflow-y: auto;
    box-shadow: 0 14px 48px rgba(0,0,0,0.25);
    position: relative;
    animation: modalShow 0.2s ease;

    /* Melhoria para mobile: rolagem suave e isolamento de overscroll (evita "dança") */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    will-change: transform;
    touch-action: auto; /* permitir rolagem apenas dentro do conteúdo */
    /* deixar um padding-bottom para evitar esconder último elemento por barras */
    padding-bottom: 28px;
}
@keyframes modalShow {
    from { transform: scale(0.96);}
    to { transform: scale(1);}
}
.modal-header {
    text-align: center;
    margin-bottom: 20px;
}
.modal-header h2 {
    color: #2c3e50;
    font-size: 1.3rem;
    margin-bottom: 6px;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e1e8ed;
    border-radius: 7px;
    font-size: 1rem;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
}
.form-control:focus {
    outline: none;
    border-color: #4facfe;
}
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* TABS NO PERFIL DO PROFISSIONAL */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 18px;
    justify-content: center;
}
.tab-btn {
    background: #f2f3f6;
    color: #764ba2;
    border: none;
    border-radius: 15px 15px 0 0;
    padding: 10px 26px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}
.tab-btn.active {
    background: #fff;
    color: #2c3e50;
    border-bottom: 2px solid #4facfe;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* Serviços grid */
.servicos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 10px;
}

.servico-item {
    background: #e9ecef;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    padding: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 2px;
    color: #333;
}
.servico-item.selected {
    border-color: #2196f3;
    background: #e3f2fd;
    color: #1565c0;
}
.servico-nome {
    font-weight: 600;
    color: inherit;
}
.servico-preco {
    color: #28a745;
    font-weight: 500;
}

.horarios-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 12px;
}
.dia-horario {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 13px 13px 13px 13px;
    margin-bottom: 2px;
}
.dia-nome {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 7px;
}
.horario-intervalos {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.horario-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}
.horario-inputs input[type="time"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #e1e8ed;
    border-radius: 5px;
}
.horario-inputs .btn-remover-intervalo {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 7px;
    padding: 2px 10px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-left: 5px;
}
.btn-incluir-intervalo {
    background: #4facfe;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 4px 15px;
    font-size: 0.95rem;
    font-weight: 500;
    margin-top: 5px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-incluir-intervalo:hover {
    background: #00f2fe;
}

/* Agenda Especial */
.agenda-especial-area {
    padding: 10px 0;
}
#agenda-especial-lista {
    font-size: 0.97rem;
}
.agenda-especial-item {
    background: #f3f6fa;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 6px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.agenda-especial-item .btn-danger {
    padding: 2px 9px;
    font-size: 0.87rem;
}

/* === Mobile adjustments (mantive suas regras principais, com foco em scroll estável) === */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 10px;
    }
    .content {
        padding: 20px;
    }
    .header {
        padding: 20px;
    }
    .header h1 {
        font-size: 2rem;
    }
    .equipe-grid {
        grid-template-columns: 1fr;
    }
    .modal-content {
        padding: 18px 7px;
        margin: 12px;
        max-width: 98vw;
        /* Mantemos max-height padrão e scroll suave */
        max-height: calc(100svh - 40px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    .form-actions {
        flex-direction: column;
        gap: 8px;
    }
    .servicos-grid {
        grid-template-columns: 1fr;
    }
    .horarios-grid {
        flex-direction: column;
    }
    .profissional-actions .btn {
        font-size: 0.92rem;
        padding: 7px 10px;
        height: 32px;
    }

    /* Ajustes específicos para as abas em telas menores (reduz padding e tamanho, mantém rolagem) */
    .tab-btn {
        padding: 6px 10px;
        font-size: 0.9rem;
        border-radius: 12px 12px 0 0;
    }

    /* As abas e conteúdos podem rolar; garantimos comportamento estável e sem "escapamento" do scroll */
    #modal-perfil-profissional {
        overscroll-behavior: contain;
        touch-action: none; /* bloqueia gestos fora do modal */
    }
    #modal-perfil-profissional .tab-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
        padding-right: 12px;
        padding-left: 12px;
        padding-bottom: 20px;
        will-change: transform;
    }

    /* Ajuste específico para a aba 'Horários' */
    #modal-perfil-profissional #tab-content-horarios {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
    }

    /* No mobile: mantenha os botões no fluxo (igual ao desktop) para evitar sobreposição e "dança" */
    #modal-perfil-profissional .form-actions {
        position: static;
        background: transparent;
        padding: 12px 0 0;
        border-top: none;
        z-index: auto;
        justify-content: flex-end;
        gap: 10px;
    }
}
