body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: url('https://www.ecoportal.net/wp-content/uploads/2024/09/tierras-agricolas-1201x800.webp') no-repeat center center/cover;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Override focus styles to use brand green */
.form-control:focus,
.form-select:focus {
  border-color: #1e7e34 !important;
  box-shadow: 0 0 0 0.25rem rgba(30, 126, 52, 0.25) !important;
  outline: 0 !important;
}

/* Selected/hovered option color inside dropdown list (best-effort across browsers) */
.form-select option:hover,
.form-select option:active,
.form-select option:focus,
select option:hover,
select option:active,
select option:focus {
  background-color: rgba(30, 126, 52, 0.8) !important;
  color: #fff !important;
}
/* No styling for :checked so placeholder stays neutral */

/* === Ojito mostrar/ocultar (genérico para form-floating) === */
.form-floating { position: relative; }
.form-floating > .form-control { padding-right: 5rem; }
.toggle-password { position: absolute; right: 44px; top: 50%; transform: translateY(-50%); background: transparent; border: none; cursor: pointer; }
.toggle-password i { font-size: 20px; line-height: 1; }
.toggle-password .bx-show { display: none; }
.toggle-password.showing .bx-show { display: inline-block; }
.toggle-password.showing .bx-hide { display: none; }

.register-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.form-box {
    background: rgba(255, 255, 255, 0.377);
    padding: 30px;
    backdrop-filter: blur(10px); /* Desenfoque del fondo */
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(199, 196, 196, 0.2);
    width: 400px;
    text-align: center;
}

.form-box h2 {
    color: #1e7e34;
    margin-bottom: 10px;
}

.form-box p {
    color: black;
    font-size: 14px;
    margin-bottom: 20px;
}

input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
}

.form-box button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: #1e7e34;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}

.form-box button[type="submit"]:hover {
    background: #1b5e20;
}

.switch {
    margin-top: 15px;
    font-size: 14px;
}

.switch a {
    color: #1e7e34;
    text-decoration: none;
    font-weight: bold;
}

select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #555;
    appearance: none; /* Quita la flechita por defecto en algunos navegadores */
    cursor: pointer;
    box-sizing: border-box;
}

select:focus {
    border-color: #1e7e34;
    outline: none;
    box-shadow: 0 0 5px rgba(30, 126, 52, 0.5);
}

.is-invalid {
    border-color: #ccc; /* Mantén el borde normal, solo muestra el texto de error */
    box-shadow: none;
}

/* Unificar aspecto en focus */
input:focus, select:focus {
    border-color: #1e7e34;
    outline: none;
    box-shadow: 0 0 5px rgba(30, 126, 52, 0.5);
}

.invalid-feedback {
    color: #dc3545;
    font-size: 12px;
    margin: 0px 0 0 0; /* aparece debajo del input */
    text-align: left;
}

.input-asterisco {
    position: relative;
    display: inline-block;
    width: 100%;
    margin-bottom: 8px; 
}

.input-asterisco::after {
    content: "*";
    color: red;
    position: absolute;
    right: 10px;
    top: 8px; /* asterisco fijado arriba dentro del input */
    transform: none;
    pointer-events: none;
}

/* Solo fija el asterisco: el error se posiciona debajo sin empujar el input */
.input-asterisco .invalid-feedback {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    margin: 0;
}

.input-asterisco .invalid-feedback { position: static; }

/* Contenedor de la contraseña */
.password-wrapper { position: relative; width: 100%; }

/* Input de contraseña: espacio para el ojito y el asterisco */
.password-wrapper input.form-control, .password-wrapper input[type="password"], .password-wrapper input[type="text"] { width: 100%; padding-right: 76px; min-height: 42px; box-sizing: border-box; }

/* Botón ojito, pegado a la derecha */
.password-wrapper .toggle-password {
  position: absolute;
  right: 15px;    /* primero el ojo (interno) */
  top: 2px;
  bottom: 2px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #333;
  padding: 0;
  width: 40px;   /* ancho fijo para calcular padding del input */
  height: 40px;  /* igual a la altura del input */
  outline: none;
  z-index: 2;
  display: flex; 
  align-items: center; 
  justify-content: center; /* centra verticalmente */
  line-height: 1;
}

/* Tamaño y cambio de iconos (mostrar/ocultar) */
.password-wrapper .toggle-password i { font-size: 22px; line-height: 1; }
.password-wrapper .toggle-password .bx-show { display: none; }
.password-wrapper .toggle-password.showing .bx-show { display: inline-block; }
.password-wrapper .toggle-password.showing .bx-hide { display: none; }

/* Asterisco corrido a la izquierda para dejar espacio al ojito */
.input-asterisco.password-wrapper::after {
  right: 10px; /* asterisco al final, como en los demás */
  top: 8px;
}

/* Inputs y selects a 100% (contenedor maneja el margen lateral) */
input { width: 100%; box-sizing: border-box; }
select { width: 100%; box-sizing: border-box; }

