/* Reset básico */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
    background-color: #fff;
    overflow-x: hidden;
}

/* Container principal - sem overflow hidden */
.container-fluid {
    min-height: 100vh;
}

/* Row principal */
.row {
    min-height: 100vh;
}

/* Lado esquerdo com imagem */
.bg-side {
    background-color: #1a1a1a;
    background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('../images/bg-mountain.jpg');
    background-size: cover;
    background-position: center;
    min-height: 100vh;
}

/* Container do formulário - ajustado para mobile */
.login-form-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

/* Logo - responsiva */
.login-form-container img {
    max-height: 120px;
    width: auto;
    height: auto;
}

/* Inputs */
.form-control {
    border: 2px solid #e9ecef;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 16px; /* Previne zoom no iOS */
}

.form-control:focus {
    border-color: #ff6201;
    box-shadow: 0 0 0 0.25rem rgba(255, 98, 1, 0.25);
}

/* Botão */
.btn-primary {
    background-color: #ff6201;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #e55a01;
    transform: translateY(-2px);
}

/* Lado direito - com padding vertical */
.col-md-6.bg-white {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    overflow-y: auto;
}

/* Responsividade para tablets */
@media (max-width: 991.98px) {
    .bg-side {
        min-height: 40vh;
    }

    .col-md-6.bg-white {
        min-height: 60vh;
        padding: 1.5rem 1rem;
    }

    .login-form-container {
        max-width: 500px;
    }
}

/* Responsividade para dispositivos móveis */
@media (max-width: 767.98px) {
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }

    .container-fluid {
        min-height: 100vh;
        height: auto;
    }

    .row {
        min-height: 100vh;
        height: auto;
    }

    /* Esconde o lado esquerdo no mobile */
    .bg-side {
        display: none !important;
    }

    /* Lado direito ocupa toda a tela com scroll */
    .col-md-6.bg-white {
        width: 100% !important;
        flex: 1 1 auto;
        min-height: 100vh;
        height: auto;
        padding: 1rem;
        justify-content: flex-start;
        overflow-y: visible;
    }

    .login-form-container {
        padding: 1rem 0;
        max-width: 100%;
        width: 100%;
        margin: 1rem auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: calc(100vh - 2rem);
    }

    /* Logo menor no mobile */
    .login-form-container img {
        max-height: 80px;
        margin-bottom: 1.5rem !important;
    }

    /* Título menor no mobile */
    .login-form-container h1,
    .login-form-container h3 {
        font-size: 1.4rem;
        margin-bottom: 1.5rem;
        line-height: 1.3;
    }

    /* Inputs com altura adequada para mobile */
    .form-control-lg {
        padding: 0.875rem 1rem;
        font-size: 16px; /* Previne zoom no iOS */
        line-height: 1.5;
    }

    /* Botão com altura adequada e espaçamento */
    .btn-lg {
        padding: 0.875rem 1rem;
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    /* Ajusta o container do checkbox e "esqueci senha" */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start !important;
        margin-bottom: 1.5rem !important;
    }

    .d-flex.justify-content-between a {
        align-self: flex-end;
        font-size: 0.9rem;
    }

    /* Margens adequadas */
    .mb-3 {
        margin-bottom: 1rem !important;
    }

    .mb-4 {
        margin-bottom: 1.5rem !important;
    }

    /* Link de registro menor */
    .btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Responsividade para telas muito pequenas */
@media (max-width: 479.98px) {
    .col-md-6.bg-white {
        padding: 1rem 0.75rem;
    }

    .login-form-container {
        padding: 0.75rem;
        margin-top: 1rem;
    }

    .login-form-container img {
        max-height: 60px;
        margin-bottom: 1rem !important;
    }

    .login-form-container h1,
    .login-form-container h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .form-control-lg {
        padding: 0.75rem 0.875rem;
        font-size: 0.95rem;
    }

    .btn-lg {
        padding: 0.75rem 0.875rem;
        font-size: 1rem;
    }

    /* Checkbox e links menores */
    .form-check-label,
    .text-decoration-none {
        font-size: 0.875rem;
    }

    /* Ajusta o container do checkbox e "esqueci senha" */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start !important;
    }

    .d-flex.justify-content-between a {
        align-self: flex-end;
    }
}

/* Landscape orientation em mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .col-md-6.bg-white {
        justify-content: flex-start;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .login-form-container {
        margin-top: 0.5rem;
    }

    .login-form-container img {
        max-height: 40px;
        margin-bottom: 0.75rem !important;
    }

    .login-form-container h1,
    .login-form-container h3 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .mb-3 {
        margin-bottom: 0.75rem !important;
    }

    .mb-4 {
        margin-bottom: 1rem !important;
    }
}

/* Correção para iOS Safari */
@supports (-webkit-touch-callout: none) {
    .container-fluid {
        min-height: -webkit-fill-available;
    }

    .col-md-6.bg-white {
        min-height: -webkit-fill-available;
    }
}

/* Previne zoom em inputs no iOS */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select,
    textarea,
    input[type="text"],
    input[type="password"],
    input[type="datetime"],
    input[type="datetime-local"],
    input[type="date"],
    input[type="month"],
    input[type="time"],
    input[type="week"],
    input[type="number"],
    input[type="email"],
    input[type="url"],
    input[type="search"],
    input[type="tel"],
    input[type="color"] {
        font-size: 16px;
    }
}

/* Melhora a aparência do botão de mostrar/ocultar senha */
.position-relative .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
}

/* Garante que alertas não quebrem o layout */
.alert {
    margin-bottom: 1rem;
    word-wrap: break-word;
}

/* Melhora o espaçamento em telas pequenas */
@media (max-width: 767.98px) {
    .alert {
        margin-bottom: 0.75rem;
        padding: 0.75rem;
        font-size: 0.875rem;
    }
}