/* Estilos específicos para a tela de login e cadastro */

/* Melhorar scroll global */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    min-height: 100vh;
    position: relative;
}

/* Scroll transparente - Abordagem universal */
/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 0px;
    height: 0px;
    background: transparent;
}

::-webkit-scrollbar-track {
    background: transparent;
    border: none;
}

::-webkit-scrollbar-thumb {
    background: transparent;
    border: none;
    border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
    background: transparent;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox */
* {
    scrollbar-width: none;
    scrollbar-color: transparent transparent;
}

/* IE/Edge Legacy */
* {
    -ms-overflow-style: none;
}

/* Garantir que todos os elementos tenham scroll transparente */
html, body, div, section, main, article, aside, nav, header, footer {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
div::-webkit-scrollbar,
section::-webkit-scrollbar,
main::-webkit-scrollbar {
    display: none;
}

/* Classe específica para scroll transparente */
.scroll-transparent {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.scroll-transparent::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    background: transparent;
}

.scroll-transparent::-webkit-scrollbar-track {
    display: none;
    background: transparent;
}

.scroll-transparent::-webkit-scrollbar-thumb {
    display: none;
    background: transparent;
}

.scroll-transparent::-webkit-scrollbar-corner {
    display: none;
    background: transparent;
}

/* Estilos para validação de campos */
.input-success {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* Estilos para mensagens */
.message-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.message-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.message-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.message-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Estilos específicos para responsividade da página de cadastro */
@media (max-width: 640px) {
    /* Garantir scroll suave em dispositivos móveis */
    body {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Scroll transparente em mobile */
    ::-webkit-scrollbar {
        display: none;
    }
    
    html {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    /* Ajustar padding do formulário em telas muito pequenas */
    #cadastro-form {
        padding: 1rem !important;
        margin: 0.5rem !important;
    }
    
    /* Ajustar tamanho dos inputs em telas pequenas */
    #cadastro-form input,
    #cadastro-form textarea,
    #cadastro-form select {
        font-size: 16px !important; /* Previne zoom no iOS */
        padding: 0.75rem !important;
        padding-left: 2.5rem !important;
    }
    
    /* Ajustar posição dos ícones */
    #cadastro-form .absolute.inset-y-0.left-0 {
        padding-left: 0.75rem !important;
    }
    
    /* Ajustar botões */
    #cadastro-form button,
    #cadastro-form a {
        padding: 0.75rem 1rem !important;
        font-size: 16px !important;
    }
    
    /* Ajustar logo */
    .logo-container {
        width: 4rem !important;
        height: 4rem !important;
    }
    
    /* Ajustar título */
    h2 {
        font-size: 1.5rem !important;
    }
    
    /* Ajustar grid de cidade/estado */
    .grid.grid-cols-1.md\\:grid-cols-2 {
        gap: 0.75rem !important;
    }
}

/* Melhorar responsividade em tablets */
@media (min-width: 641px) and (max-width: 1024px) {
    #cadastro-form {
        max-width: 28rem !important;
    }
}

/* Ajustes para telas pequenas onde o scroll é crítico */
@media (max-width: 480px) {
    .relative.z-10 {
        align-items: flex-start !important;
        padding-top: 1rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* Garantir que o formulário não seja cortado */
    #cadastro-form {
        margin-bottom: 2rem !important;
    }
}

/* Ajustes para telas muito pequenas (menos de 375px) */
@media (max-width: 374px) {
    .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    #cadastro-form {
        padding: 0.75rem !important;
        margin: 0.25rem !important;
    }
    
    .space-y-3 > * + * {
        margin-top: 0.5rem !important;
    }
    
    /* Garantir que o conteúdo seja scrollável */
    .relative.z-10 {
        min-height: 100vh;
        align-items: flex-start !important;
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* Animação do fundo com balões */
#animated-background {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Balões animados */
.balloon {
    position: absolute;
    animation: float 6s ease-in-out infinite;
}

.balloon-body {
    font-size: 2rem;
    animation: bounce 2s ease-in-out infinite;
}

.balloon-string {
    width: 2px;
    height: 60px;
    background: linear-gradient(to bottom, #8B4513, #654321);
    margin: 0 auto;
    border-radius: 1px;
    position: relative;
}

.balloon-string::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: -8px;
    width: 18px;
    height: 18px;
    background: #8B4513;
    border-radius: 50%;
}

/* Posicionamento dos balões */
.balloon-1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.balloon-2 {
    top: 20%;
    right: 15%;
    animation-delay: 1s;
}

.balloon-3 {
    top: 60%;
    left: 5%;
    animation-delay: 2s;
}

.balloon-4 {
    top: 70%;
    right: 20%;
    animation-delay: 3s;
}

.balloon-5 {
    top: 40%;
    left: 80%;
    animation-delay: 4s;
}

.balloon-6 {
    top: 80%;
    left: 60%;
    animation-delay: 5s;
}

/* Animação de flutuação */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(2deg);
    }
    50% {
        transform: translateY(-10px) rotate(-1deg);
    }
    75% {
        transform: translateY(-15px) rotate(1deg);
    }
}

