/* Estilos generales del contenedor */
.contenedor-programacion {
    max-width: 600px;
    margin: 40px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.titulo-formulario {
    color: #1a73e8; /* Un azul vibrante */
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

/* Estilos de los grupos de entrada */
.input-grupo {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

input[type="text"], input[type="time"] {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus, input[type="time"]:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
    outline: none;
}

/* Contenedor de Días y Botones Dinámicos */
.dias-contenedor {
    display: flex;
    gap: 5px;
    flex-wrap: wrap; /* Permite que los botones salten de línea en pantallas pequeñas */
    padding: 5px 0;
}

.dia-btn {
    padding: 10px 12px;
    border: 2px solid #ccc;
    border-radius: 50%; /* Botones circulares */
    background-color: #f7f7f7;
    color: #555;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    width: 45px; /* Tamaño fijo */
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dia-btn:hover {
    background-color: #e0e0e0;
    border-color: #999;
}

/* Estado seleccionado */
.dia-btn.seleccionado {
    background-color: #4CAF50; /* Verde brillante */
    color: white;
    border-color: #4CAF50;
    transform: scale(1.1); /* Efecto dinámico */
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

/* Estilos para las franjas horarias */
.horario-grupo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    border: 1px dashed #ddd;
    border-radius: 8px;
}

.horario-grupo input[type="time"] {
    width: 120px;
}

.horario-grupo span {
    font-weight: 500;
    color: #555;
}

/* Botones de acción */
.btn-principal {
    width: 100%;
    padding: 12px;
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.btn-principal:hover {
    background-color: #1558b3;
}

.btn-secundario {
    padding: 8px 15px;
    background: none;
    color: #1a73e8;
    border: 1px solid #1a73e8;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 10px;
}

.btn-secundario:hover {
    background-color: #e8f0fe;
}

.btn-eliminar-horario {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    color: #ff4d4f;
    transition: transform 0.2s;
}
.btn-eliminar-horario:hover {
    transform: scale(1.2);
}

/* Mensajes de estado */
.mensaje-estado { /* Corregido: Usar .mensaje-estado en lugar de .mensaje-oculto */
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    margin-top: 20px;
    display: none;
}
.mensaje-estado.exito {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.mensaje-estado.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* --- Estilos para la Lista de Programación (Mejorado) --- */
.lista-programacion-contenedor {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}
.lista-programacion {
    list-style: none;
    padding: 0;
}
/* Clase para el contenedor de cada elemento de la lista */
.programa-item {
    background-color: #f9f9f9;
    margin-bottom: 10px;
    padding: 15px; 
    border-left: 5px solid #1a73e8;
    border-radius: 8px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    
    /* Flexbox para alinear contenido (info) y acciones (botones) */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
}

.programa-item:hover {
    background-color: #f0f0f0;
}

.programa-info {
    flex-grow: 1; /* Permite que la información ocupe el espacio restante */
}

.programa-info strong {
    color: #1a73e8; 
    font-size: 1.1em;
    display: block;
    margin-bottom: 5px;
}
/* Estilo para los días resaltados */
.programa-info small {
    display: block;
    color: #666;
    margin-top: 3px;
    line-height: 1.4; /* Mejora la lectura en pantallas pequeñas */
}
.dia-resaltado {
    font-weight: bold;
    color: #d9534f; /* Rojo para destacar el día */
}

/* --- Estilos de los botones de acción (Editar y Eliminar) --- */
.programa-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0; /* Evita que los botones se encojan en pantallas pequeñas */
}

.btn-action {
    /* Estilos base para los botones circulares */
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, transform 0.2s;
}

.btn-edit {
    color: #ffc107; /* Amarillo para Editar */
}

.btn-edit:hover {
    background-color: #ffc10720; /* Fondo transparente con toque amarillo */
    transform: scale(1.1);
}

.btn-delete {
    color: #ff4d4f; /* Rojo para Eliminar */
}

.btn-delete:hover {
    background-color: #ff4d4f20; /* Fondo transparente con toque rojo */
    transform: scale(1.1);
}

/* ======================================= */
/* MEDIA QUERIES PARA RESPONSIVIDAD MÓVIL */
/* ======================================= */

/* 1. Ajustes generales para cualquier pantalla menor a 650px */
@media (max-width: 650px) {
    .contenedor-programacion {
        /* Reduce el margen y el padding en pantallas más pequeñas */
        margin: 20px 10px; 
        padding: 20px; 
    }
}

/* 2. Ajustes específicos para el grupo de horarios en móviles pequeños (< 400px) */
@media (max-width: 400px) {
    .horario-grupo {
        /* Permite que los elementos se envuelvan para evitar desbordamiento */
        flex-wrap: wrap; 
        justify-content: space-between; /* Distribuye elementos horizontalmente */
    }
    .horario-grupo input[type="time"] {
        /* Los inputs de tiempo ocupan casi la mitad del ancho para que quepan dos por línea */
        width: 45%; 
    }
    .horario-grupo span {
        /* El separador 'a' fuerza el salto de línea para el botón de eliminar */
        width: 100%; 
        text-align: center;
        margin: -5px 0; /* Ajuste para el espacio */
    }
}

/* 3. Ajustes para la lista de programación (ya incluido, pero crucial) */
@media (max-width: 480px) {
    .programa-item {
        flex-direction: column; /* Apila el contenido y los botones */
        align-items: flex-start;
    }
    .programa-actions {
        width: 100%;
        justify-content: flex-end; /* Mueve los botones a la derecha */
        margin-top: 10px;
        padding-top: 5px;
        border-top: 1px dotted #e0e0e0;
    }
}