/**
 * Single Post Styles
 * Plantilla individual de post con sistema de votación
 */

/* ==========================================================================
   CORREGIR PADDING DE GENERATEPRESS EN POSTS
   ========================================================================== */

/* Solo eliminar el padding extra que GeneratePress agrega al grid-container */
body.single .grid-container {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
}

/* Eliminar padding del site-content para que respete el padding de single-post-container */
body.single .site-content {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
}

/* Fondo blanco para posts individuales */
body.single {
    background: white !important;
}

/* Permitir ancho completo en contenedores de GeneratePress */
body.single .site,
body.single #page,
body.single #content {
    max-width: 100% !important;
}

/* ==========================================================================
   WRAPPER Y CONTAINER
   ========================================================================== */

.single-post-wrapper {
    background: white;
    min-height: 100vh;
    padding: 60px 0 60px;
}

.single-post-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 80px;
}

/* ==========================================================================
   LAYOUT PRINCIPAL CON SIDEBAR
   ========================================================================== */

.single-post-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    align-items: start;
}

/* ==========================================================================
   ARTÍCULO PRINCIPAL
   ========================================================================== */

.single-post-article {
    background: white;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Imagen Destacada - Hero Banner */
.post-featured-image {
    margin: 0;
    width: 100%;
    height: 400px;
    overflow: hidden;
    background: #f5f5f5;
}

.featured-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.featured-img.default-banner {
    opacity: 0.9;
}

/* Breadcrumb de Categorías */
.post-categories-breadcrumb {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 35px 40px 0 40px;
}

.category-badge {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.category-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 168, 148, 0.3);
}

/* Header del Post */
.post-header {
    padding: 0 40px;
    margin: 25px 0 0 0;
    position: relative;
}

.post-title {
    font-size: 34px;
    font-weight: 900;
    line-height: 1.15;
    color: var(--color-text);
    margin: 0 0 20px 0;
    letter-spacing: -0.5px;
}

/* Meta Información */
.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 14px;
    color: var(--color-text-light);
    padding-bottom: 30px;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 50%, transparent 100%);
    border-image-slice: 1;
    margin-bottom: 40px;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text);
}

.post-author img {
    border-radius: 50%;
    border: 2px solid var(--color-primary);
}

.post-author strong {
    font-weight: 700;
    font-size: 15px;
}

.meta-separator {
    color: var(--color-primary);
    font-weight: 700;
}

.post-date,
.post-reading-time {
    color: var(--color-text-light);
    font-size: 14px;
}

/* ==========================================================================
   SISTEMA DE VOTACIÓN
   ========================================================================== */

.post-rating-section {
    padding: 0;
    margin: 0;
    text-align: center;
}

.rating-interactive-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.rating-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.rating-subtitle {
    font-size: 14px;
    color: var(--color-text-light);
    margin: 0 0 5px 0;
}

.rating-stars-container {
    margin: 0;
}

