/*
 * =====================================================
 * frontend.css  —  Hoja de estilos unificada del frontend
 * Ubicación: /assets/css/frontend.css
 * =====================================================
 * Contiene TODOS los estilos del frontend en un solo lugar.
 * Elimina los bloques <style> dispersos en:
 *   - includes/frontend-header.php
 *   - index.php (x2 duplicado)
 *   - search.php
 *   - search_results.php
 *   - articles.php
 *
 * NOTA: Las variables CSS dinámicas (:root con colores
 * de la BD) siguen en frontend-header.php en un bloque
 * <style> mínimo porque dependen de PHP/BD.
 * Todo lo demás está aquí.
 * =====================================================
 */

/* =====================================================
   RESET Y BASE
   ===================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

a {
    transition: color 0.3s ease;
}

/* =====================================================
   ACCESIBILIDAD — SKIP LINK
   ===================================================== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: #fff;
    padding: 8px 16px;
    z-index: 9999;
    border-radius: 0 0 4px 0;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* =====================================================
   HEADER
   ===================================================== */
.site-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.header-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    display: block;
}

.header-text {
    text-align: center;
    padding: 2rem;
}

.header-text .logo {
    max-width: 200px;
    margin-bottom: 1rem;
}

.header-text h1 {
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
    font-size: 2.4rem;
}

.header-text .slogan {
    color: #555;
    font-size: 1.2rem;
}

/* =====================================================
   NAVEGACIÓN — METRO NAVBAR
   ===================================================== */
.app-bar {
    background-color: var(--menu-bg-color) !important;
    color: var(--menu-item-color);
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.app-bar .app-bar-section:first-child {
    background: transparent !important;
    padding: 0;
}

.hamburger-menu {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    margin-left: 0.5rem;
    color: var(--menu-item-color) !important;
}

.hamburger-menu:hover {
    background: var(--menu-item-hover-bg) !important;
}

.app-bar-menu > li > a {
    color: var(--menu-item-color) !important;
    font-weight: 500;
    padding: 0.9rem 1.2rem;
    transition: background 0.3s, color 0.3s;
}

.app-bar-menu > li > a:hover {
    background-color: var(--menu-item-hover-bg) !important;
    color: var(--menu-item-color) !important;
}

.app-bar-menu > li > a.current {
    background-color: var(--menu-item-active-bg) !important;
    color: var(--menu-item-active-color) !important;
}

.d-menu {
    background-color: var(--menu-bg-color) !important;
}

.d-menu li a {
    color: var(--menu-item-color) !important;
    padding: 0.7rem 1rem;
    display: block;
    transition: background 0.3s;
}

.d-menu li a:hover {
    background-color: var(--menu-item-hover-bg) !important;
}

/* =====================================================
   REDES SOCIALES — NAVBAR
   ===================================================== */
.app-bar .ml-auto {
    margin-left: auto !important;
}

.social-icons-navbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 15px;
}

.social-icons-navbar a {
    color: var(--menu-item-color) !important;
    font-size: 1.1em;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.social-icons-navbar a:hover {
    transform: scale(1.2);
    background-color: rgba(255, 255, 255, 0.1);
}

/* =====================================================
   REDES SOCIALES — GRID (widget en páginas)
   ===================================================== */
.social-icons-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
}

.social-icons-grid a {
    transition: all 0.3s ease;
}

.social-icons-grid a:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.social-icons-grid .button.icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.social-icons-grid .button.icon span {
    font-size: 24px;
}

/* =====================================================
   LAYOUT — COLUMNAS
   ===================================================== */
.main-layout-container {
    width: 100%;
}

.main-layout-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--column-spacing);
    padding: var(--content-padding);
}

.center-column {
    flex: 1;
    min-width: 0;
}

/* =====================================================
   WIDGETS
   ===================================================== */
.widget {
    margin-bottom: 20px;
}

.widget .card-header {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    font-weight: bold;
}

.widget .card-content {
    background: #fff;
}

.widget a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s, background 0.3s;
}

.widget a:hover {
    color: var(--primary-color);
    background-color: #f5f5f5;
}

/* =====================================================
   TÍTULOS CON COLORES DINÁMICOS
   (color se sobreescribe desde :root en el header PHP)
   ===================================================== */
