* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #9333ea 0%, #2563eb 50%, #4338ca 100%);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.background-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.3;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat;
}

.floating-element {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    animation: float 6s ease-in-out infinite;
}

.floating-1 { top: 2.5rem; left: 2.5rem; width: 5rem; height: 5rem; background: rgba(255, 255, 255, 0.1); animation-delay: 0s; }
.floating-2 { bottom: 5rem; right: 5rem; width: 8rem; height: 8rem; background: rgba(251, 191, 36, 0.2); animation-delay: 1s; }
.floating-3 { top: 50%; left: 5rem; width: 4rem; height: 4rem; background: rgba(34, 197, 94, 0.2); animation-delay: 0.5s; }

@keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-20px); } }

.login-wrapper { width: 100%; max-width: 28rem; position: relative; z-index: 10; }

.header { text-align: center; margin-bottom: 2rem; animation: fadeIn 0.8s ease-out; }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 5rem; height: 5rem; background: linear-gradient(135deg, #facc15, #f97316); border-radius: 50%; margin-bottom: 1rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); animation: bounce 2s infinite; color: white; }
.header h1 { font-size: 2.25rem; font-weight: bold; color: white; margin-bottom: 0.5rem; letter-spacing: -0.025em; }
.header p { color: #e9d5ff; font-size: 1.125rem; }

@keyframes bounce { 0%, 20%, 53%, 80%, 100% { transform: translateY(0); } 40%, 43% { transform: translateY(-10px); } }

.card { backdrop-filter: blur(16px); background: rgba(255, 255, 255, 0.95); border-radius: 0.75rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); border: 0; animation: slideUp 0.6s ease-out 0.2s both; }
.card-header { text-align: center; padding: 1.5rem 1.5rem 0.5rem; }
.card-header h2 { font-size: 1.5rem; font-weight: 600; color: #1f2937; margin-bottom: 0.5rem; }
.card-header p { color: #6b7280; }
.card-content { padding: 0 1.5rem 1.5rem; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

.tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 1.5rem; background: #f3f4f6; border-radius: 0.5rem; padding: 0.25rem; }
.tab-button { padding: 0.75rem; border: none; background: transparent; border-radius: 0.375rem; font-weight: 500; cursor: pointer; transition: all 0.3s ease; }
.tab-button.active { background: linear-gradient(135deg, #8b5cf6, #2563eb); color: white; }
.tab-button:not(.active) { color: #6b7280; }
.tab-button:not(.active):hover { color: #374151; }

/* REGRA PARA ESCONDER/MOSTRAR AS ABAS */
.tab-content { display: none; }
.tab-content.active { display: block; }

.form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { color: #374151; font-weight: 500; font-size: 0.875rem; }

.input-wrapper { position: relative; }
.input-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: #9ca3af; pointer-events: none; }
.form input {
    width: 100%;
    height: 3rem;
    padding: 0 0.75rem 0 2.5rem;
    border: 2px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

/* NOVA REGRA PARA O EFEITO DE BORDA COM GRADIENTE */
.form input:focus {
    outline: none;
    border-color: transparent; /* Deixa a borda física transparente */
    background-image: linear-gradient(white, white), 
                      linear-gradient(135deg, #9333ea, #2563eb); /* Fundo branco por cima de um fundo com gradiente */
    background-origin: border-box; /* O gradiente começa na borda */
    background-clip: padding-box, border-box; /* O fundo branco corta na área interna, o gradiente corta na borda */
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25); /* Sombra suave para complementar */
}

.password-toggle { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); background: none; border: none; color: #9ca3af; cursor: pointer; padding: 0.25rem; border-radius: 0.25rem; transition: color 0.2s ease; }
.password-toggle:hover { color: #6b7280; }

.forgot-password { display: flex; justify-content: flex-end; margin-bottom: 0.5rem; }
.forgot-password a { color: #8b5cf6; text-decoration: none; font-size: 0.875rem; transition: color 0.2s ease; }
.forgot-password a:hover { color: #7c3aed; }

.btn-primary { width: 100%; height: 3rem; background: linear-gradient(135deg, #9333ea, #2563eb, #059669); color: white; border: none; border-radius: 0.5rem; font-weight: 600; font-size: 1rem; cursor: pointer; transition: all 0.3s ease; position: relative; overflow: hidden; }
.btn-primary:hover { background: linear-gradient(135deg, #7c2d12, #1d4ed8, #047857); transform: scale(1.02); }
.btn-primary:disabled { cursor: not-allowed; opacity: 0.7; }
.btn-primary.loading .btn-text { opacity: 0; }
.btn-primary.loading .btn-loader { opacity: 1; }
.btn-loader { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0; transition: opacity 0.3s ease; }

.btn-secondary { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 0.5rem; 
    width: 100%; 
    height: 3rem; 
    background: transparent; 
    color: #6b7280; 
    border: 2px solid #e5e7eb; 
    border-radius: 0.5rem; 
    font-weight: 500; 
    font-size: 1rem; 
    text-decoration: none; 
    cursor: pointer; 
    transition: all 0.3s ease; 
}
.btn-secondary:hover { 
    background: #f9fafb; 
    border-color: #9ca3af; 
    color: #374151; 
    transform: translateY(-1px); 
}

.back-to-login { 
    margin-top: 1rem; 
}

/* REGRAS PARA CRIAR A LINHA DIVISÓRIA */
.divider { position: relative; margin: 1.5rem 0; text-align: center; }
.divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: #e5e7eb; z-index: 0; }
.divider span { position: relative; background: white; padding: 0 0.5rem; color: #6b7280; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; z-index: 1; }

.social-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.social-btn { height: 3rem; border: 1px solid #e5e7eb; background: white; border-radius: 0.5rem; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; }
.social-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); }
.social-btn.google:hover { border-color: #fca5a5; background: #fef2f2; }
.social-btn.facebook:hover { border-color: #93c5fd; background: #eff6ff; }
.social-btn.github:hover { border-color: #9ca3af; background: #f9fafb; }
.social-btn.microsoft:hover { border-color: #93c5fd; background: #eff6ff; }

.social-icon { width: 1.25rem; height: 1.25rem; display: flex; align-items: center; justify-content: center; border-radius: 0.25rem; font-weight: bold; font-size: 0.75rem; }
.google-icon { background: linear-gradient(135deg, #ef4444, #facc15); color: white; }
.facebook-icon { background: #3b82f6; color: white; }
.github-icon { background: #1f2937; color: white; border-radius: 50%; }

.microsoft-icon { width: 1.25rem; height: 1.25rem; }
.ms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; width: 100%; height: 100%; }
.ms-square { border-radius: 1px; }
.ms-square.red { background: #ef4444; }
.ms-square.green { background: #22c55e; }
.ms-square.blue { background: #3b82f6; }
.ms-square.yellow { background: #facc15; }

.footer { text-align: center; margin-top: 1.5rem; color: #e9d5ff; font-size: 0.875rem; }

.toast { position: fixed; top: 1rem; right: 1rem; background: white; border-radius: 0.5rem; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1); padding: 1rem; min-width: 300px; transform: translateX(120%); transition: transform 0.4s ease-in-out; z-index: 1000; }
.toast.show { transform: translateX(0); }
.toast-title { font-weight: 600; color: #1f2937; margin-bottom: 0.25rem; }
.toast-description { color: #6b7280; font-size: 0.875rem; }

@media (max-width: 640px) {
    .container { 
        padding: 0.5rem; 
        min-height: 100vh;
        align-items: flex-start;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    .header h1 { font-size: 1.875rem; }
    .social-buttons { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
}

/* ================================================================== */
/* REGRAS RESPONSIVAS PARA TELAS COM ALTURA MENOR                     */
/* ================================================================== */

@media (max-height: 700px) {
    .container {
        align-items: flex-start;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .header {
        margin-bottom: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .logo {
        width: 3.5rem;
        height: 3.5rem;
        margin-bottom: 0.5rem;
    }
    
    .card-header {
        padding: 1rem 1.5rem 0.25rem;
    }
    
    .card-header h2 {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }
    
    .card-content {
        padding: 0 1.5rem 1rem;
    }
    
    .tabs {
        margin-bottom: 1rem;
    }
    
    .form {
        gap: 0.75rem;
    }
    
    .form input {
        height: 2.75rem;
    }
    
    .btn-primary {
        height: 2.75rem;
    }
    
    .social-btn {
        height: 2.75rem;
    }
    
    .divider {
        margin: 1rem 0;
    }
    
    .footer {
        margin-top: 1rem;
    }
    
    /* Ajustar elementos flutuantes para não interferir */
    .floating-1 { top: 1rem; left: 1rem; width: 3rem; height: 3rem; }
    .floating-2 { bottom: 2rem; right: 2rem; width: 5rem; height: 5rem; }
    .floating-3 { top: 30%; left: 2rem; width: 2.5rem; height: 2.5rem; }
}

@media (max-height: 600px) {
    .container {
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }
    
    .header {
        margin-bottom: 0.75rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .header p {
        font-size: 0.875rem;
    }
    
    .logo {
        width: 3rem;
        height: 3rem;
        margin-bottom: 0.25rem;
    }
    
    .card-header {
        padding: 0.75rem 1.5rem 0.25rem;
    }
    
    .card-header h2 {
        font-size: 1.125rem;
    }
    
    .card-content {
        padding: 0 1.5rem 0.75rem;
    }
    
    .tabs {
        margin-bottom: 0.75rem;
    }
    
    .form {
        gap: 0.5rem;
    }
    
    .form input {
        height: 2.5rem;
    }
    
    .btn-primary {
        height: 2.5rem;
    }
    
    .social-btn {
        height: 2.5rem;
    }
    
    .divider {
        margin: 0.75rem 0;
    }
    
    .footer {
        margin-top: 0.75rem;
        font-size: 0.75rem;
    }
    
    /* Ocultar elementos flutuantes em telas muito baixas */
    .floating-element {
        display: none;
    }
}

@media (max-height: 500px) {
    .container {
        padding: 0.25rem;
    }
    
    .header {
        margin-bottom: 0.5rem;
    }
    
    .header h1 {
        font-size: 1.125rem;
    }
    
    .header p {
        font-size: 0.75rem;
    }
    
    .logo {
        width: 2.5rem;
        height: 2.5rem;
        margin-bottom: 0.25rem;
    }
    
    .card-header {
        padding: 0.5rem 1.5rem 0.25rem;
    }
    
    .card-header h2 {
        font-size: 1rem;
    }
    
    .card-content {
        padding: 0 1.5rem 0.5rem;
    }
    
    .tabs {
        margin-bottom: 0.5rem;
    }
    
    .form {
        gap: 0.375rem;
    }
    
    .form input {
        height: 2.25rem;
        font-size: 0.875rem;
    }
    
    .btn-primary {
        height: 2.25rem;
        font-size: 0.875rem;
    }
    
    .social-btn {
        height: 2.25rem;
    }
    
    .divider {
        margin: 0.5rem 0;
    }
    
    .footer {
        margin-top: 0.5rem;
        font-size: 0.625rem;
    }
}

/* ================================================================== */
/* REGRA PARA TELAS MUITO PEQUENAS - PERMITIR SCROLL                  */
/* ================================================================== */

@media (max-height: 400px) {
    .container {
        min-height: auto;
        height: auto;
        align-items: flex-start;
        padding: 0.5rem;
        overflow-y: auto;
    }
    
    .login-wrapper {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }
    
    .header {
        margin-bottom: 0.5rem;
    }
    
    .header h1 {
        font-size: 1rem;
    }
    
    .header p {
        font-size: 0.625rem;
    }
    
    .logo {
        width: 2rem;
        height: 2rem;
        margin-bottom: 0.25rem;
    }
    
    .card {
        margin-bottom: 0.5rem;
    }
    
    .card-header {
        padding: 0.5rem 1rem 0.25rem;
    }
    
    .card-header h2 {
        font-size: 0.875rem;
    }
    
    .card-content {
        padding: 0 1rem 0.5rem;
    }
    
    .tabs {
        margin-bottom: 0.5rem;
    }
    
    .tab-button {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .form {
        gap: 0.25rem;
    }
    
    .form-group label {
        font-size: 0.75rem;
    }
    
    .form input {
        height: 2rem;
        font-size: 0.75rem;
        padding: 0 0.5rem 0 2rem;
    }
    
    .btn-primary {
        height: 2rem;
        font-size: 0.75rem;
    }
    
    .social-btn {
        height: 2rem;
    }
    
    .social-icon {
        width: 1rem;
        height: 1rem;
        font-size: 0.625rem;
    }
    
    .divider {
        margin: 0.5rem 0;
    }
    
    .divider span {
        font-size: 0.625rem;
    }
    
    .footer {
        margin-top: 0.5rem;
        font-size: 0.5rem;
    }
}

/* ================================================================== */
/* REGRA PARA DISPOSITIVOS MÓVEIS - CONSIDERAR ALTURA REAL DA VIEWPORT */
/* ================================================================== */

@media (max-width: 768px) and (max-height: 600px) {
    .container {
        min-height: 100vh;
        min-height: 100dvh; /* Usar altura dinâmica da viewport */
        align-items: flex-start;
        padding-top: env(safe-area-inset-top, 0.5rem);
        padding-bottom: env(safe-area-inset-bottom, 0.5rem);
    }
    
    .login-wrapper {
        width: 100%;
        max-width: 100%;
        padding: 0 0.5rem;
    }
    
    .header {
        margin-bottom: 0.75rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .header p {
        font-size: 0.875rem;
    }
    
    .logo {
        width: 3rem;
        height: 3rem;
        margin-bottom: 0.5rem;
    }
    
    .card {
        margin-bottom: 0.75rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem 0.25rem;
    }
    
    .card-header h2 {
        font-size: 1rem;
    }
    
    .card-content {
        padding: 0 1rem 0.75rem;
    }
    
    .tabs {
        margin-bottom: 0.75rem;
    }
    
    .form {
        gap: 0.5rem;
    }
    
    .form input {
        height: 2.5rem;
    }
    
    .btn-primary {
        height: 2.5rem;
    }
    
    .social-btn {
        height: 2.5rem;
    }
    
    .divider {
        margin: 0.75rem 0;
    }
    
    .footer {
        margin-top: 0.75rem;
    }
}

*:focus-visible { outline: 2px solid #8b5cf6; outline-offset: 2px; }
* { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 200ms; }

/* ================================================================== */
/* ESTILOS PERSONALIZADOS PARA AS MENSAGENS FLASH                     */
/* ================================================================== */

.toast {
    border-left: 5px solid #6b7280;
}

.toast.success {
    border-left-color: #22c55e;
}

.toast.success .toast-title {
    color: #166534;
}

/* REGRA CORRIGIDA PARA INCLUIR 'danger' */
.toast.error,
.toast.danger {
    border-left-color: #ef4444;
}

.toast.error .toast-title,
.toast.danger .toast-title {
    color: #b91c1c;
}