.rating-stars-container .rating-interactive {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.rating-stars-container .star-btn {
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 5px;
    border-radius: 50%;
}

.rating-stars-container .star-btn:hover {
    background: rgba(251, 191, 36, 0.1);
}

.rating-stars-container .star-btn svg {
    width: 36px;
    height: 36px;
    fill: #e5e7eb;
    stroke: #d1d5db;
    stroke-width: 1;
    transition: all 0.3s ease;
}

.rating-stars-container .star-btn:hover svg,
.rating-stars-container .star-btn.hovered svg {
    fill: #fbbf24;
    stroke: #f59e0b;
    transform: scale(1.15);
}

.rating-current-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.rating-average {
    font-size: 24px;
    font-weight: 800;
    color: #fbbf24;
}

.rating-count {
    color: var(--color-text-light);
    font-size: 13px;
}

/* Estado: Ya votado */
.rating-voted {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.rating-stars-static .post-rating-stars {
    gap: 8px;
}

.rating-stars-static .star {
    width: 32px;
    height: 32px;
}

.rating-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rating-info .rating-average {
    font-size: 28px;
}

.rating-message {
    color: #10b981;
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    padding: 8px 16px;
    background: rgba(16, 185, 129, 0.08);
    border-radius: 20px;
}

/* ==========================================================================
   CONTENIDO DEL POST
   ========================================================================== */

.post-content {
    font-size: 17px;
    line-height: 1.8;
    color: var(--color-text);
    padding: 0 40px;
    margin: 35px 0;
}

.post-content h2 {
    font-size: 26px;
    font-weight: 700;
    margin: 40px 0 20px;
    color: var(--color-text);
}

.post-content h3 {
    font-size: 22px;
    font-weight: 600;
    margin: 35px 0 18px;
    color: var(--color-text);
}

.post-content h4 {
    font-size: 19px;
    font-weight: 600;
    margin: 30px 0 15px;
    color: var(--color-text);
}

.post-content p {
    margin-bottom: 20px;
}

.post-content ul,
.post-content ol {
    margin: 20px 0;
    padding-left: 30px;
}

.post-content li {
    margin-bottom: 10px;
}

.post-content a {
    color: var(--color-primary);
    text-decoration: underline;
}

.post-content a:hover {
    color: var(--color-secondary);
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 25px 0;
}

/* Embeds de video/redes (bloque "embed" de Gutenberg: YouTube, Facebook, Twitter/X, etc.)
   Sin esto, el iframe se achica de ancho por max-width:100% pero conserva su alto original
   en px, y el video queda angosto y "alargado". */
.post-content .wp-block-embed {
    margin: 25px 0;
}

.post-content .wp-block-embed__wrapper {
    position: relative;
}

.post-content .wp-block-embed__wrapper iframe,
.post-content .wp-block-embed__wrapper video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Por defecto (sin dato de proporción de WordPress) asumir horizontal 16:9 */
.post-content .wp-block-embed__wrapper iframe {
    aspect-ratio: 16 / 9;
}

/* Video vertical (Shorts/Reels/TikTok, 9:16) — limitarlo en ancho para que no
   quede un rectángulo gigante de alto ocupando todo el ancho del artículo. */
.post-content .wp-embed-aspect-9-16 {
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

.post-content .wp-embed-aspect-9-16 .wp-block-embed__wrapper iframe {
    aspect-ratio: 9 / 16;
}

.post-content .wp-embed-aspect-1-1 .wp-block-embed__wrapper iframe {
    aspect-ratio: 1 / 1;
}

/* Video subido directo a WordPress (bloque Video / etiqueta <video>) fuera de un embed */
.post-content video:not(.wp-block-embed__wrapper video) {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 25px 0;
}

.post-content blockquote {
    border-left: 4px solid var(--color-primary);
    padding: 20px 25px;
    margin: 30px 0;
    background: rgba(30, 168, 148, 0.05);
    border-radius: 4px;
    font-style: italic;
}

.post-content code {
    background: #f5f5f5;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 15px;
}

.post-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 25px 0;
}

.post-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* Page Links */
.page-links {
    margin: 30px 0;
    padding: 20px;
    background: var(--color-background);
    border-radius: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.page-links-title {
    font-weight: 600;
    margin-right: 10px;
}

.page-links span {
    display: inline-block;
    padding: 8px 15px;
    background: white;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.page-links span:hover,
.page-links .current {
    background: var(--color-primary);
    color: white;
}

/* ==========================================================================
   TAGS
   ========================================================================== */

.post-tags {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 25px 40px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 35px;
}

.post-tags svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.tag-link {
    display: inline-block;
    padding: 6px 14px;
    background: var(--color-background);
    color: var(--color-text);
    font-size: 13px;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag-link:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-2px);
}

/* ==========================================================================
   COMPARTIR EN REDES
   ========================================================================== */

.post-share {
    padding: 30px 40px 40px 40px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 30px;
}

.share-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: var(--color-text);
}

.share-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.1);
    color: var(--color-text);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.share-btn svg {
    width: 18px;
    height: 18px;
    transition: all 0.3s ease;
}

.share-btn.facebook:hover {
    background: #1877f2;
    border-color: #1877f2;
    color: white;
}

.share-btn.twitter:hover {
    background: #1da1f2;
    border-color: #1da1f2;
    color: white;
}

.share-btn.whatsapp:hover {
    background: #25d366;
    border-color: #25d366;
    color: white;
}

.share-btn.copy:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.share-btn.copy.copied {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */

.single-post-sidebar {
    position: sticky;
    top: 100px;
}

.sidebar-widget {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.widget-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
}

/* Posts Relacionados / Populares */
.related-posts-list,
.popular-posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.related-post-item,
.popular-post-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.related-post-item:last-child,
.popular-post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.related-post-item:first-child,
.popular-post-item:first-child {
    padding-top: 0;
}

.related-thumb,
.popular-thumb {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
}

.related-thumb img,
.popular-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-thumb:hover img,
.popular-thumb:hover img {
    transform: scale(1.1);
}

.related-content,
.popular-content {
    flex: 1;
    min-width: 0;
}

.related-title,
.popular-title {
    margin: 0 0 6px 0;
    font-size: 14px;
    line-height: 1.4;
}

.related-title a,
.popular-title a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-title a:hover,
.popular-title a:hover {
    color: var(--color-primary);
}

.related-date {
    font-size: 12px;
    color: var(--color-text-light);
}

.popular-rating .post-rating-stars {
    gap: 2px;
}

.popular-rating .star {
    width: 14px;
    height: 14px;
}

.no-related,
.no-popular {
    color: var(--color-text-light);
    font-size: 14px;
    font-style: italic;
    margin: 0;
}

/* ==========================================================================
   NAVEGACIÓN ENTRE POSTS
   ========================================================================== */

.post-navigation {
    margin: 60px 0 50px;
}

.nav-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.nav-previous,
.nav-next {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 28px;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
    color: var(--color-text);
}

.nav-previous:hover,
.nav-next:hover {
    border-color: var(--color-primary);
    background: rgba(30, 168, 148, 0.05);
    transform: translateX(-3px);
}

.nav-next {
    justify-content: flex-end;
    text-align: right;
}

.nav-next:hover {
    transform: translateX(3px);
}

.nav-previous svg,
.nav-next svg {
    flex-shrink: 0;
    color: var(--color-primary);
    transition: transform 0.3s ease;
}

.nav-previous:hover svg {
    transform: translateX(-4px);
}

.nav-next:hover svg {
    transform: translateX(4px);
}

.nav-previous span,
.nav-next span {
    font-size: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   COMENTARIOS
   ========================================================================== */

.comments-area {
    background: white;
    border-radius: 16px;
    padding: 35px;
    margin-top: 40px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.comments-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--color-text);
    margin: 0 0 10px 0;
    padding-bottom: 20px;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 30%, transparent 100%);
    border-image-slice: 1;
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 25px 0 40px 0;
}

.comment {
    margin-bottom: 15px;
    padding: 25px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    border-left: 3px solid var(--color-primary);
    transition: all 0.3s ease;
}

.comment:hover {
    background: rgba(0, 0, 0, 0.03);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.comment:last-child {
    margin-bottom: 0;
}

.comment-body {
    display: flex;
    gap: 14px;
}

.comment-author-avatar img {
    border-radius: 50%;
    width: 54px;
    height: 54px;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comment-content-wrap {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.comment-author-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}

.comment-author-name a {
    color: var(--color-text);
    text-decoration: none;
}

.comment-author-name a:hover {
    color: var(--color-primary);
}

.comment-reply-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: transparent;
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--color-primary);
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.comment-reply-link:hover {
    background: var(--color-primary);
    color: white;
}

.comment-date a {
    color: var(--color-text-light);
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comment-date a::before {
    content: "🕐";
    font-size: 11px;
}

.comment-date a:hover {
    color: var(--color-primary);
}

.comment-content {
    color: var(--color-text);
    line-height: 1.5;
    font-size: 14px;
    margin-top: 4px;
}

.comment-content p {
    margin: 0 0 4px 0;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

.children {
    list-style: none;
    margin: 12px 0 0 0;
    padding-left: 50px;
    border-left: 2px dashed rgba(0, 0, 0, 0.1);
}

/* Formulario de comentarios */
.comment-respond {
    margin-top: 40px;
    padding: 35px;
    background: rgba(var(--color-primary-rgb, 30, 168, 148), 0.03);
    border-radius: 12px;
    border: 2px dashed var(--color-primary);
}

.comment-reply-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 25px 0;
}

.comment-form {
    display: grid;
    gap: 20px;
}

.comment-form-comment,
.comment-form-author,
.comment-form-email,
.comment-form-url {
    margin: 0;
}

.comment-form label {
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--color-text);
    font-size: 14px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(30, 168, 148, 0.1);
}

.comment-form textarea {
    min-height: 140px;
    resize: vertical;
}

.form-submit {
    margin: 10px 0 0 0;
}

.form-submit input[type="submit"] {
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(30, 168, 148, 0.2);
}

.form-submit input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 168, 148, 0.35);
}

