/* styles.css */

/* Variables de Color */
:root {
    --primary-color: #007bff;
    --primary-color-darker: #0056b3;
    --secondary-color: #ffc107;
    --text-color: #212529;
    --text-color-light: #555;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-color-hover: rgba(0, 0, 0, 0.2);
    --modal-bg-color: #ffffff;
    --modal-bg-lighter: #f8f9fa;
    --modal-header-color: #f8f9fa;
    --border-radius-modal: 8px;
    --border-radius-card: 10px;
    --transition-duration: 0.2s;
    --font-family-title: 'Arial Black', sans-serif;
    --font-family-body: Arial, sans-serif;
}

/* Estilos Generales */
body {
    background-color: #f8f9fa;
    font-family: var(--font-family-body);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.header {
    background-color: white;
    padding: 15px;
    box-shadow: 0 2px 4px var(--shadow-color);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Se eliminó el título "Servicios" del header */

.search-bar {
    display: flex;
    align-items: center;
    width: 100%;
}

.search-input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-color: #ced4da;
}

.search-button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Contenedor de los eventos */
#contenedor-eventos {
    display: block;
    width: 100%;
    padding: 0 15px;
}

/* Encabezado del listado */
.list-header {
    background-color: var(--primary-color);
    border-radius: var(--border-radius-card);
    padding: 10px;
    text-align: center;
    color: #fff;
    font-weight: bold;
    width: 100%;
    margin-bottom: 15px;
}

/* Mensaje de no hay resultados */
.no-results {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: var(--border-radius-card);
    text-align: center;
    font-weight: bold;
    width: 100%;
    margin-bottom: 15px;
}

/* --- Tarjetas (Cards) --- */
.event-card {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    margin: 8px 0;
    padding: 10px;
    background-color: var(--modal-bg-lighter);
    border-radius: var(--border-radius-card);
    box-shadow: 0 2px 5px var(--shadow-color);
    border: 1px solid #eee;
    transition: transform var(--transition-duration) ease, box-shadow var(--transition-duration) ease;
}

.event-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
    background-color: white;
    border-color: #ddd;
}

.event-image {
    height: 50px;
    width: 50px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    margin-right: 10px;
    border: 1px solid #eee;
}

.event-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.event-details h6 {
    font-size: 0.9rem;
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.event-category-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 100%;
}

.event-sector-line {
    font-size: 0.7rem;
    background-color: #e0e0e0;
    color: #333;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    white-space: normal;
    word-break: break-word;
}

.subcategories-line {
    white-space: normal;
    word-break: break-word;
}

.event-category {
    display: inline-block;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-right: 4px;
    white-space: normal;
    word-break: break-word;
}

.event-actions {
    flex-shrink: 0;
    margin-left: 10px;
    text-align: right;
}

.event-actions .btn-ver-mas {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-duration) ease;
    box-shadow: 0 1px 1px var(--shadow-color);
    font-size: 1rem;
    line-height: 1;
}

.event-actions .btn-ver-mas:hover {
    background-color: var(--primary-color-darker);
    box-shadow: 0 2px 3px var(--shadow-color-hover);
}

.event-actions .btn-ver-mas:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.5);
}

/* --- Modal y otros estilos (sin cambios esenciales) --- */
.bottom-sheet-modal .modal-dialog {
    position: fixed;
    margin: 0;
    width: 100%;
    max-height: 99%;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: transform var(--transition-duration) ease-out;
    transform: translateY(100%);
}

.bottom-sheet-modal.show .modal-dialog {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .bottom-sheet-modal .modal-dialog {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 95%;
        max-width: 1000px;
        max-height: 98vh;
        bottom: auto;
        display: block;
    }
}

.modal-content {
    border-radius: var(--border-radius-modal);
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow-color);
    border: none;
}

.modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color-section);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--modal-bg-lighter);
}

.modal-title {
    font-size: 1.4rem;
    font-family: var(--font-family-title);
    font-weight: 500;
    color: var(--text-color-title);
    margin-bottom: 0;
    text-align: left;
    letter-spacing: 0;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: 82vh;
    background-color: var(--modal-bg-color);
}

