body {
    width: 100vw;
    height: 100vh;
    margin: 0;
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: row;
    background-color: #f8fafc;
    overflow: hidden;
}

* {
    box-sizing: border-box;
}

main {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

footer {
    min-height: 50px;
    max-height: 110px;
    background-color: #333;
    color: white;
    text-align: center;
    padding: 10px 0;
    width: 100%;
    position: relative;
    bottom: 0;
}

p {
    font-size: 12px;
    margin: 0px;
}

h2 {
    font-size: 1.25rem;
    margin: 5px 0 15px 0;
    color: #333;
    font-weight: 600;
}

h3 {
    margin-left: 10px;
}

.contenedor {
    border: 0;
    height: 100%;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Tres columnas iguales */
    grid-template-rows: repeat(2, 1fr);
    /* Dos filas con altura de 100px */
    gap: 10px;
    /* Espacio entre celdas */

}

.item_1 {
    border: 1px solid #ccc;
    border-radius: 5px;
    grid-column: 2 / span 2;
    /* Ocupa la primera columna */
    grid-row: 1 / span 2;
    /* Ocupa las dos filas de esa columna */
    background-color: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.item_1 form {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 100%;
}

.item_1 form>div:first-child {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
}

.item_role {
    border: 1px solid #ccc;
    border-radius: 5px;
    grid-column: 2 / span 2;
    /* Ocupa la primera columna */
    grid-row: 1 / span 2;
    /* Ocupa las dos filas de esa columna */
    background-color: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 500px;
}

.item_role form {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 100%;
}

.item_role form div {
    display: flex;
    justify-content: space-between;
    width: 100%;
}


.formulario_inputs {
    display: flex;
    flex-direction: column;
    gap: 5px;
    /* Reduced gap as requested */
}


.form-group {
    margin-bottom: 0.75rem;
    /* Reduced from 1rem */
    display: flex;
    flex-direction: column;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #666;
}

select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    color: #333;
    background-color: #fff;
    cursor: pointer;
    box-sizing: border-box;
}


.form-group input,
option {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: #6e45e2;
    outline: none;
    box-shadow: 0 0 5px rgba(110, 69, 226, 0.3);
}

.formulario_inputs_2 {
    display: flex;
    flex-direction: column;
    border: 1px solid #eee;
    border-radius: 10px;
    height: 320px;
    padding: 15px;
    background: #fdfdfd;
}

.formulario_inputs_2>label {
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
}

.registration-env-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 5px;
    /* Space for the scrollbar */
}

.registration-env-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: all 0.2s ease;
}

.registration-env-item:hover {
    border-color: #6e45e2;
}

.registration-env-item p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.registration-env-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
}

.perm-category {
    font-size: 0.8rem;
    color: #6e45e2;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 15px 0 8px 5px;
    display: block;
}

.input_2_2 label {
    text-align: left;
    align-items: left;
}

.general {
    display: flex;
    flex-direction: column;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 1px;
}

.general_div {
    padding-left: 2px;
    padding-right: 2px;
    border: 0.1px solid black;
    display: flex;
    justify-content: space-between;
}




