@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0B1F3A;
    --primary-light: #1a3454;
    --secondary-color: #2CA4F6;
    --secondary-light: #4db3f7;
    --accent-color: #FFC72C;
    --success-color: #10B981;
    --error-color: #EF4444;
    --warning-color: #F59E0B;
    
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    
    --white: #FFFFFF;
    --black: #000000;
    
    /* Glass effect */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 50%, var(--secondary-color) 100%);
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for modern browsers */
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    margin: 0;
    padding: 2rem 1rem;
    box-sizing: border-box;
    /* Correções específicas para dispositivos Samsung */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Background animated shapes */
body::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 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='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    animation: float 20s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* Floating particles */
.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    animation: particle-float 15s linear infinite;
}

.particle:nth-child(1) { width: 4px; height: 4px; left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { width: 6px; height: 6px; left: 20%; animation-delay: 2s; }
.particle:nth-child(3) { width: 3px; height: 3px; left: 30%; animation-delay: 4s; }
.particle:nth-child(4) { width: 5px; height: 5px; left: 40%; animation-delay: 6s; }
.particle:nth-child(5) { width: 4px; height: 4px; left: 50%; animation-delay: 8s; }
.particle:nth-child(6) { width: 7px; height: 7px; left: 60%; animation-delay: 10s; }
.particle:nth-child(7) { width: 3px; height: 3px; left: 70%; animation-delay: 12s; }
.particle:nth-child(8) { width: 5px; height: 5px; left: 80%; animation-delay: 14s; }
.particle:nth-child(9) { width: 4px; height: 4px; left: 85%; animation-delay: 16s; }

/* Prevenir overflow das partículas em dispositivos móveis */
@media (max-width: 768px) {
    .particle {
        display: none;
    }
}

@keyframes particle-float {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}

.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    box-sizing: border-box;
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px); /* Safari/WebKit support */
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    box-shadow: var(--glass-shadow);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

.login-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 32px 64px -12px rgba(31, 38, 135, 0.4);
}

.logo-section {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-container {
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 320px;
}

.logo-container img {
    max-width: 320px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
}

.logo-container:hover img {
    transform: scale(1.02);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

.welcome-title {
    color: var(--white);
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, var(--white) 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 0;
}

.form-section {
    margin-bottom: 2rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.form-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    font-size: 1rem;
    font-weight: 400;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(44, 164, 246, 0.1);
    transform: translateY(-2px);
}

.form-input:invalid {
    border-color: var(--error-color);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

/* Overriding browser's default autofill styles */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus,
.form-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--primary-light) inset !important;
    -webkit-text-fill-color: var(--white) !important;
    caret-color: var(--white); /* Ensures the cursor color is correct */
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    z-index: 2;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
}

.form-input:focus + .input-icon {
    color: var(--secondary-color);
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    font-size: 1rem;
    z-index: 2;
    transition: all 0.3s ease;
    padding: 0.25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
}

.password-toggle:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}

.forgot-password-section {
    text-align: right;
    margin: 1rem 0 0 0;
}

.forgot-password {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    transition: color 0.3s ease;
}

.forgot-password::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background-color: var(--secondary-light);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.forgot-password:hover {
    color: var(--secondary-light);
}

.forgot-password:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.login-button {
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    background: var(--secondary-color);
    color: var(--white);
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: translateY(0);
}

.login-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    transition: opacity 0.3s ease;
    opacity: 0;
}

.login-button:hover::before {
    opacity: 1;
}

.login-button:hover {
    background: var(--secondary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.login-button:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

.login-button:disabled {
    background: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.footer-section {
    margin-top: 2rem;
    text-align: center;
}

.footer-content {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    line-height: 1.5;
}

.footer-content a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-content a:hover {
    color: var(--secondary-color);
}

/* Security indicators */
.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    margin: 1rem auto;
    color: var(--success-color);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Error states */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    color: #FCA5A5;
    font-size: 0.875rem;
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 1.5rem 0.75rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }
    
    .welcome-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 1rem 0.5rem;
    }

    .login-card {
        padding: 1.5rem 1rem;
    }
    
    .welcome-title {
        font-size: 1.5rem;
    }
    
    .logo-container {
        max-width: 200px;
    }
    
    .logo-container img {
        max-width: 200px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Version Badge - Advanced UX/UI Design */
.version-badge {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    animation: versionBadgeFadeIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s forwards;
    pointer-events: none;
}

.version-badge-content {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 0.625rem 1rem;
    box-shadow: var(--glass-shadow), 0 0 20px rgba(44, 164, 246, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: fit-content;
}

.version-badge-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.version-badge:hover .version-badge-content {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--glass-shadow), 0 0 30px rgba(44, 164, 246, 0.4);
    border-color: rgba(44, 164, 246, 0.4);
}

.version-badge:hover .version-badge-content::before {
    left: 100%;
}

.version-icon {
    color: var(--secondary-color);
    font-size: 0.875rem;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 4px rgba(44, 164, 246, 0.5));
}

.version-badge:hover .version-icon {
    color: var(--secondary-light);
    transform: rotate(15deg) scale(1.1);
    filter: drop-shadow(0 0 8px rgba(44, 164, 246, 0.8));
}

.version-text {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    color: var(--white);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.version-label {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: lowercase;
}

.version-number {
    color: var(--white);
    font-weight: 700;
    background: linear-gradient(135deg, var(--white) 0%, rgba(255, 255, 255, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.version-badge-glow {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(44, 164, 246, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(12px);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: -1;
}

.version-badge:hover .version-badge-glow {
    opacity: 1;
    animation: versionGlowPulse 2s ease-in-out infinite;
}

@keyframes versionBadgeFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes versionGlowPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Responsive adjustments for version badge */
@media (max-width: 768px) {
    .version-badge {
        bottom: 1rem;
        right: 1rem;
    }
    
    .version-badge-content {
        padding: 0.5rem 0.875rem;
        border-radius: 12px;
    }
    
    .version-icon {
        font-size: 0.75rem;
    }
    
    .version-text {
        font-size: 0.75rem;
    }
    
    .version-label {
        font-size: 0.6875rem;
    }
}

@media (max-width: 480px) {
    .version-badge {
        bottom: 0.75rem;
        right: 0.75rem;
    }
    
    .version-badge-content {
        padding: 0.4375rem 0.75rem;
    }
    
    .version-icon {
        font-size: 0.6875rem;
    }
    
    .version-text {
        font-size: 0.6875rem;
        gap: 0.1875rem;
    }
    
    .version-label {
        font-size: 0.625rem;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .login-card {
        border: 2px solid var(--white);
        background: rgba(0, 0, 0, 0.9);
    }
    
    .form-input {
        border: 2px solid var(--white);
        background: var(--black);
    }
    
    .version-badge-content {
        border: 2px solid var(--white);
        background: rgba(0, 0, 0, 0.9);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .version-badge {
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    .version-badge-glow {
        animation: none;
    }
}
