/* Modal Bottom Sheet - Adicionar Grupo */

/* Classe para bloquear scroll quando modal estiver aberto */
html.modal-open,
body.modal-open {
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: none;
    -webkit-overflow-scrolling: none;
    position: relative; /* Garantir que o scroll não afete o corpo */
}

/* Ajustes para mobile - detecção de teclado virtual */
@media (max-width: 768px) {
    .modal-overlay.keyboard-open {
        height: 100vh;
        height: 100dvh;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-x: hidden;
    max-width: 100vw;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container * {
    box-sizing: border-box;
}

.modal-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), height 0.3s ease;
    max-height: 60vh; /* Desktop: altura menor para segunda etapa */
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: auto;
    display: flex;
    flex-direction: column;
}

/* Ajustes específicos para primeira etapa (mais compacta) */
.modal-container.step-1 {
    max-height: 40vh;
}

/* Ajustes específicos para segunda etapa */
.modal-container.step-2 {
    max-height: 70vh;
}

/* Altura específica para segunda etapa no desktop */
@media (min-width: 769px) {
    .modal-container.step-2 {
        max-height: 680px;
        height: 680px;
        overflow-y: hidden;
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
    }
    
    .modal-container.step-1 {
        max-height: 300px;
        height: auto;
        overflow-y: hidden;
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
    }    /* Garantir que o body do modal tenha altura adequada */
    .modal-container.step-2 .modal-body {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        max-height: calc(680px - 100px); /* Altura total - header - actions */
        padding-right: 15px;
        padding-left: 15px;
        box-sizing: border-box;
    }
    
    /* Garantir que todos os elementos filhos não causem overflow */
    .modal-container.step-2 * {
        box-sizing: border-box;
        max-width: 100%;
    }
      /* Reduzir espaçamento dos campos no desktop para segunda etapa */
    .modal-container.step-2 .form-group {
        margin-bottom: 8px;
    }
    
    /* Reduzir espaçamento extra entre descrição e categoria */
    .modal-container.step-2 .form-group:has(#inputDescricaoGrupo) {
        margin-bottom: 4px;
    }
    
    /* Reduzir margin dos elementos de validação e contador */
    .modal-container.step-2 .form-validation-error,
    .modal-container.step-2 .char-counter {
        margin-top: 1px;
        margin-bottom: 0;
    }
    
    .modal-container.step-2 .form-input,
    .modal-container.step-2 .form-select {
        padding: 4px 8px;
        font-size: 14px;
    }
    
    .modal-container.step-2 .form-textarea {
        padding: 4px 8px;
        font-size: 14px;
        min-height: 60px;
        height: 60px;
    }
      .modal-container.step-2 .form-label {
        font-size: 16px;        margin-bottom: 3px;
    }
    
    .modal-container.step-2 .image-upload-container {
        gap: 8px;
    }
    
    .modal-container.step-2 .image-upload-btn {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 100px;
    }
}

/* Ajustes do modal para mobile */
@media (max-width: 768px) {
    .modal-container {
        max-height: 85vh; /* Mobile: altura maior para acomodar conteúdo */
        min-height: 280px;
    }
    
    .modal-container.step-1 {
        max-height: 50vh; /* Primeira etapa mobile */
    }
      .modal-container.step-2 {
        max-height: 95vh; /* Segunda etapa mobile - mais espaço */
    }
      .modal-container.keyboard-visible {
        position: fixed;
        bottom: 0;
        max-height: 85vh;
        height: 85vh;
        transform: translateY(0);
        overflow-y: auto;
    }
    
    .modal-container.step-1.keyboard-visible {
        max-height: 70vh;
        height: 70vh;
    }
    
    .modal-container.step-2.keyboard-visible {
        max-height: 90vh;
        height: 90vh;
    }
    
    .modal-overlay.keyboard-open .modal-container {
        max-height: 80vh;
    }
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-header {
    position: relative;
    padding: 16px 20px 8px;
    text-align: left;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    text-align: left;
    margin: 0 0 8px 0;
}

.modal-divider {
    width: 100%;
    height: 1px;
    background-color: #374151;
    margin: 8px 0 0 0;
    position: relative;
}

.modal-divider::before {
    content: '';
    position: absolute;
    left: -20px;
    right: -20px;
    top: 0;
    bottom: 0;
    background-color: #374151;
}

.modal-body {
    padding: 16px 20px 20px;
    min-height: auto;
    flex: 1;
    overflow-x: hidden;
    box-sizing: border-box;
}

.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
    text-align: left;
}