/* Modern Button Styles (Compact) */
.btn-primary,
.login-button {
    width: auto;
    min-width: 100px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #6e45e2 0%, #8833ff 100%);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(110, 69, 226, 0.1);
    font-family: 'Poppins', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.login-button {
    width: 100%;
}

.btn-primary:hover,
.login-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(110, 69, 226, 0.3);
    background: linear-gradient(135deg, #5a35d1 0%, #7722ee 100%);
}

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

.btn-danger {
    width: auto;
    padding: 6px 14px;
    background: linear-gradient(135deg, #ff4b2b 0%, #ff416c 100%);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(255, 75, 43, 0.1);
    font-family: 'Poppins', sans-serif;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255, 75, 43, 0.4);
    filter: brightness(1.1);
}

.btn-close-popup {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.btn-close-popup:hover {
    background: #ff4b2b;
    color: white;
    transform: rotate(90deg);
}

.item_2 button,
.item_3 button,
.item_4 button {
    margin-top: 15px;
}

.item_2 {
    border: 1px solid #ccc;
    border-radius: 10px;
    grid-column: 1;
    grid-row: 1 / span 2;
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    padding: 15px;
    min-height: 0;
    overflow: hidden;
}

.item_2 div:first-of-type {
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.item_2 h2,
.item_3 h2,
.item_4 h2,
.item_5 h2 {
    text-align: center;
    width: 100%;
}

/* Custom List Item Styling */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.list-item:hover {
    background: #fff;
    border-color: #6e45e2;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.list-item span {
    font-weight: 600;
}

.list-item.log-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.log-time {
    font-size: 0.75rem;
    color: #888;
}


.item_3 {
    border: 1px solid #ccc;
    border-radius: 10px;
    grid-column: 2 / span 2;
    grid-row: 1;
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    padding: 15px;
    min-height: 0;
    overflow: hidden;
}

.item_3 h3 {
    margin-bottom: 5px;
}


.item_3 form {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.contendor_entornos {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    padding: 5px;
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.item_3 form>div:last-child {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-shrink: 0;
    padding-bottom: 5px;
}

.item_4 {
    border: 1px solid #ccc;
    border-radius: 10px;
    grid-column: 2 / span 2;
    grid-row: 2;
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    padding: 15px;
    min-height: 0;
    overflow: hidden;
}

.item_4 div:first-of-type {
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.item_5 {
    border: 1px solid #ccc;
    border-radius: 10px;
    grid-column: 4;
    grid-row: 1 / span 2;
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    padding: 15px;
    min-height: 0;
    overflow: hidden;
}

.item_5 div:first-of-type {
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.general_div {
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.general_div:hover {
    border-color: #6e45e2;
    background: #fff;
}

.general_div a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
}

.general_div input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    /* usamos flexbox para centrar */
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.overlay_2 {
    position: fixed;
    width: 100%;
    height: 100%;
    display: flex;
    /* usamos flexbox para centrar */
    justify-content: center;
    align-items: center;
    z-index: 999;
}

/* Caja modal */
.nuevo_entorno {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    position: relative;
}


.nuevo_entorno input {
    width: 100%
}

/* Botón de cerrar arriba a la derecha */
#cerrar_entorno {
    position: absolute;
    top: 10px;
    right: 10px;
}

.modificacion_activos {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: fadeIn 0.2s ease-in-out;
}

.modificacion_activos form {
    background: #fff;
}

.modificacion_activos input {

    width: 100%;
    padding: 10px;
    margin-top: 6px;
    margin-bottom: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

/* Título */
.titulo_modal {
    text-align: center;
    margin-bottom: 20px;
    font-size: 20px;
    color: #333;
}

/* Botón Cerrar */
.btn-cerrar {
    position: absolute;
    top: 10px;
    right: 10px;
    background: red;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-weight: bold;
}

/* Fila con input + botón añadir */
.fila_activos {
    display: flex;
    gap: 8px;
}

.btn-anadir {
    background: #3498db;
    border: none;
    padding: 10px 14px;
    color: white;
    border-radius: 6px;
    cursor: pointer;
}

.btn-anadir:hover {
    background: #2980b9;
}

/* Tabla */
.tabla_activos {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.tabla_activos th,
.tabla_activos td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.tabla_activos th {
    background: #f2f2f2;
    font-weight: bold;
}

/* Botón Guardar */
.btn-guardar {
    margin-top: 20px;
    width: 100%;
    background: #2ecc71;
    border: none;
    padding: 12px;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

.btn-guardar:hover {
    background: #27ae60;
}


.popup-success {
    position: fixed;
    top: 30px;
    right: 30px;
    background: #4caf50;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    font-size: 16px;
    animation: fadeIn 0.3s ease-out;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.popup-success.hide {
    opacity: 0;
    transform: translateY(-20px);
}

.popup-error {
    position: fixed;
    top: 30px;
    right: 30px;
    background: #f44336;
    /* rojo */
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    font-size: 16px;
    animation: fadeIn 0.3s ease-out;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.popup-success.hide,
.popup-error.hide {
    opacity: 0;
    transform: translateY(-20px);
}

/* Animación */
@keyframes fadeIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}