.modal-image-container {
    border-radius: var(--border-radius-modal);
    overflow: hidden;
    margin-bottom: 15px;
    max-height: 120px;
    box-shadow: 0 1px 2px var(--shadow-color);
    margin-top: 10px;
}

.modal-image {
    border-radius: 0;
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
    display: block;
    transition: transform 0.2s ease;
    opacity: 1;
}

.modal-image:hover {
    transform: scale(1.01);
    opacity: 1;
}

.modal-description {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-color-body);
    margin-top: 10px;
    text-align: left;
}

.servicio-contenido {
    margin-bottom: 18px;
}

.servicio-contacto {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color-section);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.servicio-contacto p {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    font-size: 0.85rem;
    color: var(--text-color-body);
}

.servicio-contacto i {
    margin-right: 8px;
    color: var(--primary-color);
    font-size: 1rem;
    flex-shrink: 0;
    opacity: 1;
}

#modal-telefono {
    margin-left: 5px;
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    font-size: 0.9rem;
}

#modal-telefono:hover {
    color: var(--primary-color-darker);
    text-decoration: underline;
}

.modal-footer {
    padding: 12px 20px 16px 20px;
    border-top: none;
    justify-content: flex-start;
    background-color: var(--modal-bg-lighter);
    border-radius: 0 0 var(--border-radius-modal) var(--border-radius-modal);
}

.modal-footer .btn-secondary {
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 400;
    border: 1px solid var(--text-color_light);
    color: var(--text-color_light);
    background-color: transparent;
}

.modal-footer .btn-secondary:hover {
    background-color: var(--modal-bg-color);
    color: var(--text-color);
    border-color: var(--text-color);
}

/* Loader */
#loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
    display: none;
}

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

/* Loader Overlay */
#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    display: none;
}

/* Responsive Ajustes para Subcategorías y Modal */
@media (max-width: 576px) {
    .event-category {
        max-width: 120px;
        font-size: 0.65rem;
    }
    .modal-title {
        font-size: 1.5rem;
    }
    .modal-description {
        font-size: 0.85rem;
    }
    .modal-dialog {
        max-height: 100%;
        border-radius: 0;
    }
    .modal-content {
        border-radius: 0;
    }
    .modal-header {
        padding-bottom: 10px;
        padding-top: 16px;
        border-radius: 0;
    }
    .modal-body {
        max-height: 82vh;
        padding-right: 16px;
        padding-left: 16px;
    }
    .servicio-contacto {
        gap: 5px;
        margin-top: 12px;
    }
    .servicio-contacto p,
    #modal-telefono,
    .modal-footer .btn-secondary {
        font-size: 0.85rem;
    }
    .modal-footer {
        padding-top: 12px;
        padding-bottom: 16px;
    }
    .modal-image-container {
        max-height: 140px;
        margin-bottom: 10px;
    }
    .modal-image {
        max-height: 140px;
    }
}

/* Estilos para admin.php */
#admin-columns-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
}

#admin-form-column {
    width: 40%;
    padding-right: 20px;
}

#admin-list-column {
    width: 60%;
}

@media (max-width: 768px) {
    #admin-columns-container {
        flex-direction: column;
    }
    #admin-form-column, #admin-list-column {
        width: 100%;
        padding-right: 0;
    }
    #admin-form-column {
        margin-bottom: 20px;
    }
}

/* Imagen de previsualización en el formulario (admin.php) */
.preview-image {
    max-width: 100%;
    height: auto;
    display: none;
    margin-bottom: 10px;
}

/* Footer del modal en admin.php */
.modal-footer-admin {
    flex-direction: column;
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    padding: 15px 0;
}
.modal-footer-admin .btn-primary {
    margin-bottom: 10px;
}
.limpiar-formulario-container {
    text-align: left;
}


/* Estilo para el botón de limpiar caché */
.clear-cache-button {
    background-color: var(--primary-color);
    color: #fff;
    margin-left: 6px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.clear-cache-button:hover {
    background-color: var(--primary-color-darker);
}
