: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;
}

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);
        }

        .detalle-imagen {
            width: 100%;
            height: auto;
            overflow: hidden;
            display: flex;
            justify-content: center;
            padding: 0,2rem;
            background: #f8f9fa;
        }

        .detalle-imagen img {
            max-width: 95%;
            max-height: 900px; /* Limita altura en pantallas grandes */
            height: auto;
            object-fit: contain; /* ✅ Esto hace que la imagen se vea completa */
            border-radius: 12px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        }

        .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.3rem;
            }
            .detalle-imagen img {
                max-height: 500px;
            }
            .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);
}

.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;
}

/* Contenedor de categorías */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

/* Botones de categoría */
.category-filters a {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    background-color: #e7f3ff;
    color: #007bff;
    border: 1px solid #b3d9ff;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

/* Hover */
.category-filters a:hover {
    background-color: #d4edff;
    color: #0056b3;
}

/* Activo */
.category-filters a.active {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
}

.paginador {
    text-align: center;
    margin: 30px 0;
}

.paginador a,
.paginador span {
    display: inline-block;
    padding: 10px 15px;
    margin: 3px;
    border-radius: 8px;
    border: 1px solid #d0d7e0;
    background: #fff;
    color: #2c3e50;
    text-decoration: none;
    transition: 0.2s ease-in-out;
    font-weight: 500;
}

.paginador a:hover {
    background: #eef3ff;
    border-color: #b0c4ff;
    color: #2c3e50; /* Mantiene el color del número */
}

/* ⭐ ESTILO PARA LA PÁGINA ACTUAL ⭐ */
.paginador .actual {
    background: #2c5eff !important;
    border-color: #1e3fcc !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0px 2px 6px rgba(0,0,0,0.15);
}

/* Puntos suspensivos */
.paginador .ellipsis {
    padding: 10px 10px;
    color: #888;
    border: none;
    background: transparent;
}

.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;
}

.relacionados {
    background: #f9f9f9;
    border-left: 4px solid #e67e22;
    padding: 20px;
    margin: 30px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.relacionados h3 {
    font-size: 1.4rem;
    color: #e67e22;
    margin-bottom: 15px;
    font-weight: 600;
}

.relacionados ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.relacionados ul li {
    margin-bottom: 10px;
    transition: transform 0.2s ease, color 0.2s ease;
}

.relacionados ul li a {
    text-decoration: none;
    color: #2c3e50;
    font-weight: 500;
    display: inline-block;
}

.relacionados ul li a:hover {
    color: #e67e22;
    transform: translateX(4px);
}