/* WordPress Headless Integration Styles */

/* Loading States */
.loading-posts {
    padding: 60px 20px;
}

.loading-posts .spinner-border {
    width: 3rem;
    height: 3rem;
}

.error-posts {
    padding: 60px 20px;
}

.error-posts i {
    display: block;
    margin-bottom: 1rem;
}

/* Blog Posts Grid - Equal Height Columns */
#blog-posts-container .row {
    display: flex;
    flex-wrap: wrap;
}

#blog-posts-container .col-lg-4,
#blog-posts-container .col-md-6,
#blog-posts-container .col-sm-12 {
    display: flex;
    flex-direction: column;
    margin-bottom: 30px;
}

/* Blog Post Loading States */
.blog-post-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.blog-post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Flexbox layout for equal height cards */
.blog-post-item .entry-content {
    padding: 25px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
    min-height: 200px; /* Altura mínima para uniformidad */
}

.blog-post-item .entry-content .cat-btn {
    margin-bottom: 15px;
    align-self: flex-start;
}

.blog-post-item .entry-content .title {
    margin-bottom: 15px;
    line-height: 1.3;
}

.blog-post-item .entry-content .title a {
    color: #333;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
    display: block;
}

.blog-post-item .entry-content p {
    flex-grow: 1;
    margin-bottom: 20px;
    color: #666;
    line-height: 1.6;
    font-size: 0.95rem;
}

.blog-post-item .entry-content .btn-link {
    margin-top: auto;
    align-self: flex-start;
    padding: 0;
    background: none;
    border: none;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.blog-post-item .entry-content .btn-link:hover {
    color: #0056b3;
}

/* Category Button Styles */
.cat-btn {
    transition: all 0.3s ease;
}

.cat-btn:hover {
    transform: scale(1.05);
}

/* Load More Button Enhanced */
#blog .button-box .main-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#blog .button-box .main-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

#blog .button-box .main-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

#blog .button-box .main-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .loading-posts,
    .error-posts {
        padding: 40px 15px;
    }
    
    .blog-post-item {
        margin-bottom: 30px;
    }
}

/* Category Color Coding */
.cat-btn[href*="automatizacion"],
.cat-btn:contains("Automatización"),
.post-category.cat-automatizacion {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

.cat-btn[href*="marketing"],
.cat-btn:contains("Marketing"),
.post-category.cat-marketing {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

.cat-btn[href*="conversion"],
.cat-btn:contains("Conversión"),
.post-category.cat-conversion {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

/* Fade in animation for new posts */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.blog-post-item.new-post {
    animation: fadeInUp 0.6s ease forwards;
}

/* Blog Post Page Styles */
.blog-details-area {
    background: #fff;
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: #666;
}

.breadcrumb a {
    color: #007bff;
    text-decoration: none;
}

.post-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.post-date {
    color: #666;
    font-size: 14px;
}

.post-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 15px;
    color: #333;
}

.post-excerpt p {
    font-size: 1.1rem;
    color: #666;
    line-height: 1.6;
}

.post-body {
    font-size: 1rem;
    line-height: 1.8;
    color: #333;
}

.post-body h2, .post-body h3, .post-body h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #333;
    font-weight: 600;
}

.post-body p {
    margin-bottom: 1.5rem;
}

.post-body ul, .post-body ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

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

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

.post-body blockquote {
    border-left: 4px solid #007bff;
    padding-left: 2rem;
    margin: 2rem 0;
    font-style: italic;
    color: #666;
    background: #f8f9fa;
    padding: 1.5rem 2rem;
    border-radius: 0 8px 8px 0;
}

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

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

.tag {
    background: #f8f9fa;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    color: #666;
    border: 1px solid #e9ecef;
}

.social-share {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.social-share a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.social-share a:hover {
    transform: scale(1.1);
}

.share-facebook { background: #1877f2; }
.share-twitter { background: #1da1f2; }
.share-linkedin { background: #0077b5; }
.share-whatsapp { background: #25d366; }

/* Sidebar Styles */
.blog-sidebar .widget {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.widget-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.cta-widget {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    text-align: center;
}

.cta-widget h4 {
    color: white;
    margin-bottom: 15px;
}

.cta-widget p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
}

.cta-widget .main-btn {
    background: white;
    color: #007bff;
    border: none;
}

.cta-widget .main-btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

.related-post-item {
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

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

.related-post-item h6 a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
}

.related-post-item h6 a:hover {
    color: #007bff;
}

.categories-list {
    list-style: none;
    padding: 0;
}

.categories-list li {
    margin-bottom: 10px;
}

.categories-list a {
    color: #333;
    text-decoration: none;
    padding: 8px 15px;
    display: block;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.categories-list a:hover {
    background: #007bff;
    color: white;
}

/* Responsive Blog Post */
@media (max-width: 768px) {
    .post-title {
        font-size: 2rem;
    }
    
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .social-share {
        justify-content: flex-start;
    }
    
    .blog-sidebar {
        margin-top: 40px;
    }
    
    .post-featured-image img {
        height: 250px !important;
    }
    
    .blog-post-item .post-thumbnail {
        height: 180px !important;
    }
    
    .blog-post-item .post-image img {
        height: 180px !important;
    }
    
    .related-post-image img {
        height: 100px !important;
    }
}

@media (max-width: 576px) {
    .blog-post-item .post-thumbnail {
        height: 160px !important;
    }
}

/* Featured Images Styles */
.post-featured-image {
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.post-featured-image img {
    transition: transform 0.3s ease;
}

.post-featured-image:hover img {
    transform: scale(1.02);
}

.blog-post-item .post-thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: 10px 10px 0 0; /* Solo bordes superiores redondeados */
    width: 100%;
    height: 200px;
    margin-bottom: 0; /* Eliminar margen inferior */
}

.blog-post-item .post-thumbnail img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease;
    display: block;
}

.blog-post-item:hover .post-thumbnail img {
    transform: scale(1.05);
}

.blog-post-item .post-image {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.blog-post-item .post-image img {
    transition: transform 0.3s ease;
}

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

.related-post-image {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.related-post-image img {
    transition: transform 0.3s ease;
}

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