/* CSS para Modais da Página Bisnes */

/* Modal Base */
.modal-base {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-base.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-base.show .modal-content {
    transform: scale(1);
}

/* Modal de Agendamento - Transformado em Sidebar */
#modalAgendamento {
    z-index: 999999 !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    cursor: pointer; /* Permite fechar clicando no overlay */
}

#modalAgendamento .modal-content {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    background: white;
    margin: 0;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    cursor: default; /* Evita fechar quando clica no conteúdo */
}

#modalAgendamento.show .modal-content {
    transform: translateX(0);
}

/* Responsividade da sidebar */
@media (min-width: 768px) {
    #modalAgendamento .modal-content {
        max-width: 420px;
        width: 420px;
    }
}

@media (max-width: 767px) {
    #modalAgendamento .modal-content {
        max-width: 85vw;
        width: 85vw;
    }
}

@media (max-width: 480px) {
    #modalAgendamento .modal-content {
        max-width: 90vw;
        width: 90vw;
    }
}

/* Ajustes específicos para o rodapé da sidebar */
#modalAgendamento .sticky.bottom-0 {
    padding-bottom: 1.5rem !important;
    background: linear-gradient(to top, rgba(249, 250, 251, 1) 70%, rgba(249, 250, 251, 0.95) 100%);
    backdrop-filter: blur(10px);
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 767px) {
    #modalAgendamento .sticky.bottom-0 {
        padding-bottom: 2rem !important;
    }
}

/* Melhorar o cabeçalho da sidebar */
#modalAgendamento .bg-gray-800 {
    border-radius: 0 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Adicionar scroll suave ao conteúdo da sidebar */
#modalAgendamento .modal-content {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

#modalAgendamento .modal-content::-webkit-scrollbar {
    width: 6px;
}

#modalAgendamento .modal-content::-webkit-scrollbar-track {
    background: transparent;
}

#modalAgendamento .modal-content::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

#modalAgendamento .modal-content::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* Modal de Carregamento */
#modalCarregamento {
    z-index: 10010 !important;
    background: rgba(0, 0, 0, 0.8);
}

.loading-container {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 400px;
    width: 90%;
    position: relative;
    z-index: 10011 !important;
}

.loading-bar-container {
    background-color: #e5e7eb;
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
    position: relative;
}

.loading-bar {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8, #3b82f6);
    background-size: 200% 100%;
    height: 100%;
    border-radius: 9999px;
    animation: loading-animation 15s ease-out forwards, loading-gradient 2s ease-in-out infinite;
    width: 0%;
}

@keyframes loading-animation {
    from { width: 0%; }
    to { width: 100%; }
}

@keyframes loading-gradient {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-dots {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 1rem;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background-color: #3b82f6;
    border-radius: 50%;
    animation: loading-dots-animation 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes loading-dots-animation {
    0%, 80%, 100% { 
        transform: scale(0);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

.loading-text {
    color: #374151;
    font-weight: 500;
    text-align: center;
    margin-bottom: 1.5rem;
}

.loading-percentage {
    color: #3b82f6;
    font-weight: 600;
    font-size: 1.125rem;
    text-align: center;
    margin-top: 0.5rem;
}

/* Modal de Sucesso */
#modalSucesso {
    z-index: 10001 !important;
}

#modalSucesso .modal-content {
    max-width: 28rem;
    width: 90%;
}

/* Modal de Seleção de Profissional */
#modalSelecaoProfissional {
    z-index: 999997 !important;
}

#modalSelecaoProfissional .modal-content {
    max-width: 28rem;
    width: 90%;
}

.profissional-card {
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profissional-card:hover {
    border-color: #3b82f6;
    background: #f8fafc;
    transform: translateY(-1px);
}

.profissional-card.selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

.profissional-card img {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3b82f6;
}

/* Modal de Avaliação */
.modal-avaliacao {
    z-index: 100020 !important;
}

.estrela-avaliacao {
    font-size: 2rem;
    color: #d1d5db;
    cursor: pointer;
    transition: color 0.2s ease;
}

.estrela-avaliacao:hover,
.estrela-avaliacao.ativa {
    color: #fbbf24;
}

/* Ocultar menu mobile quando modal estiver aberto */
body.modal-open .mobile-nav-modern {
    display: none !important;
}

/* Garantir que modais fiquem sempre na frente */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    pointer-events: auto !important;
}

/* Animações de entrada e saída */
.modal-enter {
    animation: modalEnter 0.3s ease-out;
}

.modal-exit {
    animation: modalExit 0.3s ease-in;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalExit {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
}

/* Estilos para calendário no modal */
.calendario-modal {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
}

.calendario-dia {
    padding: 0.75rem;
    text-align: center;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.calendario-dia:hover {
    background: #f3f4f6;
}

.calendario-dia.disponivel {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.calendario-dia.selecionado {
    background: #3b82f6;
    color: white;
}

.calendario-dia.indisponivel {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Estilos para horários no modal */
.horario-slot {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.horario-slot:hover {
    border-color: #3b82f6;
    background: #f3f4f6;
}

.horario-slot.selecionado {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.horario-slot.ocupado {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
    cursor: not-allowed;
}

/* Responsividade para modais */
@media (max-width: 640px) {
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .loading-container {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .profissional-card {
        padding: 0.75rem;
    }
    
    .profissional-card img {
        width: 2.5rem;
        height: 2.5rem;
    }
}