h1, .h1 { color: var(--h1-color) !important; background-color: var(--h1-bg-color); }
h2, .h2 { color: var(--h2-color) !important; background-color: var(--h2-bg-color); }
h3, .h3 { color: var(--h3-color) !important; background-color: var(--h3-bg-color); }
h4, .h4 { color: var(--h4-color) !important; background-color: var(--h4-bg-color); }
h5, .h5 { color: var(--h5-color) !important; background-color: var(--h5-bg-color); }
h6, .h6 { color: var(--h6-color) !important; background-color: var(--h6-bg-color); }

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    margin-top: 3rem;
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease forwards;
}

.card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.card-header {
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(27, 161, 226, 0);
    transition: background 0.3s ease;
}

.card:hover .card-header::after {
    background: rgba(27, 161, 226, 0.1);
}

.card-header img {
    transition: transform 0.3s ease;
}

.card:hover .card-header img {
    transform: scale(1.05);
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
    line-height: 1.4;
}

.card-title a {
    transition: color 0.3s ease;
}

.card-title a:hover {
    color: #1ba1e2;
}

.card-footer {
    padding: 15px;
    background: #f8f8f8;
    border-top: 1px solid #e0e0e0;
}

/* Animación escalonada para listas de cards */
.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
.card:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   BADGES
   ===================================================== */
.badge.inline {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 8px;
}

