* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', sans-serif;
}

body {
    background: #010101;
    color: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    position: relative;
}

.contenedor {
    flex: 1;
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* ---------- LADO IZQUIERDO ---------- */
.back-home {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 10px 18px;
    border-radius: 10px;
    background: rgba(47, 47, 47, 0.85);
    border: 1px solid #c6a87d;
    color: #c6a87d;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    backdrop-filter: blur(10px);
    transition: all 0.25s ease;
    z-index: 10;
}

.back-home:hover {
    background: #c6a87d;
    color: #1a1a1a;
    transform: translateY(-2px);
}

.login-section {
    width: 50%;
    padding: 40px;
    position: relative;
    display: flex;
    flex-direction: column;
    z-index: 3;
    overflow-y: auto;
    overflow-x: hidden;
}

.card {
    background: rgba(47, 47, 47, 0.7);
    backdrop-filter: blur(18px);
    padding: 40px;
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    margin-left: 20px;
    border: 1px solid #c6a87d;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.45);
    margin-top: 40px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Scroll personalizado para la card */
.card::-webkit-scrollbar {
    width: 6px;
}

.card::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.card::-webkit-scrollbar-thumb {
    background: #c6a87d;
    border-radius: 10px;
}

.card::-webkit-scrollbar-thumb:hover {
    background: #d4b38c;
}

.card h3 {
    color: #c6a87d;
    margin-bottom: 30px;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
}

.input-group {
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: #f1f1f1;
    font-size: clamp(14px, 3vw, 16px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    outline: none;
    transition: 0.3s;
}

.input-group input:focus {
    box-shadow: 0 0 0 2px #c6a87d;
}

.password {
    position: relative;
}

.password .eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    padding: 5px;
}

.password .eye img {
    width: 20px;
    height: auto;
    display: block;
}

/* ---------- SWITCH ---------- */
.switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: clamp(12px, 3vw, 13px);
}

.switch input {
    display: none;
}

.slider {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: 0.3s;
    flex-shrink: 0;
}

.slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

.switch input:checked + .slider {
    background-color: #2196f3;
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

/* ---------- BOTONES ---------- */
.extras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: clamp(12px, 3vw, 13px);
    margin-bottom: 25px;
}

.extras a {
    color: #f77f00;
    text-decoration: none;
    white-space: nowrap;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #b0689f;
    font-size: clamp(14px, 3.5vw, 16px);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 20px;
    transition: 0.3s ease;
    background: linear-gradient(135deg, #d0802b, rgb(217, 149, 13));
}

.btn-login:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, #b08968, #f77f00);
    box-shadow: 0 8px 20px rgba(234, 235, 236, 0.4);
}

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 20px 0;
}

/* Google SignIn button container */
.g_id_signin {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.g_id_signin > div {
    width: 100% !important;
    max-width: 100% !important;
}

.register {
    margin-top: 20px;
    font-size: clamp(12px, 3vw, 13px);
    text-align: center;
}

.register a {
    color: #f77f00;
    text-decoration: none;
}

/* ---------- LADO DERECHO ---------- */
.image-section {
    width: 50%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    background: transparent;
}

.jaguar {
    position: absolute;
    bottom: 0;
    right: 40px;
    width: 118%;
    height: auto;
    object-fit: contain;
    z-index: 1;
    max-height: 95vh;
    pointer-events: none;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.3));
}

/* ---------- ALERTAS ---------- */
.alerta {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #61936398;
    color: white;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 500;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    opacity: 0;
    animation: entrar 0.4s ease forwards;
    text-align: center;
    width: 90%;
    max-width: 350px;
}

.alerta.success {
    background-color: #4696498a;
}

.alerta.error {
    background-color: #92352f91;
}

@keyframes entrar {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes salir {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -30px);
    }
}

