body {
    /* Modern gradient background */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    position: relative;
    overflow-y: auto;
}

/* Animated background shapes for visual interest */
body::before,
body::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    animation: float 20s infinite ease-in-out;
}

body::before {
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.2);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

body::after {
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.15);
    bottom: -50px;
    left: -50px;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(50px, 50px) rotate(90deg);
    }
    50% {
        transform: translate(0, 100px) rotate(180deg);
    }
    75% {
        transform: translate(-50px, 50px) rotate(270deg);
    }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease-out;
}

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

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    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.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM6 4V0h-2v4h-4v2h4v4h2V6h4V4h-4z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-header i {
    font-size: 3.5rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
    display: block;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.login-header h3 {
    color: white !important;
    font-weight: 700;
    letter-spacing: 2px;
    margin: 0;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.login-header p {
    color: rgba(255, 255, 255, 0.9) !important;
    margin-top: 8px;
    margin-bottom: 0;
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.login-body {
    padding: 40px 35px;
}

.login-body h5 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 25px;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 6px;
}

.form-control {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 12px 15px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    height: auto;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

.input-group-text {
    border: 2px solid #e9ecef;
    border-right: none;
    border-radius: 10px 0 0 10px;
    background-color: #f8f9fa;
    padding: 12px 15px;
}

.input-group .form-control {
    border-left: none;
    border-radius: 0 10px 10px 0;
}

.input-group .form-control:focus + .input-group-text,
.input-group .form-control:focus ~ .input-group-text {
    border-color: #667eea;
}

.btn-login {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    font-size: 1rem;
}

.btn-login:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-login:active {
    transform: translateY(0);
}

/* Divider styling */
.divider-container {
    position: relative;
    text-align: center;
    margin: 25px 0;
}

.divider-container hr {
    border-top-color: #dee2e6;
    margin: 0;
}

.divider-container span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 0 15px;
    color: #adb5bd;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 2px;
}

/* Google button styling */
.btn-google {
    background: white;
    border: 2px solid #e9ecef;
    padding: 12px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.3s ease;
    color: #495057;
    font-size: 0.95rem;
}

.btn-google:hover {
    border-color: #667eea;
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-google img {
    width: 20px;
    height: 20px;
}

/* Alert styling */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.9rem;
}

.alert-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

/* Forgot password link */
a.text-decoration-none {
    color: #667eea;
    font-weight: 500;
    transition: color 0.3s ease;
}

a.text-decoration-none:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Responsive adjustments for tablets and smaller */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .login-card {
        max-width: 420px;
    }

    .login-header {
        padding: 35px 25px;
    }

    .login-body {
        padding: 35px 30px;
    }

    .login-header i {
        font-size: 3rem;
    }
}

/* Responsive adjustments for mobile phones */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .login-card {
        max-width: 100%;
    }

    .login-header {
        padding: 25px 20px;
    }

    .login-body {
        padding: 25px 20px;
    }

    .login-header i {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }

    .login-header h3 {
        font-size: 1.3rem;
        letter-spacing: 1px;
    }

    .login-header p {
        font-size: 0.8rem;
    }

    .login-body h5 {
        font-size: 1.1rem;
        margin-bottom: 20px;
    }

    .form-control {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .input-group-text {
        padding: 10px 12px;
    }

    .btn-login {
        padding: 12px;
        font-size: 0.95rem;
    }

    .btn-google {
        padding: 10px;
        font-size: 0.9rem;
    }

    .divider-container {
        margin: 20px 0;
    }

    /* Scale down animated background shapes */
    body::before {
        width: 250px;
        height: 250px;
    }

    body::after {
        width: 200px;
        height: 200px;
    }
}

/* Responsive adjustments for small mobile phones */
@media (max-width: 360px) {
    body {
        padding: 5px;
    }

    .login-card {
        max-height: 95vh;
    }

    .login-header {
        padding: 20px 15px;
    }

    .login-body {
        padding: 20px 15px;
    }

    .login-header i {
        font-size: 2rem;
    }

    .login-header h3 {
        font-size: 1.2rem;
    }

    .login-body h5 {
        font-size: 1rem;
    }

    .form-label {
        font-size: 0.8rem;
    }

    .form-control {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .input-group-text {
        padding: 8px 10px;
    }

    .btn-login {
        padding: 10px;
        font-size: 0.9rem;
    }

    .btn-google {
        padding: 8px;
        font-size: 0.85rem;
    }
}

/* Ensure card fits in viewport height on very small screens */
@media (max-height: 600px) and (max-width: 480px) {
    .login-card {
        max-height: 95vh;
    }

    .login-header {
        padding: 15px 15px;
    }

    .login-body {
        padding: 15px 15px;
    }

    .login-header i {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    .login-header h3 {
        font-size: 1.1rem;
    }

    .login-header p {
        font-size: 0.75rem;
        margin-top: 4px;
    }

    .login-body h5 {
        font-size: 0.95rem;
        margin-bottom: 15px;
    }

    .divider-container {
        margin: 15px 0;
    }
}


/* =========================================================
   CORREÇÃO DE LAYOUT — LOGIN SOVA
   Evita rolagem interna no cartão e barras desnecessárias.
   ========================================================= */

/* Faz padding e bordas entrarem no cálculo das dimensões */
html {
    box-sizing: border-box;
    width: 100%;
    min-height: 100%;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

/* A página passa a controlar a rolagem quando necessário */
body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    align-items: center;
}

/* O cartão cresce conforme o conteúdo, sem scrollbar própria */
.login-card {
    width: min(100%, 440px);
    max-height: none;
    height: auto;
    overflow: visible;
    flex: 0 0 auto;
    transform: scale(0.95);
    transform-origin: center center;
}

/* Mantém os elementos do formulário dentro da largura do cartão */
.login-body,
.login-body form,
.login-body .input-group {
    min-width: 0;
    width: 100%;
}

/* Evita que campos e botões provoquem transbordamento */
.login-body .form-control {
    min-width: 0;
}

/* Em telas baixas, permite rolar a página sem cortar o topo do cartão */
@media (max-height: 700px) {
    body {
        align-items: flex-start;
    }

    .login-card {
        margin-top: auto;
        margin-bottom: auto;
    }
}

/* Ajustes para telas estreitas */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .login-card {
        width: 100%;
    }
}