.form-label.required::after {
    content: " *";
    color: #ef4444;
    font-weight: 600;
}

.form-input {
    width: 100%;
    max-width: 100%;
    padding: 6px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    color: #1f2937;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input.invalid,
.form-select.invalid,
.form-textarea.invalid {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.form-input.invalid:focus,
.form-select.invalid:focus,
.form-textarea.invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-help {
    font-size: 14px;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.4;
    text-align: left;
}

.form-validation-error {
    font-size: 12px;
    color: #ef4444;
    margin-top: 2px;
    line-height: 1.3;
    text-align: left;
    display: none;
}

.form-error {
    font-size: 12px;
    color: #ef4444;
    margin-top: 2px;
    line-height: 1.3;
    text-align: left;
}

.form-validation-error.show {
    display: block;
}

.char-counter {
    font-size: 11px;
    color: #6b7280;
    text-align: right;
    margin-top: 2px;
}

.char-counter.invalid {
    color: #ef4444;
}

.char-counter.valid {
    color: #10b981;
}

.form-warning {
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 8px 0;
    font-size: 14px;
    color: #ef4444;
    text-align: left;
}

.modal-actions {
    display: flex;
    gap: 10px;
    padding: 0 20px 16px;
    justify-content: flex-start;
    flex-shrink: 0;
    background: #ffffff;
    border-top: 1px solid #f3f4f6;
    margin-top: auto;
}

/* Reduzir padding das actions no desktop para segunda etapa - Removido pois botões estão integrados */
@media (min-width: 769px) {
    .modal-container.step-2 .modal-header {
        padding: 12px 15px 6px;
    }
    
    .modal-container.step-2 .modal-title {
        font-size: 18px;
        margin: 0 0 6px 0;
    }
}

.btn-modal {
    padding: 8px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
    width: auto;
    border: 1px solid;
}

.btn-cancel {
    background-color: transparent;
    color: #ef4444;
    border-color: #ef4444;
}

.btn-cancel:hover {
    background-color: #fef2f2;
    border-color: #dc2626;
    color: #dc2626;
}

.btn-cancel:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    border-color: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-submit {
    background-color: #10b981;
    color: white;
    border-color: #10b981;
}

.btn-submit:hover {
    background-color: #059669;
    border-color: #047857;
}

.btn-submit:disabled {
    background-color: #d1d5db;
    color: #9ca3af;
    border-color: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Animações adicionais */
@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

/* Responsividade */
@media (max-width: 480px) {
    .modal-body {
        padding: 16px 20px;
    }
    
    .modal-actions {
        padding: 0 20px 20px;
        justify-content: flex-start;
    }
    
    .btn-modal {
        padding: 10px 20px;
        font-size: 15px;
    }
    
    .modal-title {
        font-size: 20px;
    }
    
    .modal-header {
        padding: 18px 20px 14px;
    }
}

/* Melhorias para acessibilidade */
.modal-container:focus {
    outline: none;
}

.form-input:invalid {
    border-color: #e5e7eb;
}

.form-input:invalid:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Estados de loading */
.btn-submit.loading {
    position: relative;
    color: transparent;
}

.btn-submit.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

.btn-cancel.loading {
    position: relative;
    color: transparent;
}

.btn-cancel.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #9ca3af;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Segunda etapa do modal */
.modal-step {
    display: none;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
}

.modal-step.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

/* Ajuste automático da altura do modal */
.modal-container {
    height: auto !important;
    min-height: auto;
}

.modal-body {
    min-height: auto;
    height: auto;
}

.form-field-readonly {
    background-color: #f5f5f5 !important;
    color: #6b7280;
    cursor: not-allowed;
}

.form-select {
    width: 100%;
    max-width: 100%;
    padding: 6px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    color: #1f2937;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    box-sizing: border-box;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 32px;
}

.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    width: 100%;
    max-width: 100%;
    padding: 6px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    color: #1f2937;
    background-color: #f9fafb;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    resize: vertical;
    min-height: 80px;
    height: 80px;
    font-family: inherit;
}

.form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Ajustes específicos para textarea no mobile */
@media (max-width: 768px) {
    .form-textarea {
        height: 80px !important;
        min-height: 80px !important;
        max-height: 80px;
        resize: none;
    }
}



/* Prevenção de scroll lateral - regras específicas */
.modal-overlay {
    overflow-x: hidden;
    max-width: 100vw;
}

.modal-container {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    box-sizing: border-box;
}

.modal-header,
.modal-body,
.modal-actions {
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.form-group,
.form-input,
.form-select,
.form-textarea {
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

/* Garantir que nenhum elemento cause overflow */
.modal-container * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Regra específica para desktop - evitar qualquer scroll lateral */
@media (min-width: 769px) {
    body.modal-open {
        overflow-x: hidden !important;
    }
    
    .modal-container.step-2 {
        overflow: hidden !important;
    }
    
    .modal-container.step-2 .modal-body {
        overflow-x: hidden !important;
        overflow-y: auto;
    }
}

/* Forçar contenção de todos os elementos */
#formAdicionarGrupo {
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

#formAdicionarGrupo * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Especificamente para campos de input */
.form-input,
.form-select,
.form-textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Container específico da segunda etapa */
#step2 {
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

#step2 * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Upload de Imagem - Estilo compacto */
.image-upload-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.image-upload-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    justify-content: center;
}

.image-upload-btn:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
    color: #374151;
}

.upload-icon {
    font-size: 14px;
    color: #6b7280;
    transition: color 0.2s ease;
}

.image-upload-btn:hover .upload-icon {
    color: #374151;
}

.upload-text {
    font-size: 13px;
}

.image-preview {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-preview img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

.remove-image-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #ef4444;
    color: white;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    line-height: 1;
}

.remove-image-btn:hover {
    background-color: #dc2626;
}

/* Estilo para mensagem de erro da imagem */
.image-error {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.3;
    text-align: left;
}

/* Responsividade para mobile */
@media (max-width: 768px) {
    .image-upload-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .image-upload-btn {
        width: 100%;
        min-width: auto;
    }
    
    .image-preview {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Prevenir que o campo de nome mova o modal */
@media (max-width: 768px) {
    .modal-container.step-2 #inputNomeGrupo:focus {
        /* Garantir que nenhuma animação ou movimento ocorra */
        transform: none;
        transition: none;
    }
    
    /* Garantir que a posição do modal não mude quando o campo de nome estiver em foco */
    .modal-container.step-2:has(#inputNomeGrupo:focus) {
        transform: translateY(0) !important;
        bottom: 0 !important;
    }
}

/* Estilos para notificações */
.notification {
    position: fixed;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    text-align: center;
    transition: transform 0.3s ease;
}

.notification-success {
    background-color: #10b981;
}

.notification-error {
    background-color: #ef4444;
}

.notification-info {
    background-color: #3b82f6;
}

/* Posicionamento e animação para desktop */
@media (min-width: 769px) {
    .notification {
        top: 20px;
        right: 20px;
        max-width: 300px;
        transform: translateX(100%);
    }
    
    .notification.active {
        transform: translateX(0);
    }
}

/* Posicionamento e animação para mobile - garantindo visibilidade acima do modal */
@media (max-width: 768px) {
    .notification {
        bottom: 20px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: calc(100vw - 20px);
        transform: translateY(100%);
        z-index: 10001; /* Garantir que fique acima do modal */
        font-size: 13px;
        padding: 10px 15px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        text-align: left;
        max-height: 60px !important;
        overflow: hidden !important;
        line-height: 1.3 !important;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    
    .notification.active {
        transform: translateY(0);
    }
    
    /* Ajustes específicos para quando o modal está aberto */
    body.modal-open .notification {
        bottom: 80px; /* Posicionar acima do modal */
        z-index: 10001;
        max-height: 50px !important;
    }
    
    /* Ajustes para teclado visível */
    .modal-overlay.keyboard-open ~ .notification,
    .modal-overlay.keyboard-open + .notification {
        bottom: 120px !important; /* Ficar acima do teclado virtual */
        left: 5px !important;
        right: 5px !important;
        max-width: calc(100vw - 10px) !important;
        max-height: 45px !important;
        font-size: 12px !important;
        padding: 8px 12px !important;
    }
}

/* Ajustes para dispositivos móveis muito pequenos */
@media (max-width: 480px) {
    .notification {
        bottom: 15px !important;
        left: 5px !important;
        right: 5px !important;
        max-width: calc(100vw - 10px) !important;
        font-size: 12px !important;
        padding: 8px 12px !important;
        line-height: 1.2 !important;
        max-height: 40px !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
        min-height: auto !important;
        height: auto !important;
    }
    
    /* Quando modal está aberto em telas muito pequenas */
    body.modal-open .notification {
        bottom: 70px !important;
        max-height: 35px !important;
        font-size: 11px !important;
        padding: 6px 10px !important;
    }
    
    /* Com teclado virtual ativo */
    .modal-overlay.keyboard-open ~ .notification,
    .modal-overlay.keyboard-open + .notification {
        bottom: 100px !important;
        left: 2px !important;
        right: 2px !important;
        max-width: calc(100vw - 4px) !important;
        max-height: 30px !important;
        font-size: 10px !important;
        padding: 5px 8px !important;
    }
}

/* Ajustes adicionais para evitar qualquer movimento do modal no mobile */
@media (max-width: 768px) {
    /* Prevenir qualquer movimento do modal para quaisquer campos de entrada */
    .modal-container.step-2 input:focus,
    .modal-container.step-2 select:focus,
    .modal-container.step-2 textarea:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        transform: none !important;
        transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    }
    
    /* Garantir posição fixa do modal durante interações no teclado */
    .modal-container.step-2.keyboard-visible {
        transform: translateY(0) !important;
        position: fixed !important;
        bottom: 0 !important;
    }
    
    /* Melhorar a experiência na descrição sem mover toda a interface */
    .modal-container.step-2 #inputDescricaoGrupo:focus {        height: 100px !important;
        transition: height 0.2s ease, border-color 0.2s ease;
    }
}

/* REMOVIDO: Estilos para notificações de auto-preenchimento - Funcionalidade desabilitada */
/*
.auto-fill-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 300px;
    z-index: 10001;
    font-weight: 600;
    text-align: center;
    transition: transform 0.3s ease;
}

@media (max-width: 768px) {
    .auto-fill-notification {
        top: auto;
        bottom: 100px;
        left: 50%;
        right: auto;
        width: 90%;
        max-width: 90%;
        transform: translateX(-50%);
    }
}
*/
/* Garantir que o ícone do upload apareça no mobile */
@media (max-width: 768px) {
    .image-upload-btn .upload-icon {
        display: inline-block !important;
        font-family: "Font Awesome 6 Free" !important;
        font-weight: 900 !important;
        font-style: normal !important;
        font-variant: normal !important;
        text-rendering: auto !important;
        line-height: 1 !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
        font-size: 14px !important;
        color: #6b7280 !important;
        margin-right: 6px !important;
    }
    
    .image-upload-btn .upload-icon:before {
        content: "\f03e" !important; /* Código do ícone fa-image */
        display: inline-block !important;
    }
    
    /* Garantir que o botão de upload mantenha a estrutura correta */
    .image-upload-btn {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        width: 100% !important;
        min-width: auto !important;
        justify-content: center !important;
    }
    
    /* Garantir que o texto também apareça */
    .image-upload-btn .upload-text {
        display: inline-block !important;
        font-size: 13px !important;
    }
}

/* Fallback adicional para o ícone no mobile */
@media (max-width: 768px) {
    /* Se o Font Awesome não carregar, usar um símbolo Unicode como fallback */
    .image-upload-btn .upload-icon.fas.fa-image:not(:before),
    .image-upload-btn .upload-icon:empty {
        font-family: Arial, sans-serif !important;
    }
    
    .image-upload-btn .upload-icon.fas.fa-image:not(:before):after,
    .image-upload-btn .upload-icon:empty:after {
        content: "🖼️" !important; /* Emoji como fallback */
        font-size: 14px !important;
        display: inline-block !important;
    }
    
    /* Forçar o carregamento correto do Font Awesome */
    .image-upload-btn i.fas {
        font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome" !important;
        font-weight: 900 !important;
        font-style: normal !important;
        display: inline-block !important;
        text-rendering: auto !important;
        -webkit-font-smoothing: antialiased !important;
    }
}

/* ========================================
   ESTRUTURA OTIMIZADA PARA SCROLL INTERNO
   ======================================== */

/* Container principal do modal com altura fixa no mobile */
@media (max-width: 768px) {
    .modal-container {
        display: flex;
        flex-direction: column;
        max-height: 90vh !important;
        height: auto !important;
        overflow: hidden !important;
    }
    
    /* Header fixo - sempre visível */
    .modal-header {
        flex-shrink: 0;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        border-bottom: 1px solid #e5e7eb;
        padding: 16px 20px 12px 20px;
    }
    
    /* Área de conteúdo com scroll interno */
    .modal-content-scroll {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        max-height: calc(90vh - 140px);
        padding: 0;
    }
    
    /* Body do modal dentro da área de scroll */
    .modal-content-scroll .modal-body {
        padding: 16px 20px;
        min-height: auto;
    }
    
    /* Footer fixo - sempre visível */
    .modal-footer {
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        padding: 12px 20px 16px 20px;
        z-index: 10;
    }
    
    /* Botões do footer */
    .modal-buttons {
        display: flex;
        gap: 10px;
        justify-content: flex-start;
        width: 100%;
    }
    
    /* Ajustes quando teclado está visível */
    .modal-container.keyboard-visible {
        max-height: 90vh !important;
    }
    
    .modal-container.keyboard-visible .modal-content-scroll {
        max-height: calc(var(--keyboard-height, 60vh) - 160px) !important;
    }
}

/* Garantir que o scroll interno funcione suavemente */
.modal-content-scroll {
    /* Propriedades de scroll otimizadas */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

.modal-content-scroll::-webkit-scrollbar {
    width: 4px;
}

.modal-content-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content-scroll::-webkit-scrollbar-thumb {
    background-color: #cbd5e0;
    border-radius: 2px;
}

.modal-content-scroll::-webkit-scrollbar-thumb:hover {
    background-color: #a0aec0;
}

/* Ajustes específicos para dispositivos muito pequenos */
@media (max-width: 480px) and (max-height: 700px) {
    .modal-container {
        max-height: 95vh !important;
    }
    
    .modal-content-scroll {
        max-height: calc(95vh - 130px) !important;
    }
    
    .modal-header {
        padding: 12px 16px 8px 16px;
    }
    
    .modal-footer {
        padding: 8px 16px 12px 16px;
    }
    
    .modal-content-scroll .modal-body {
        padding: 12px 16px;
    }
}