/* ---------- ERRORES ---------- */
.login-error {
    color: #ff4d4f;
    position: relative;
    background: rgba(255, 77, 79, 0.12);
    border: 1px solid rgba(255, 77, 79, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(2px);
}

.mostrar-error {
    display: flex !important;
}

.login-error span {
    color: #ff4d4f !important;
    line-height: 1.4 !important;
}

.login-error span:first-child {
    font-size: 18px !important;
}

/* ========== RESPONSIVE MÓVIL ========== */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }

    .contenedor {
        flex-direction: column;
        min-height: auto;
        width: 100%;
        overflow-x: hidden;
    }

    .login-section {
        width: 100%;
        padding: 15px;
        order: 2;
        min-height: auto;
        overflow-x: hidden;
    }

    .image-section {
        width: 100%;
        height: 35vh;
        min-height: 250px;
        max-height: 350px;
        overflow: hidden !important;
        order: 1;
        position: relative;
    }

    .jaguar {
        position: relative;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        right: auto;
        left: auto;
        transform: none;
        bottom: auto;
        margin: 0 auto;
        display: block;
        object-fit: contain;
        object-position: center;
    }

    .card {
        max-height: none;
        margin: 0 auto;
        padding: 25px 20px;
        max-width: 100%;
        margin-left: 0;
        margin-top: 20px;
        overflow-x: hidden;
    }

    .back-home {
        top: 10px;
        left: 10px;
        padding: 6px 12px;
        font-size: 12px;
        z-index: 20;
        background: rgba(47, 47, 47, 0.95);
    }

    .extras {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .extras a {
        white-space: normal;
    }

    .switch {
        width: 100%;
    }
}

/* Tablets y pantallas pequeñas */
@media (min-width: 769px) and (max-width: 1024px) {
    .card {
        max-width: 380px;
        padding: 30px;
    }

    .jaguar {
        width: 100%;
        right: -20px;
        max-width: none;
    }

    .login-section {
        padding: 30px;
    }
    
    .image-section {
        overflow: hidden;
    }
}

/* Pantallas muy pequeñas */
@media (max-width: 480px) {
    .login-section {
        padding: 10px;
    }

    .card {
        padding: 20px 15px;
        border-radius: 15px;
    }

    .card h3 {
        margin-bottom: 20px;
    }

    .input-group {
        margin-bottom: 15px;
    }

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

    .btn-login {
        padding: 10px;
        margin-bottom: 15px;
    }

    .password .eye {
        right: 8px;
    }

    .password .eye img {
        width: 18px;
    }

    .back-home {
        top: 8px;
        left: 8px;
        padding: 5px 10px;
        font-size: 11px;
    }

    .login-error {
        padding: 10px 12px;
        margin-bottom: 15px;
    }
}

/* Ajustes para landscape en móvil */
@media (max-width: 768px) and (orientation: landscape) {
    .image-section {
        height: 45vh;
        max-height: 300px;
        min-height: 200px;
    }

    .card {
        margin-top: 10px;
        padding: 15px;
    }

    .card h3 {
        margin-bottom: 12px;
    }

    .input-group {
        margin-bottom: 10px;
    }

    .extras {
        margin-bottom: 15px;
    }
    
    .jaguar {
        width: auto;
        height: 100%;
        max-width: none;
    }
}

/* Alturas pequeñas en escritorio */
@media (max-height: 700px) and (min-width: 769px) {
    .card {
        margin-top: 20px;
        margin-bottom: 20px;
        padding: 25px;
        max-height: 80vh;
    }

    .card h3 {
        margin-bottom: 15px;
    }

    .input-group {
        margin-bottom: 12px;
    }

    .btn-login {
        margin-bottom: 10px;
    }
    
    .back-home {
        top: 10px;
        left: 10px;
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .jaguar {
        max-height: 85vh;
    }
}

/* Mejoras de accesibilidad táctil en móvil */
@media (max-width: 768px) {
    button, 
    .btn-login,
    .back-home,
    .eye,
    .switch,
    .register a,
    .extras a,
    .g_id_signin {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    button:active,
    .btn-login:active,
    .back-home:active {
        transform: scale(0.98);
    }

    input {
        font-size: 16px !important; /* Previene zoom automático en iOS */
    }
}

/* Prevenir desbordamiento en todos los elementos */
img, video, iframe, .jaguar {
    max-width: 100%;
    height: auto;
}

/* Asegurar que ningún elemento cause desbordamiento */
.login-section, .image-section, .card, .contenedor {
    max-width: 100%;
    overflow-x: hidden;
}