.badge.bg-blue   { background-color: #1ba1e2; }
.badge.bg-orange { background-color: #fa6800; }
.badge.fg-white  { color: white; }

/* =====================================================
   ALERTAS / REMARKS
   ===================================================== */
.remark {
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

.remark.success   { background: #d4edda; border: 1px solid #c3e6cb; color: #155724; }
.remark.warning   { background: #fff3cd; border: 1px solid #ffeaa7; color: #856404; }
.remark.alert     { background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; }
.remark.secondary { background: #e2e3e5; border: 1px solid #d6d8db; color: #383d41; }
.remark.info      { background: #d1ecf1; border: 1px solid #bee5eb; color: #0c5460; }

/* =====================================================
   BOTONES
   ===================================================== */
.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.button.primary         { background: #1ba1e2; color: white; }
.button.primary:hover   { background: #1587c1; }
.button.disabled        { background: #ccc; color: #666; cursor: not-allowed; opacity: 0.6; }
.button.w-100           { width: 100%; justify-content: center; }

/* =====================================================
   ACTIVIDADES — TABS
   ===================================================== */
.tabs-pills {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.tabs-pills li { margin: 0; }

.tabs-pills li a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tabs-pills li a:hover {
    background: #e8e8e8;
    border-color: #d0d0d0;
    transform: translateY(-2px);
}

.tabs-pills li.active a {
    background: #1ba1e2;
    color: white;
    border-color: #1ba1e2;
}

.tabs-pills li.active a [class^="mif-"],
.tabs-pills li.active a [class*=" mif-"] { color: white !important; }

.tabs-pills li:not(.active) a [class^="mif-calendar"],
.tabs-pills li:not(.active) a [class*=" mif-calendar"] { color: #1ba1e2; }

.tabs-pills li:not(.active) a [class^="mif-checkmark"],
.tabs-pills li:not(.active) a [class*=" mif-checkmark"] { color: #27ae60; }

.tabs-pills li:not(.active) a [class^="mif-history"],
.tabs-pills li:not(.active) a [class*=" mif-history"]   { color: #7f8c8d; }

.tabs-pills li:not(.active) a [class^="mif-list"],
.tabs-pills li:not(.active) a [class*=" mif-list"]      { color: #9b59b6; }

/* =====================================================
   ACTIVIDADES — DETALLE
   ===================================================== */
.activity-meta {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.activity-meta p {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.activity-meta strong { font-weight: 600; color: #555; }
.activity-meta [class^="mif-"] { color: #1ba1e2; font-size: 1.1rem; }

.activity-detail h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.2;
}

.activity-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
}

.activity-item {
    background: white;
    transition: all 0.3s ease;
}

.activity-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}

.activity-item h3 { font-size: 1.5rem; margin: 0 0 10px 0; }
.activity-item h3 a { color: #333; text-decoration: none; transition: color 0.3s ease; }
.activity-item h3 a:hover { color: #1ba1e2; }

.activity-item .activity-meta {
    background: transparent;
    padding: 0;
    border: none;
    font-size: 0.9rem;
    color: #666;
}

.activity-separator {
    height: 1px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
    margin: 30px 0;
}

/* =====================================================
   BLOG
   ===================================================== */
.blog-post h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.2;
}

.blog-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #666;
    font-size: 0.9rem;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

.blog-meta [class^="mif-"] { color: #1ba1e2; }

.blog-content { font-size: 1.1rem; line-height: 1.8; color: #555; }
.blog-content img { max-width: 100%; height: auto; border-radius: 8px; margin: 20px 0; }
.blog-content p { margin-bottom: 1.2rem; }
.blog-content h2 { font-size: 1.8rem; margin-top: 2rem; margin-bottom: 1rem; color: #333; }
.blog-content h3 { font-size: 1.5rem; margin-top: 1.5rem; margin-bottom: 0.8rem; color: #333; }

/* =====================================================
   ARTÍCULOS — DETALLE
   ===================================================== */
.article-full {
    max-width: 800px;
    margin: 0 auto;
}

.article-full-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.article-full-content { line-height: 1.8; font-size: 1.1rem; }
.article-full-content p { margin-bottom: 1.5rem; }
.article-full-content h2 { margin-top: 2rem; margin-bottom: 1rem; color: var(--secondary-color); }
.article-full-content img { max-width: 100%; height: auto; border-radius: 4px; margin: 1rem 0; }

/* =====================================================
   BÚSQUEDA
   ===================================================== */
.widget-search .search-form { margin: 0; }

.widget-search input[type="search"] {
    width: 100%;
    border: none;
    outline: none;
}

.widget-search button {
    background-color: var(--primary-color, #1eb3a6);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.widget-search button:hover {
    background-color: var(--primary-color-dark, #189d91);
}

.search-results .card {
    transition: transform 0.3s, box-shadow 0.3s;
}

.search-results .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-highlight {
    background-color: #ffeb3b;
    font-weight: bold;
    padding: 0 2px;
}

/* =====================================================
   ICONOS — COLORES SEMÁNTICOS
   ===================================================== */
[class^="mif-calendar"], [class^="mif-clock"] { color: #1ba1e2; }
[class^="mif-location"]  { color: #e74c3c; }
[class^="mif-users"]     { color: #27ae60; }
[class^="mif-star"]      { color: #f39c12; }
[class^="mif-flow-tree"] { color: #9b59b6; }
[class^="mif-alarm"]     { color: #e67e22; }
[class^="mif-checkmark"] { color: #27ae60; }
[class^="mif-cross"],
[class^="mif-blocked"]   { color: #c0392b; }
[class^="mif-history"]   { color: #7f8c8d; }

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state [class^="mif-"] { font-size: 4rem; color: #ddd; margin-bottom: 20px; }

/* =====================================================
   GRID RESPONSIVE
   ===================================================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.row > [class*="cell-"] { padding: 0 15px; }

/* =====================================================
   UTILIDADES
   ===================================================== */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 1rem; }
.p-4  { padding: 1.5rem; }
.d-flex { display: flex; }
.flex-justify-center { justify-content: center; }
.w-100 { width: 100%; }
.text-small { font-size: 0.9rem; color: #666; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {

    .header-text h1        { font-size: 1.8rem; }
    .social-icons-navbar   { display: none; }

    .main-layout-grid      { flex-direction: column; }
    .left-column,
    .center-column,
    .right-column          { flex: 0 0 100%; width: 100%; }
    .left-column           { order: 1; }
    .center-column         { order: 2; }
    .right-column          { order: 3; }

    .activity-detail h1    { font-size: 2rem; }
    .card-title            { font-size: 1.1rem; }

    .tabs-pills            { flex-direction: column; width: 100%; }
    .tabs-pills li         { width: 100%; }
    .tabs-pills li a       { width: 100%; justify-content: center; }
    .activity-meta .row .cell-md-6 { width: 100%; margin-bottom: 10px; }

    .blog-post h1          { font-size: 2rem; }
    .blog-meta             { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* =====================================================
   MENÚ MÓVIL — INDICADOR ÍTEM ACTIVO
   ===================================================== */

/* Submenú desplegable: ítem activo */
.d-menu li.active > a,
.d-menu li > a.current {
    background-color: var(--menu-item-active-bg) !important;
    color: var(--menu-item-active-color) !important;
    font-weight: 600;
    border-left: 3px solid var(--menu-item-active-color);
    padding-left: calc(1rem - 3px);
}

/* Padre con hijo activo: resaltar también */
.app-bar-menu > li.active-parent > a {
    background-color: var(--menu-item-active-bg) !important;
    color: var(--menu-item-active-color) !important;
}

/* En móvil (menú desplegado verticalmente): indicador más visible */
@media (max-width: 768px) {
    .d-menu li.active > a,
    .d-menu li > a.current {
        border-left-width: 4px;
        background-color: rgba(255,255,255,0.15) !important;
    }
}

/* =====================================================
   IMÁGENES DE BLOG — card list
   ===================================================== */
.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}