/* Animação de bounce */
@keyframes bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Nuvens animadas */
.cloud {
    position: absolute;
    font-size: 3rem;
    opacity: 0.3;
    animation: drift 20s linear infinite;
}

.cloud-1 {
    top: 15%;
    left: -10%;
    animation-delay: 0s;
}

.cloud-2 {
    top: 50%;
    right: -10%;
    animation-delay: 7s;
}

.cloud-3 {
    top: 75%;
    left: -15%;
    animation-delay: 14s;
}

@keyframes drift {
    0% {
        transform: translateX(-100px);
    }
    100% {
        transform: translateX(calc(100vw + 100px));
    }
}

/* Estilos do formulário de login */
#login-form {
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.1);
}

/* Efeitos nos campos de input */
#login-form input:focus {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.15);
}

/* Efeito de hover nos botões */
#login-btn:hover {
    box-shadow: 0 15px 30px rgba(59, 130, 246, 0.4);
}

/* Animação de loading */
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Estados de validação */
.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.input-success {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

/* Mensagens de feedback */
.message-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.message-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

.message-info {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
}

/* Modal de recuperação de senha */
#forgot-password-modal {
    backdrop-filter: blur(5px);
}

/* Efeitos de transição */
.transition-all {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsividade aprimorada */
@media (max-width: 768px) {
    .balloon {
        font-size: 1.8rem;
    }
    
    .cloud {
        font-size: 2.5rem;
    }
    
    .balloon-string {
        height: 50px;
    }
    
    #login-form {
        margin: 0 auto;
        max-width: 95%;
    }
    
    /* Ajustar logo para tablets */
    .logo-container {
        margin-bottom: 1rem;
    }
    
    /* Garantir scroll em tablets */
    body {
        overflow-y: auto !important;
        min-height: 100vh;
    }
}

@media (max-width: 640px) {
    .balloon {
        font-size: 1.5rem;
    }
    
    .cloud {
        font-size: 2rem;
    }
    
    .balloon-string {
        height: 40px;
    }
    
    /* Ajustar posicionamento dos balões para telas pequenas */
    .balloon-1 {
        top: 5%;
        left: 5%;
    }
    
    .balloon-2 {
        top: 15%;
        right: 10%;
    }
    
    .balloon-3 {
        top: 55%;
        left: 2%;
    }
    
    .balloon-4 {
        top: 65%;
        right: 15%;
    }
    
    .balloon-5 {
        top: 35%;
        left: 75%;
    }
    
    .balloon-6 {
        top: 75%;
        left: 55%;
    }
    
    /* Garantir scroll em mobile */
    body {
        overflow-y: auto !important;
        overflow-x: hidden;
        min-height: 100vh;
    }
    
    /* Ajustar container principal para mobile */
    .relative.z-10 {
        min-height: 100vh;
        padding: 1.5rem 0.5rem;
    }
    
    /* Ajustar logo para mobile */
    .logo-container {
        margin-bottom: 0.75rem;
    }
    
    /* Ajustar formulário para mobile */
    #login-form {
        padding: 1rem 1.25rem;
        width: 100%;
        max-width: 100%;
    }
    
    /* Prevenir zoom em inputs no iOS */
    input, select, textarea {
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
    .balloon {
        font-size: 1.2rem;
    }
    
    .cloud {
        font-size: 1.5rem;
    }
    
    .balloon-string {
        height: 35px;
    }
    
    /* Reduzir ainda mais o tamanho dos balões em telas muito pequenas */
    .balloon-string::after {
        width: 12px;
        height: 12px;
        bottom: -8px;
        left: -6px;
    }
    
    /* Garantir scroll funcional */
    html, body {
        overflow-y: auto !important;
        overflow-x: hidden;
        height: auto;
        min-height: 100vh;
    }
    
    /* Ajustar container principal */
    .relative.z-10 {
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2rem 0.75rem;
    }
    
    /* Ajustar logo */
    .logo-container {
        margin-bottom: 0.5rem;
        width: 4rem !important;
        height: 4rem !important;
    }
    
    /* Ajustar formulário */
    #login-form {
        padding: 1rem;
        margin: 0 auto;
        width: 100%;
    }
    
    /* Ajustar modal */
    #forgot-password-modal {
        padding: 0.5rem;
    }
    
    #forgot-password-modal .relative {
        top: 2rem !important;
        margin: 0 auto;
        width: calc(100% - 1rem);
    }
    
    /* Ajustar espaçamento dos campos */
    .space-y-4 > * + * {
        margin-top: 0.75rem !important;
    }
}

