:root {
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --accent-color: #4fc3f7;
    --text-color: #333;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --border-radius: 12px;
    --card-padding: 1.2rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

.container-full {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 15px;
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    text-align: center;
    padding: 1.8rem 1rem;
    margin-bottom: 1.8rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(74, 111, 165, 0.8) 0%, rgba(22, 96, 136, 0.9) 100%);
    z-index: 1;
}

header > * {
    position: relative;
    z-index: 2;
}

h1 {
    font-size: 2.2rem;
    margin-bottom: 0.4rem;
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.8rem;
    align-items: center;
    justify-content: center;
}

.search-container {
    width: 100%;
    max-width: 400px;
}

.search-box {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #ddd;
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
    background: white;
}

.search-box:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.2);
}

.category-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.category-btn {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.category-btn:hover,
.category-btn.active {
    background: var(--primary-color);
    color: white;
}

.reflexion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.reflexion-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-image {
    height: 200px;
    overflow: hidden;
    position: relative;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* ✅ Así se ve completa, sin recortar */
    transition: var(--transition);
}

/* Efecto de zoom solo si la imagen es grande */
.reflexion-card:hover .card-image img {
    transform: scale(1.05);
}

.card-content {
    padding: var(--card-padding);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    color: var(--secondary-color);
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

.card-text {
    color: var(--text-color);
    margin-bottom: 1rem;
    flex-grow: 1;
    font-size: 1rem;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.8rem;
    border-top: 1px solid #eee;
    color: #666;
    font-size: 0.85rem;
}

.date {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.likes {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #e74c3c;
    cursor: pointer;
    transition: var(--transition);
}

.likes:hover {
    transform: scale(1.1);
}

.btn {
    display: block;
    background: var(--accent-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    text-align: center;
    margin: 1.5rem auto;
    width: 220px;
    text-decoration: none;
    opacity: 0;
    animation: fadeIn 0.5s 0.2s forwards;
}

.btn:hover {
    background: #0288d1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.loading {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-color);
    font-size: 1.1rem;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #666;
    font-size: 1.1rem;
}

/* ---------------------------
   Footer
--------------------------- */
.footer {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: #ddd;
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  border-top: 1px solid #444;
  margin-top: 2rem;
}

.footer a {
  color: #bbb;
  transition: color 0.3s ease;
}

.footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  font-size: 0.95em;
  margin-top: 0.5em;
}

.footer-links a {
  color: var(--link);
  text-decoration: none;
  white-space: nowrap;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Llave extra eliminada aquí */

.floating-add {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    font-size: 1.4rem;
    z-index: 100;
}

.floating-add:hover {
    transform: scale(1.1);
    background: #0288d1;
}


/* === MODAL === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 1rem;
}

.modal-content {
    background: white;
    padding: 1.8rem;
    border-radius: var(--border-radius);
    width: 95%;
    max-width: 500px;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1);
    animation: modalFadeIn 0.3s forwards;
    margin: 1rem auto;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #eee;
}

.modal-title {
    font-size: 1.4rem;
    color: var(--primary-color);
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.2);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.submit-btn {
    background: var(--primary-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    width: 100%;
}

.submit-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* === TOAST === */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4caf50;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* === RESPONSIVE (móviles) === */
@media (max-width: 768px) {
    h1 {
        font-size: 1.9rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .container {
        padding: 12px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        max-width: 100%;
    }

    .category-filters {
        justify-content: center;
    }

    .category-btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .reflexion-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .card-title {
        font-size: 1.2rem;
    }

    .card-text {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .card-footer {
        font-size: 0.8rem;
    }

    .btn {
        width: 100%;
        max-width: 300px;
        font-size: 1.05rem;
    }

    .floating-add {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
        bottom: 15px;
        right: 15px;
    }

    .modal-content {
        padding: 1.5rem;
    }

    footer {
        font-size: 0.85rem;
        padding: 1.5rem 0;
    }
}

/* Para pantallas muy pequeñas (móviles estrechos) */
@media (max-width: 480px) {
    h1 {
        font-size: 1.7rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .card-text {
        -webkit-line-clamp: 3;
    }

    .reflexion-card {
        padding: 0.5rem;
    }

    .card-content {
        padding: 1rem;
    }

    .btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.95rem;
    }
}
    
        /* Estilos específicos para la página de reflexión */
        .reflexion-detalle {
            max-width: 800px;
            margin: 2rem auto;
            background: white;
            border-radius: 15px;
            overflow: hidden;
            box-shadow: var(--shadow);
        }

       /* Imagen principal responsive */
/* Contenedor de imagen */
.detalle-imagen {
    width: 100%;
    max-width: 100%; /* permitir que ocupe todo el ancho posible */
    margin: 1.5rem auto;
    padding: 0 1rem; /* espacio lateral en móvil */
    display: flex;
    justify-content: center;
}

/* Imagen */
.detalle-imagen img {
    width: 100%;       /* ocupa todo el ancho del contenedor */
    height: auto;      /* mantiene proporción */
    max-width: 800px;  /* límite de ancho en desktop */
    object-fit: contain; /* se ve completa sin recortar */
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: block;
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    .detalle-imagen img {
        max-width: 100%; /* ocupa todo el ancho disponible */
    }
}

@media (max-width: 480px) {
    .detalle-imagen {
        padding: 0.5rem;
    }
    .detalle-imagen img {
        max-height: none; /* quitar límite de altura */
    }
}

        .detalle-contenido {
            padding: 2rem;
        }

        .detalle-titulo {
            color: var(--secondary-color);
            font-size: 1.8rem;
            margin-bottom: 1rem;
            line-height: 1.3;
        }

        .detalle-texto {
            font-size: 1.1rem;
            line-height: 1.8;
            white-space: pre-line;
            color: var(--text-color);
            margin-bottom: 1.5rem;
        }

        .detalle-meta {
            margin-top: 1.5rem;
            color: #666;
            font-size: 0.9rem;
            border-top: 1px solid #eee;
            padding-top: 1rem;
        }

        .btn-volver {
            display: inline-block;
            margin: 1rem auto 2rem;
            background: var(--primary-color);
            color: white;
            padding: 0.8rem 1.5rem;
            border: none;
            border-radius: 50px;
            text-decoration: none;
            font-weight: 600;
            transition: var(--transition);
        }

        .btn-volver:hover {
            background: var(--secondary-color);
            transform: translateY(-2px);
        }

        /* Responsive */
        @media (max-width: 480px) {
            .reflexion-detalle {
                margin: 1rem;
                border-radius: 12px;
            }
            .detalle-imagen {
                padding: 0.8rem;
            }
            .detalle-imagen img {
                max-height: 300px;
            }
            .detalle-titulo {
                font-size: 1.5rem;
            }
            .detalle-contenido {
                padding: 1.5rem;
            }
        }
/* ---------------------------
   Botón Flotante: Subir Arriba
--------------------------- */
#btn-subir {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #f0f0f0;
  color: #333;
  font-size: 20px;
  text-decoration: none;
  border-radius: 50%;
  padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  display: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
}

#btn-subir:hover {
  background-color: #e0e0e0;
  transform: translateY(-2px);
}

/* ---------------------------
   BOTONES DE COMPARTIR solo index.php
--------------------------- */
.share-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.3s ease, transform 0.2s;
    color: white;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-btn.whatsapp {
    background: #25D366;
}

.share-btn.facebook {
    background: #1877F2;
}

.share-btn.twitter {
    background: #000;
}

.form-busqueda {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    gap: 10px;
    flex-wrap: wrap;
}

.input-busqueda {
    padding: 10px 15px;
    font-size: 1rem;
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    width: 100%;
    max-width: 300px;
    box-shadow: var(--shadow);
}

.boton-buscar {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.boton-buscar:hover {
    background-color: var(--secondary-color);
}

.paginador {
  display: flex;
  justify-content: center;
  margin: 40px 0 20px;
}

.paginador ul {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.paginador li {
  display: inline-block;
}

.paginador a,
.paginador li.active a {
  display: inline-block;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--primary-color, #004d40);
  border: 1px solid var(--primary-color, #004d40);
  border-radius: 6px;
  font-weight: 600;
  background-color: #fff;
  transition: background-color 0.3s, color 0.3s;
}

.paginador li.active a,
.paginador a:hover {
  background-color: var(--primary-color, #004d40);
  color: #fff;
}

.ver-mas {
  display: inline-block;
  margin: 10px auto 0; /* margen superior + centrado */
  padding: 8px 16px;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: background-color 0.3s ease;
  text-align: center;
}

.ver-mas:hover {
  background-color: var(--secondary-color);
}


.reflexion-card-link {
  text-decoration: none;
  color: inherit;
}

.reflexion-card-link:hover {
  text-decoration: none;
  color: inherit;
}

.resaltado {
  color: #c0392b;
  font-weight: bold;
}

.boton-header {
  display: inline-block;
  padding: 10px 16px;
  margin-left: 10px;
  background-color: #25D366;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;
  font-size: 14px;
  transition: background-color 0.3s;
}

.boton-header:hover {
  background-color: #1ebc59;
}

/* BADGE para videos */
.card-image {
    position: relative;
}

.video-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(45deg, #ff0000, #cc0000);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 5px;
}

.section-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.section-links .btn-link {
    background: #007bff;
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s ease;
}

.section-links .btn-link:hover {
    background: #0056b3;
}

.keyword-link {
    background-color: #fff59d;  /* Fondo amarillo */
    color: #333;                /* Texto negro */
    text-decoration: none;      /* Sin subrayado */
    padding: 0.1em 0.3em;      /* Espacio alrededor */
    border-radius: 4px;         /* Bordes redondeados */
    transition: background 0.3s ease;
}

.keyword-link:hover {
    background-color: #fff176;  /* Amarillo más intenso al pasar mouse */
    color: #333;
}

/* Contenedor de imagen y video */
.detalle-imagen,
.detalle-video {
    width: 100%;
    max-width: 100%;
    margin: 1.5rem auto;
    padding: 0 1rem; /* espacio lateral en móvil */
    display: flex;
    justify-content: center;
}

/* Imagen dentro del contenedor */
.detalle-imagen img,
.youtube-wrapper img {
    width: 100%;       /* ocupa todo el ancho posible */
    height: auto;      /* mantiene proporción */
    max-width: 800px;  /* límite de ancho en desktop */
    object-fit: contain; 
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: block;
}

/* Icono de play para video centrado */
.youtube-wrapper > div {
    font-size: 60px;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    .detalle-imagen img,
    .youtube-wrapper img {
        max-width: 100%; 
    }
}

@media (max-width: 480px) {
    .detalle-imagen,
    .detalle-video {
        padding: 0.5rem;
    }
    .detalle-imagen img,
    .youtube-wrapper img {
        max-height: none; 
    }
}

/* ===== ACCESIBILIDAD: Texto solo para lectores de pantalla ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== MEJORA DE CONTRASTE PARA TAGS ===== */
.etiquetas a {
    color: #0056b3 !important; /* Más contraste sobre fondo claro */
}
.etiquetas a:hover {
    color: #003d82 !important;
}

/* ===== OPTIMIZACIÓN DE IMÁGENES ===== */
.detalle-imagen img,
.card-image img {
    display: block;
    max-width: 100%;
    height: auto;
    will-change: transform;
}

/* ===== YOUTUBE WRAPPER ===== */
.youtube-wrapper {
    position: relative;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
}
.youtube-wrapper .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.2s ease;
}
.youtube-wrapper:hover .play-icon {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Al final de tu archivo css/estilo.css */

/* ===== FRASE DESTACADA ===== */
.frase-destacada {
    text-align: center;
    margin: 2.5rem auto;
    max-width: 750px;
    padding: 2rem 2.5rem;
    background: #ffffff;
    border: 1px solid #e0e7ff;
    border-left: 4px solid #4f46e5;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.frase-destacada:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}
.frase-destacada p {
    margin: 0;
    font-size: 1.15rem;
    font-style: italic;
    color: #4b5563;
    line-height: 1.7;
}
@media (max-width: 768px) {
    .frase-destacada {
        margin: 2rem 1rem;
        padding: 1.5rem;
    }
    .frase-destacada p {
        font-size: 1rem;
    }
}
.widget-busquedas {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
}
.widget-busquedas h3 {
    margin-top: 0;
    font-size: 16px;
}
.widget-busquedas ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.widget-busquedas li {
    padding: 5px 0;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
}
.widget-busquedas li:last-child {
    border-bottom: none;
}
.widget-busquedas a {
    color: #0066cc;
    text-decoration: none;
}
.widget-busquedas a:hover {
    text-decoration: underline;
}
.widget-busquedas span {
    color: #666;
    font-size: 12px;
}