/* =========================================
   CINCEL.AR - MODULE: BLOG READER
 
   ========================================= */

/* Mapeo local para mantener el archivo agnóstico pero conectado al sistema */
.saas-pro-layout {
    /* Herencia de Variables Globales del Sistema */
    --post-bg: var(--bg-surface, #ffffff);
    --post-text: var(--text-main, #111827);
    --post-muted: var(--text-muted, #6b7280);
    --post-border: var(--border-light, rgba(0,0,0,0.1));
    --post-brand: var(--brand-primary, #3e39ba);
    --post-accent: var(--brand-secondary, #ffc61a);
    
    /* Tipografía */
    --font-serif: 'Georgia', 'Cambria', serif;
    --font-sans: system-ui, -apple-system, sans-serif;

    background: var(--bg-body, #f3f4f6);
    min-height: 100vh;
    padding-bottom: 6rem;
}

/* --- Layout & Components --- */
.reading-progress-bar {
    position: fixed; top: 0; left: 0; 
    width: 0%; height: 3px;
    background: var(--post-brand); 
    z-index: 9999; 
    transition: width 0.1s linear;
}

.pro-article {
    max-width: 740px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    
    /* Header & Typography */
    .breadcrumbs {
        font-family: var(--font-sans);
        font-size: 0.8rem;
        color: var(--post-muted);
        margin-bottom: 2rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;

        .crumb-link {
            text-decoration: none;
            color: inherit;
            transition: color 0.2s;
            &:hover { color: var(--post-brand); }
        }
        .sep { margin: 0 8px; opacity: 0.4; }
    }

    .article-title {
        font-family: var(--font-sans);
        font-size: 2.75rem;
        line-height: 1.15;
        font-weight: 800;
        color: var(--post-text);
        margin-bottom: 1.25rem;
        letter-spacing: -0.03em;
    }

    .article-subtitle {
        font-family: var(--font-serif);
        font-size: 1.35rem;
        color: var(--post-muted);
        line-height: 1.6;
        margin-bottom: 2.5rem;
        font-weight: 400;
    }

    .article-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px;
        font-family: var(--font-sans);
        font-size: 0.85rem;
        color: var(--post-muted);
        border-bottom: 1px solid var(--post-border);
        padding-bottom: 2rem;
        margin-bottom: 2rem;
        
        .meta-divider { color: var(--post-border); }
    }
}

/* --- Badges --- */
.badge-category {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 4px;
    font-weight: 700; font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    
    .dot { width: 6px; height: 6px; border-radius: 50%; }
    a{text-decoration: none;color: inherit;}
}

.badge-visibility.private {
    background-color: #f3f4f6; color: #4b5563;
    border: 1px solid #d1d5db;
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 20px;
    font-size: 0.7rem; font-weight: 700;
}

/* --- Hero Image --- */
.hero-image-wrapper {
    margin: 2.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    background: #e5e7eb;

    .hero-img {
        width: 100%; height: auto;
        max-height: 500px; object-fit: cover;
        display: block;
    }
}

/* --- Content Body --- */
.article-content {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    line-height: 1.8;
    color: #374151;

    p { margin-bottom: 1.75rem; }
    
    h2 {
        font-family: var(--font-sans);
        font-size: 1.8rem;
        font-weight: 700;
        margin-top: 3rem;
        color: var(--post-text);
        letter-spacing: -0.02em;
    }

    blockquote {
        border-left: 3px solid var(--post-brand);
        margin: 2.5rem 0;
        padding: 1rem 0 1rem 2rem;
        font-style: italic;
        background: transparent;
        color: var(--post-text);
    }

    img {
        max-width: 100%;
        border-radius: 6px;
        margin: 2rem 0;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    }
}

/* --- Feedback & Rating --- */
.feedback-section {
    text-align: center;
    margin: 5rem 0 2rem;
    padding-top: 3rem;
    border-top: 1px solid var(--post-border);

    .feedback-title {
        font-family: var(--font-sans);
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 1rem;
        color: var(--post-text);
    }

    .rating-stars {
        display: flex; justify-content: center; gap: 8px;

        .star {
            background: none; border: none;
            font-size: 2rem; cursor: pointer;
            color: #d1d5db;
            transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
            
            &:hover { transform: scale(1.2); }
            &.active, &.hover { color: var(--post-accent); }
        }
        
        &.is-rated .star { cursor: default; pointer-events: none; }
    }
}

/* --- Share & Footer --- */
/* --- Share & Footer Actions --- */
.share-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap; /* Seguridad para móviles muy pequeños */
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px dashed var(--post-border); /* Separador sutil */

    /* Botón Base */
    .btn-share {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 8px 18px;
        border-radius: 50px; /* Estilo Cápsula */
        background: var(--post-bg);
        border: 1px solid var(--post-border);
        color: var(--post-muted);
        font-family: var(--font-sans);
        font-size: 0.85rem;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);

 
        svg {
            width: 18px;
            height: 18px;
            stroke-width: 2;
            transition: stroke 0.2s;
        }


        &.is-wa:hover {
            border-color: #25D366;
            color: #25D366;
            background: #25D36608; 
        }

    
        &.is-fb:hover {
            border-color: #1877F2;
            color: #1877F2;
            background: #1877F208; 
        }

     
        &.is-copy:hover {
            border-color: var(--post-brand);
            color: var(--post-brand);
            background: rgba(62, 57, 186, 0.05);
        }

        &:active { transform: scale(0.96); }
    }
}

/* --- Related Posts --- */
.related-posts-section {
    margin: 4rem 0 2rem;
    padding-top: 3rem;
    border-top: 1px solid var(--post-border);

    .section-label {
        font-family: var(--font-sans);
        font-size: 0.75rem; font-weight: 800;
        text-transform: uppercase; letter-spacing: 0.1em;
        color: var(--post-muted);
        margin-bottom: 2rem; text-align: center;
        display: block;
    }

    .related-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 2rem;
    }
}

/* Componente Card Anidado */
.related-card {
    text-decoration: none;
    display: flex; flex-direction: column; gap: 12px;
    background: var(--post-bg);
    border: 1px solid transparent; /* Invisible por defecto */
    border-radius: 8px;
    padding: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;

    &:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.05);
        border-color: var(--post-border);
        
        .related-thumb img { transform: scale(1.05); }
    }

    .related-thumb {
        width: 100%; aspect-ratio: 16 / 9;
        border-radius: 6px; overflow: hidden;
        background: #f3f4f6;

        img {
            width: 100%; height: 100%;
            object-fit: cover;
            transition: transform 0.5s ease;
        }
    }

    .related-info {
        .related-cat {
            font-size: 0.7rem; font-weight: 700;
           
            text-transform: uppercase;
            display: inline; margin-bottom: 6px;
        }

        .related-title {
            font-family: var(--font-sans);
            font-size: 1rem; font-weight: 700;
            line-height: 1.4;
            color: var(--post-text);
            margin: 0;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .related-meta {
            display: flex; align-items: center; gap: 8px;
            font-size: 0.75rem; color: var(--post-muted);
            margin-top: 8px;
        }
    }
}

/* --- Toasts (Flat) --- */
.toast-container {
    position: fixed; bottom: 30px; left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    width: 90%; max-width: 400px;
    pointer-events: none;
}

.toast-cincel {
    background: var(--post-text);
    color: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.9rem; font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    display: flex; align-items: center; gap: 12px;
    pointer-events: auto;
    animation: toastSlideIn 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;

    &.error { border-left: 4px solid #ef4444; }
    &.success { border-left: 4px solid #10b981; }
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.toast-fade-out { animation: toastFadeOut 0.4s ease forwards; }

@keyframes toastFadeOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-20px) scale(0.9); }
}

/* --- Mobile --- */
@media (max-width: 768px) {
    .pro-article { padding: 1.5rem; }
    .hero-image-wrapper { margin-left: -1.5rem; margin-right: -1.5rem; border-radius: 0; }
    .article-title { font-size: 2rem; }
    .article-meta .meta-divider { display: none; }
}

.preview-rich-text iframe,
.article-content iframe {
    width: 100%;
    aspect-ratio: 16 / 9; 
    border: none;
    border-radius: 8px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* --- Píldora de Calificación en Cabecera --- */
.header-rating-badge {
    display: inline-flex;
    align-items: center;
    background-color: #fffbeb;
    color: #d97706;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    border: 1px solid #fef3c7;
    cursor: default;
}
.header-rating-badge strong {
    font-weight: 700;
    margin-left: 2px;
}
/* --- Píldora de Vistas en Cabecera --- */
.header-views-badge {
    display: inline-flex;
    align-items: center;
    background-color: #f8fafc; /* Gris muy clarito (Slate 50) */
    color: #64748b; /* Texto gris neutro */
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    border: 1px solid #e2e8f0;
    cursor: default;
    transition: background-color 0.2s;
}

.header-views-badge:hover {
    background-color: #f1f5f9;
}

.header-views-badge strong {
    font-weight: 700;
    color: #334155;
    margin-right: 3px;
}

/* En móviles ocultamos la palabra "vistas" para ahorrar espacio, dejando solo el ícono y número */
@media (max-width: 640px) {
    .header-views-badge .lbl-views {
        display: none;
    }
}