@media (max-width: 360px) {
    /* Ajustes para telas muito pequenas (smartphones antigos) */
    .balloon {
        font-size: 1rem;
    }
    
    .cloud {
        font-size: 1.2rem;
    }
    
    .balloon-string {
        height: 30px;
    }
    
    /* Ajustar container para smartphones antigos */
    .relative.z-10 > div {
        max-width: 18rem;
        padding: 0 0.25rem;
    }
    
    /* Reduzir ainda mais o espaçamento */
    #login-form {
        padding: 0.5rem 0.75rem;
        margin: 0 0.125rem;
    }
    
    /* Ajustar logo para smartphones antigos */
    .logo-container {
        margin-bottom: 0.375rem;
    }
    
    /* Ajustar tamanhos de fonte */
    h2 {
        font-size: 1.25rem !important;
        margin-bottom: 0.125rem !important;
    }
    
    p {
        font-size: 0.75rem !important;
    }
    
    input, button, label {
        font-size: 0.875rem !important;
    }
}

/* Melhorias para orientação landscape em mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .balloon {
        font-size: 1rem;
    }
    
    .cloud {
        font-size: 1.5rem;
    }
    
    .balloon-string {
        height: 25px;
    }
    
    /* Garantir scroll em landscape */
    html, body {
        overflow-y: auto !important;
        height: auto;
        min-height: 100vh;
    }
    
    /* Ajustar container principal */
    .relative.z-10 {
        padding-top: 1rem;
        padding-bottom: 1rem;
        min-height: 100vh;
        align-items: flex-start;
    }
    
    /* Reduzir espaçamento do formulário */
    #login-form {
        padding: 0.75rem 1rem;
    }
    
    .space-y-3 > * + * {
        margin-top: 0.5rem !important;
    }
    
    .space-y-4 > * + * {
        margin-top: 0.5rem !important;
    }
    
    .space-y-5 > * + * {
        margin-top: 0.75rem !important;
    }
    
    /* Ajustar logo para landscape */
    .logo-container {
        margin-bottom: 0.5rem;
        width: 3.5rem !important;
        height: 3.5rem !important;
    }
    
    /* Ajustar textos */
    h2 {
        font-size: 1.375rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    p {
        font-size: 0.875rem !important;
    }
    
    /* Compactar campos */
    input {
        padding: 0.5rem 1rem !important;
    }
    
    button {
        padding: 0.625rem 1rem !important;
    }
}

/* Animações de entrada */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Efeito de partículas (opcional) */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: particleFloat 8s linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {
    .balloon,
    .cloud,
    .particle,
    #animated-background {
        animation: none;
    }
    
    .balloon-body {
        animation: none;
    }
}

/* Estados de foco para acessibilidade */
button:focus,
input:focus,
a:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Melhorias para dispositivos touch */
@media (hover: none) and (pointer: coarse) {
    /* Aumentar área de toque para botões */
    button, a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Aumentar área de toque para inputs */
    input[type="email"], 
    input[type="password"] {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    /* Aumentar área de toque para checkbox */
    input[type="checkbox"] {
        transform: scale(1.2);
    }
    
    /* Remover efeitos hover em dispositivos touch */
    .hover\:scale-105:hover {
        transform: none;
    }
    
    .hover\:from-blue-700:hover,
    .hover\:to-indigo-700:hover {
        background: linear-gradient(to right, #1d4ed8, #4338ca);
    }
    
    .hover\:bg-gray-50:hover {
        background-color: #f9fafb;
    }
    
    .hover\:text-blue-500:hover {
        color: #3b82f6;
    }
    
    .hover\:text-blue-600:hover {
        color: #2563eb;
    }
    
    .hover\:bg-gray-200:hover {
        background-color: #e5e7eb;
    }
    
    .hover\:bg-gray-400:hover {
        background-color: #9ca3af;
    }
    
    .hover\:bg-gray-600:hover {
        background-color: #4b5563;
    }
}

/* Melhorias para telas de alta densidade */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Garantir que os elementos sejam nítidos em telas retina */
    .balloon-body,
    .cloud {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Garantir que as logos sejam nítidas */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Estilos específicos para logos maiores */
.logo-container {
    transition: all 0.3s ease;
}

.logo-container:hover {
    transform: scale(1.05);
}

/* Garantir que a logo seja sempre visível e bem definida */
.logo-image {
    object-fit: cover;
    object-position: center;
    transition: all 0.3s ease;
}

.logo-image:hover {
    transform: scale(1.02);
}

/* Ajustes para modo escuro (se suportado) */
@media (prefers-color-scheme: dark) {
    /* Manter o design atual, mas preparado para futuras implementações */
    .dark-mode {
        background-color: #1a202c;
        color: #e2e8f0;
    }
}

/* Melhorias para contraste */
@media (prefers-contrast: high) {
    .bg-white\/90 {
        background-color: rgba(255, 255, 255, 0.98);
    }
    
    .border-gray-300 {
        border-color: #000000;
    }
    
    .text-gray-700 {
        color: #000000;
    }
    
    .text-gray-600 {
        color: #1f2937;
    }
}

/* Efeito de ripple nos botões */
.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple-effect:active::before {
    width: 300px;
    height: 300px;
}