/**
 * Blog Styles for Prodiversa
 * Complementa los estilos existentes en index.html
 */

/* Variables (heredadas del sitio principal) */
:root {
    --primary: #d43031;
    --primary-dark: #a81c1d;
    --secondary: #fefeff;
    --accent: #000000;
    --text-dark: #1a1a1a;
    --text-light: #666666;
    --bg-light: #f9f9f9;
    --max-width: 1200px;
    --transition: all 0.3s ease;
    --shadow: 0 10px 30px rgba(0,0,0,0.05);
    --radius: 8px;
}

/* Reset básico para páginas del blog */
.blog-page {
    font-family: 'Manrope', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
}

/* Blog Hero */
.blog-hero {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.4)),
                url('../images/image.png');
    background-size: cover;
    background-position: center;
    padding: 180px 0 80px;
    color: var(--secondary);
    text-align: center;
}

.blog-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--secondary);
}

.blog-hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Blog Section */
.blog-section {
    padding: 80px 0;
    background-color: var(--bg-light);
}

.blog-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Blog Layout */
.blog-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    align-items: start;
}

.blog-main {
    min-width: 0;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

/* Post Card */
.post-card {
    background: var(--secondary);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.post-card .post-image {
    position: relative;
    display: block;
    aspect-ratio: 16/10;
    overflow: hidden;
}

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

.post-card:hover .post-image img {
    transform: scale(1.05);
}

.post-category {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 6px 14px;
    border-radius: 20px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
}

.post-card .post-content {
    padding: 25px;
}

.post-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.post-meta i {
    margin-right: 5px;
    color: var(--primary);
}

.post-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    line-height: 1.4;
    margin-bottom: 12px;
}

.post-title a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-title a:hover {
    color: var(--primary);
}

.post-excerpt {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--bg-light);
}

.author-avatar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #ff6b6b 100%);
    color: white;
}

.author-avatar-icon i {
    font-size: 1rem;
}

.post-stats {
    display: flex;
    gap: 15px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.post-stats i {
    margin-right: 4px;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.post-tag {
    font-size: 0.75rem;
    color: var(--primary);
    background: rgba(212, 48, 49, 0.1);
    padding: 4px 10px;
    border-radius: 15px;
    text-decoration: none;
    transition: var(--transition);
}

.post-tag:hover {
    background: var(--primary);
    color: white;
}

/* Sidebar */
.blog-sidebar {
    position: sticky;
    top: 120px;
}

.sidebar-widget {
    background: var(--secondary);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.sidebar-widget h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary);
}

/* Search */
.search-form {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-btn:hover {
    background: var(--primary-dark);
}

/* Categories List */
.categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
}

.category-item:last-child {
    border-bottom: none;
}

.category-item:hover {
    color: var(--primary);
}

.category-item.active {
    color: var(--primary);
    font-weight: 600;
}

.category-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 12px;
}

.category-name {
    flex: 1;
}

.category-count {
    background: var(--bg-light);
    padding: 2px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    background: var(--bg-light);
    color: var(--text-dark);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: var(--transition);
}

.tag-item:hover,
.tag-item.active {
    background: var(--primary);
    color: white;
}

/* Active Filters */
.active-filters {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(212, 48, 49, 0.05);
    border-radius: var(--radius);
    display: none;
}

.active-filters.show {
    display: block;
}

.active-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.active-filters-header span {
    font-weight: 600;
    color: var(--text-dark);
}

.clear-filters {
    color: var(--primary);
    font-size: 0.85rem;
    cursor: pointer;
    background: none;
    border: none;
    text-decoration: underline;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    margin-right: 8px;
}

.filter-tag button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    margin-left: 5px;
    opacity: 0.8;
}

.filter-tag button:hover {
    opacity: 1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 50px;
}

.pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius);
    background: var(--secondary);
    color: var(--text-dark);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.pagination-link:hover:not(.disabled):not(.active) {
    background: var(--primary);
    color: white;
}

