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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #881337 0%, #4c0519 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes moveBackground {
    from { transform: translate(0, 0); }
    to { transform: translate(50px, 50px); }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    min-width: 0;
    max-width: 450px;
    animation: fadeInUp 0.8s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-card {
    background: white;
    border-radius: 24px;
    padding: 50px 40px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

/* Remove a linha em degradê no topo do formulário. */
.login-card::before {
    content: none;
    display: none;
}

.security-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

.security-badge i {
    font-size: 13px;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo-container {
    text-align: center;
    margin-bottom: 40px;
}

.logo-box {
    display: inline-block;
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
    padding: 20px 30px;
    border-radius: 16px;
    border: 3px solid #fbcfe8;
    margin-bottom: 20px;
    max-width: 100%;
}

.logo-box img {
    height: 80px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.login-title {
    font-size: 28px;
    font-weight: 800;
    color: #881337;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-subtitle {
    font-size: 15px;
    color: #64748b;
    font-weight: 500;
}

.alert-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #ef4444;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.alert-error i {
    font-size: 24px;
    color: #dc2626;
    flex-shrink: 0;
}

.alert-error-text {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
    color: #991b1b;
    font-weight: 600;
    font-size: 14px;
}

.alert-blocked {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
    animation: shake 0.5s ease;
}

.alert-blocked i {
    font-size: 48px;
    color: #d97706;
    margin-bottom: 15px;
}

.alert-blocked-title {
    font-size: 18px;
    font-weight: 800;
    color: #92400e;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.alert-blocked-text {
    font-size: 14px;
    color: #78350f;
    font-weight: 600;
    margin-bottom: 15px;
}

.countdown-timer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 50%;
    font-size: 24px;
    font-weight: 800;
    color: white;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
    animation: pulse-timer 1s ease-in-out infinite;
}

@keyframes pulse-timer {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.tentativas-counter {
    text-align: center;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    animation: fadeIn 0.5s ease;
}

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

.tentativas-counter i {
    font-size: 20px;
    color: #d97706;
    margin-right: 8px;
}

.tentativas-text {
    font-size: 14px;
    color: #92400e;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tentativas-number {
    font-size: 18px;
    color: #dc2626;
    font-weight: 800;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
    min-width: 0;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.input-icon {
    position: absolute;
    left: 18px;
    font-size: 18px;
    color: #881337;
    pointer-events: none;
    z-index: 2;
}

.form-input {
    width: 100%;
    min-width: 0;
    padding: 16px 20px 16px 52px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: #2d3748;
    transition: all 0.3s ease;
    background: #f8fafc;
}

/* Mantém espaço para o botão mesmo ao mostrar a senha. */
.input-wrapper:has(.toggle-password) .form-input,
.form-input[type="password"] {
    padding-right: 56px;
}

.form-input:focus {
    outline: none;
    border-color: #881337;
    background: white;
    box-shadow: 0 0 0 4px rgba(136, 19, 55, 0.1);
}

.form-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.toggle-password {
    position: absolute;
    right: 18px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: all 0.3s ease;
    z-index: 2;
}

.toggle-password:hover {
    color: #881337;
    transform: scale(1.1);
}

.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #881337;
}

.remember-me label {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
    cursor: pointer;
}

.forgot-password {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #25d366;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 6px;
}

.forgot-password:hover {
    color: #128c7e;
    background: rgba(37, 211, 102, 0.1);
    transform: translateX(3px);
}

.forgot-password i {
    font-size: 16px;
    animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.btn-login {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #881337 0%, #4c0519 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(136, 19, 55, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(136, 19, 55, 0.6);
    background: linear-gradient(135deg, #9f1239 0%, #5c0621 100%);
}

.btn-login:active:not(:disabled) {
    transform: translateY(-1px);
}

.btn-login:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-login i {
    font-size: 18px;
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #f1f5f9;
}

.login-footer-text {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 15px;
}

.login-footer-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: white;
    font-weight: 700;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-footer-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(37, 211, 102, 0.6);
    background: linear-gradient(135deg, #128c7e 0%, #075e54 100%);
}

.login-footer-link:active {
    transform: translateY(-1px);
}

.login-footer-link i {
    font-size: 18px;
    flex-shrink: 0;
    animation: pulse-whatsapp 2s ease-in-out infinite;
}

@keyframes pulse-whatsapp {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.copyright {
    text-align: center;
    margin-top: 30px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    opacity: 0.9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-password:focus-visible,
.forgot-password:focus-visible,
.btn-login:focus-visible,
.login-footer-link:focus-visible {
    outline: 3px solid #881337;
    outline-offset: 4px;
}

/* Tablets e telemóveis: espaço entre os campos e o cartão. */
@media (max-width: 768px) {
    body {
        padding: 16px !important;
    }

    .login-container .login-card {
        padding: 45px 36px !important;
        border-radius: 20px;
    }

    .logo-container {
        padding-top: 20px;
        margin-bottom: 32px;
    }

    .logo-box {
        padding: 15px 25px;
    }

    .logo-box img {
        height: 60px;
    }

    .login-title {
        font-size: 24px;
    }

    .login-subtitle {
        font-size: 14px;
    }

    .form-input {
        padding: 14px 18px 14px 48px;
        font-size: 16px;
    }

    .btn-login {
        padding: 16px;
        font-size: 15px;
    }
}

/* Mobile: 32px de espaço lateral dentro do cartão. */
@media (max-width: 480px) {
    .login-container .login-card {
        padding: 45px 32px !important;
        border-radius: 16px;
    }

    .logo-container {
        padding-top: 25px;
        margin-bottom: 30px;
    }

    .logo-box {
        padding: 12px 16px;
    }

    .logo-box img {
        height: 50px;
    }

    .login-title {
        font-size: 20px;
    }

    .login-subtitle {
        font-size: 13px;
    }

    .form-group {
        margin-bottom: 24px;
    }

    .form-input {
        padding: 14px 16px 14px 44px;
        font-size: 16px;
    }

    .input-wrapper:has(.toggle-password) .form-input,
    .form-input[type="password"] {
        padding-right: 48px;
    }

    .input-icon {
        left: 14px;
        font-size: 16px;
    }

    .toggle-password {
        right: 14px;
        font-size: 16px;
    }

    .btn-login {
        padding: 15px;
        font-size: 14px;
    }

    .remember-forgot {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        margin-bottom: 25px;
    }

    .forgot-password {
        font-size: 13px;
    }

    .login-footer-link {
        padding: 12px 16px;
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}