.comment-notes,
.logged-in-as {
    font-size: 14px;
    color: var(--color-text-light);
    margin-bottom: 20px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    border-left: 3px solid var(--color-primary);
}

.comment-notes a,
.logged-in-as a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.comment-notes a:hover,
.logged-in-as a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
    .single-post-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .single-post-sidebar {
        position: static;
    }
    
    .post-title {
        font-size: 30px;
        letter-spacing: -0.3px;
    }
    
    .post-meta {
        padding-bottom: 25px;
        margin-bottom: 30px;
    }
    
    .post-categories-breadcrumb,
    .single-post-container {
        padding: 0 60px;
    }
    
    .post-header,
    .post-content,
    .post-tags,
    .post-share {
        padding-left: 30px;
        padding-right: 30px;
    }
}

@media (max-width: 768px) {
    .single-post-wrapper {
        padding: 80px 0 60px;
    }
    
    .single-post-container {
        padding: 0 20px;
    }
    
    .post-categories-breadcrumb,
    .post-header,
    .post-content,
    .post-tags,
    .post-share {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .post-title {
        font-size: 24px;
        letter-spacing: -0.2px;
    }
    
    .post-meta {
        gap: 8px;
        font-size: 13px;
        padding-bottom: 20px;
        margin-bottom: 25px;
    }
    
    .post-author strong {
        font-size: 14px;
    }
    
    .post-content {
        font-size: 16px;
    }
    
    .post-content h2 {
        font-size: 22px;
    }
    
    .post-content h3 {
        font-size: 18px;
    }
    
    .nav-links {
        grid-template-columns: 1fr;
    }
    
    .nav-previous,
    .nav-next {
        padding: 16px 20px;
        font-size: 14px;
    }
    
    .nav-previous svg,
    .nav-next svg {
        width: 20px;
        height: 20px;
    }
    
    .share-buttons {
        flex-direction: column;
    }
    
    .share-btn {
        width: 100%;
        justify-content: center;
    }
    
    .comments-area {
        padding: 25px 20px;
    }
    
    .comments-title {
        font-size: 22px;
    }
    
    .comment {
        padding: 12px;
    }
    
    .comment-body {
        gap: 12px;
    }
    
    .comment-author-avatar img {
        width: 40px;
        height: 40px;
        border: 2px solid white;
    }
    
    .children {
        padding-left: 35px;
    }
    
    .comment-form input[type="text"],
    .comment-form input[type="email"],
    .comment-form input[type="url"],
    .comment-form textarea {
        font-size: 14px;
    }
}
