:root {
    --primary-bg: #212121;
    --secondary-bg: #303030;
    --text-color: #ffffff;
    --icon-bg: #424242;
    --icon-border: #616161;
    --folder-modal-bg: rgba(45, 45, 45, 0.95); /* Fondo más oscuro para el modal */
    --button-bg: #4CAF50;
    --button-hover-bg: #45a049;
    --border-radius-lg: 15px; /* Radio de borde para el modal */
    --padding-lg: 20px;
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative; /* Necesario para posicionar el modal */
}
#folder-content{
	padding:0px;
}

.launcher-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
}

.launcher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 15px;
    padding: 10px;
    width: 100%;
    max-height: 100%;
    overflow-y: auto;
    justify-content: center;
}

/* Scrollbar styling */
.launcher-grid::-webkit-scrollbar {
    width: 8px;
}

.launcher-grid::-webkit-scrollbar-track {
    background: var(--secondary-bg);
    border-radius: 4px;
}

.launcher-grid::-webkit-scrollbar-thumb {
    background-color: var(--icon-border);
    border-radius: 4px;
}

.launcher-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    padding: 5px;
    border-radius: 8px;
    transition: background-color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.launcher-item:hover {
    background-color: var(--secondary-bg);
    transform: translateY(-3px);
}

.launcher-item img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 5px;
    border: 1px solid var(--icon-border);
    background-color: var(--icon-bg);
}

.launcher-item span {
    font-size: 0.8em;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}

/* --- ESTILOS PARA LA VENTANA MODAL DE CARPETA --- */
.folder-view {
    position: fixed; /* Fijo en la ventana */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8); /* Centrado y escalado para animación */
    background-color: var(--folder-modal-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    padding: var(--padding-lg);
    display: flex;
    flex-direction: column;
    max-width: 90%; /* Máximo 90% del ancho de la pantalla */
	min-width:50%;
    max-height: 90vh; /* Máximo 90% de la altura de la ventana */
    overflow: hidden; /* Oculta el desbordamiento principal */
    z-index: 1000;
    opacity: 0; /* Oculto por defecto */
    visibility: hidden; /* Oculto para accesibilidad */
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0.3s;
}

.folder-view.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1); /* Vuelve al tamaño normal */
}

.folder-view h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5em; /* Ligeramente más pequeño para el modal */
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--icon-border);
}

.folder-view .launcher-grid {
    flex-grow: 1; /* Permite que la cuadrícula de contenido de la carpeta ocupe el espacio */
    overflow-y: auto; /* Scroll para el contenido de la carpeta si es necesario */
    padding-right: 10px; /* Espacio para la barra de scroll */
}

.back-button {
    background-color: var(--button-bg);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em; /* Ligeramente más pequeño */
    margin-top: 15px; /* Menos margen superior */
    transition: background-color 0.2s ease;
    align-self: center; /* Centrar el botón dentro del modal */
}

.back-button:hover {
    background-color: var(--button-hover-bg);
}

/* Superposición oscura del fondo cuando el modal está activo */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Fondo semi-transparente */
    z-index: 999; /* Debajo del modal, encima del contenido principal */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-out, visibility 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}


/* Media Queries para Responsive Design */

/* Teléfonos en vertical */
@media (max-width: 600px) {
    .launcher-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); /* Iconos un poco más pequeños */
        gap: 8px;
    }

    .launcher-item img {
        width: 50px;
        height: 50px;
    }

    .launcher-item span {
        font-size: 0.7em;
    }

    .folder-view {
        max-width: 90%; /* Un poco más ancho en móviles */
		min-width: 80%;
        max-height: 85vh; /* Se adapta mejor a pantallas pequeñas */
        padding: 15px;
    }

    .folder-view h2 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }

    .back-button {
        padding: 8px 15px;
        font-size: 0.85em;
    }
}

/* Teléfonos en horizontal y tablets pequeñas */
@media (min-width: 601px) and (max-width: 900px) {
    .launcher-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    .launcher-item img {
        width: 55px;
        height: 55px;
    }
    .folder-view {
        max-width: 90%; /* Puede ser un poco más grande */
		min-width: 70%;
    }
}

/* Escritorio y tablets grandes */
@media (min-width: 901px) {
    .launcher-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 20px;
    }

    .launcher-item img {
        width: 70px;
        height: 70px;
    }

    .launcher-item span {
        font-size: 0.9em;
    }
    .folder-view {
        max-width: 600px; /* Ancho fijo para escritorios */
        max-height: 700px; /* Altura fija para escritorios */
    }
}