/* === Floating labels (custom) === */
.floating-group { position: relative; }
.floating-group input,
.floating-group select {
  padding: 14px 12px; /* espacio para label */
}
.floating-group label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #555;
  font-size: 14px;
  pointer-events: none;
  transition: all 0.15s ease-in-out;
  background: transparent;
}
/* Flotar en focus o cuando hay contenido */
.floating-group input:focus + label,
.floating-group input:not(:placeholder-shown) + label,
.floating-group select.filled + label,
.floating-group select:focus + label {
  top: 0;
  transform: translateY(-50%) scale(0.85);
  color: #1e7e34;
  background: #ffffff;
  padding: 0 4px;
}
/* Borde en focus consistente */
.floating-group input:focus,
.floating-group select:focus {
  border-color: #1e7e34;
  box-shadow: 0 0 0.25rem 0.05rem rgba(30, 126, 52, 0.45);
  outline: none;
}
/* Compatibilidad con el ojito dentro del wrapper */
.floating-group.password-wrapper input { padding-right: 76px; }
.floating-group.password-wrapper label { right: 56px; }


.alert-success {
    background-color: #d4edda;
    color: #1e7e34;
    border: 1px solid #c3e6cb;
    padding: 12px 20px;
    margin-bottom: 15px;
    border-radius: 6px;
    font-size: 14px;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 12px 20px;
    margin-bottom: 15px;
    border-radius: 6px;
    font-size: 14px;
}
/* ==== ONLOADER ==== */
#onloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
}

#onloader .spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #1e7e34; /* Verde corporativo */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

#onloader p {
    font-size: 16px;
    color: #333;
    font-weight: bold;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#onloader {
    transition: opacity 0.8s ease;
}

/*-- REQUISITOS DEL PASSWORD--*/
/* Est
ilo del checkbox de términos con color verde corporativo */
.form-check-input:checked {
    background-color: #1e7e34;
    border-color: #1e7e34;
}

.form-check-input:focus {
    border-color: #1e7e34;
    box-shadow: 0 0 0 0.25rem rgba(30, 126, 52, 0.25);
}

.form-check-input:checked:focus {
    background-color: #1e7e34;
    border-color: #1e7e34;
}


/* Botón modo oscuro */
.modo-oscuro-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #28a745;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modo-oscuro-btn:hover {
    background: #1e7e34;
    transform: scale(1.1);
}

/* Estilos modo claro (por defecto) */
.form-floating > label {
    color: #000000;
}

.toggle-password {
    color: #000000;
}

/* Estilos modo oscuro */
body.modo-oscuro {
    color: #e0e0e0;
}

body.modo-oscuro .form-box {
    background: rgba(45, 45, 45, 0.9);
    backdrop-filter: blur(10px);
}

body.modo-oscuro h2 {
    color: #e0e0e0;
}

body.modo-oscuro p {
    color: #b0b0b0;
}

body.modo-oscuro .form-floating > label {
    color: #ffffff !important;
}

body.modo-oscuro .form-control,
body.modo-oscuro .form-select {
    background-color: #3a3a3a;
    border-color: #555;
    color: #e0e0e0;
}

body.modo-oscuro .form-control:focus,
body.modo-oscuro .form-select:focus {
    background-color: #3a3a3a;
    border-color: #28a745;
    color: #e0e0e0;
}

body.modo-oscuro .form-select option {
    background-color: #3a3a3a;
    color: #e0e0e0;
}

body.modo-oscuro .toggle-password {
    color: #ffffff !important;
}

body.modo-oscuro .toggle-password i {
    color: #ffffff !important;
}

body.modo-oscuro .form-check-label {
    color: #e0e0e0 !important;
}

body.modo-oscuro .form-check-label a {
    color: #4ade80 !important;
    text-decoration: underline;
}

body.modo-oscuro .form-check-label a:hover {
    color: #22c55e !important;
}

body.modo-oscuro .switch {
    color: #b0b0b0;
}

body.modo-oscuro .switch a {
    color: #4ade80;
}

body.modo-oscuro .switch a:hover {
    color: #22c55e;
}


/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body {
        padding: 20px;
    }
    
    .form-box {
        width: 100%;
        max-width: 100%;
        padding: 25px 20px;
    }
    
    .form-box h2 {
        font-size: 1.5rem;
    }
    
    input, select {
        padding: 10px;
        font-size: 13px;
    }
    
    .form-box button[type="submit"] {
        padding: 10px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .form-box {
        padding: 20px 15px;
    }
    
    .form-box h2 {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }
    
    .form-box p {
        font-size: 12px;
        margin-bottom: 15px;
    }
    
    input, select {
        padding: 8px;
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .form-box button[type="submit"] {
        padding: 8px;
        font-size: 13px;
    }
    
    .switch {
        font-size: 12px;
    }
    
    .password-wrapper .toggle-password {
        right: 10px;
        width: 35px;
        height: 35px;
    }
    
    .password-wrapper input {
        padding-right: 50px;
    }
}