.pagination-link.active {
    background: var(--primary);
    color: white;
}

.pagination-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--text-light);
}

/* Loading Spinner */
.loading {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.loading.show {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--bg-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* No Posts / Error */
.no-posts,
.error-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.no-posts i,
.error-message i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 20px;
    display: block;
}

.error-message .btn {
    margin-top: 20px;
}

/* Post Detail Page */
.post-hero-image {
    width: 100%;
    height: 500px;
    overflow: hidden;
    position: relative;
}

.post-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-hero-image .post-category {
    top: auto;
    bottom: 130px;
    left: 50%;
    transform: translateX(-50%);
}

.post-container {
    max-width: 800px;
    margin: -150px auto 80px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.post-header {
    background: var(--secondary);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.post-detail .post-title {
    font-size: 2.2rem;
    margin: 20px 0;
    line-height: 1.3;
}

.post-detail .post-meta {
    justify-content: center;
    flex-wrap: wrap;
}

.post-author-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.post-author-info .author-avatar {
    width: 50px;
    height: 50px;
}

.post-author-info .author-avatar-icon i {
    font-size: 1.4rem;
}

.post-author-info .author-name {
    font-weight: 600;
    color: var(--text-dark);
}

.post-content-body {
    background: var(--secondary);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.post-content-body p {
    margin-bottom: 1.5em;
    line-height: 1.8;
}

.post-content-body h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    margin: 2em 0 1em;
}

.post-content-body h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    margin: 1.5em 0 0.8em;
}

.post-content-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 2em 0;
}

.post-content-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 20px;
    margin: 2em 0;
    font-style: italic;
    color: var(--text-light);
}

.post-content-body ul,
.post-content-body ol {
    margin: 1.5em 0;
    padding-left: 2em;
}

.post-content-body li {
    margin-bottom: 0.5em;
}

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

.post-content-body a:hover {
    color: var(--primary-dark);
}

.post-tags-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.post-tags-section h4 {
    margin-bottom: 15px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
}

/* Related Posts */
.related-posts {
    margin-top: 50px;
}

.related-posts h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 30px;
    text-align: center;
}

.related-posts .posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Comments Section */
.comments-section {
    background: var(--secondary);
    border-radius: var(--radius);
    padding: 40px;
    margin-top: 30px;
    box-shadow: var(--shadow);
}

.comments-section h3 {
    font-family: 'Playfair Display', serif;
    margin-bottom: 30px;
}

.comment {
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

.comment:last-child {
    border-bottom: none;
}

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

.comment-author {
    font-weight: 600;
    color: var(--text-dark);
}

.comment-date {
    color: var(--text-light);
    font-size: 0.85rem;
}

.comment-content {
    color: var(--text-dark);
    line-height: 1.6;
}

.comment-replies {
    margin-left: 40px;
    margin-top: 15px;
    padding-left: 20px;
    border-left: 2px solid #eee;
}

/* Comment Form */
.comment-form {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.comment-form h4 {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 25px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* Message Toast */
.message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: var(--radius);
    color: white;
    font-weight: 600;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.message-success {
    background: #28a745;
}

.message-error {
    background: var(--primary);
}

.message-info {
    background: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Back to Blog */
.back-to-blog {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    text-decoration: none;
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.back-to-blog:hover {
    color: var(--primary);
}

/* Responsive */
@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }

    .blog-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }

    .sidebar-widget {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .blog-hero {
        padding: 140px 0 60px;
    }

    .blog-hero h1 {
        font-size: 2rem;
    }

    .blog-section {
        padding: 50px 0;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .post-hero-image {
        height: 300px;
    }

    .post-container {
        margin-top: -50px;
    }

    .post-header,
    .post-content-body,
    .comments-section {
        padding: 25px;
    }

    .post-detail .post-title {
        font-size: 1.6rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .comment-replies {
        margin-left: 20px;
        padding-left: 15px;
    }

    .post-meta {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
}
