/* ========================================
   Farm3D Blog Plugin - Styles
   ======================================== */

/* Colore primario dinamico - iniettato da WordPress via PHP */
:root {
    --farm3d-primary-color: #7f54b3; /* Fallback WooCommerce, sovrascritto da PHP con il colore del tema */
}

/* ========== Sticky Header ========== */
.farm3d-header {
    position: sticky;
    top: 1rem;
    z-index: 999;
    margin-bottom: 1rem;
    will-change: auto;
}

.farm3d-header-container {
    background: var(--farm3d-primary-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.25rem;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

/* Logo/Title */
.farm3d-header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    white-space: nowrap;
}

.farm3d-icon {
    font-size: 1.5rem;
    color: white;
}

.farm3d-icon i {
    color: white !important;
}

/* Categories Scroll */
.farm3d-categories-scroll {
    flex: 1;
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.25rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.farm3d-categories-scroll::-webkit-scrollbar {
    height: 4px;
}

.farm3d-categories-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.farm3d-categories-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.farm3d-category-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.6rem 1.4rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.farm3d-btn-icon {
    font-size: 1rem;
    line-height: 1;
    color: white !important;
}

.farm3d-category-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.farm3d-category-btn.active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--farm3d-primary-color);
    border-color: white;
    box-shadow: 0 4px 6px -1px rgba(255, 255, 255, 0.3);
}

.farm3d-category-btn.active .farm3d-btn-icon {
    color: var(--farm3d-primary-color) !important;
}

/* Burger Menu */
.farm3d-burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.farm3d-burger span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.farm3d-burger:hover {
    background: rgba(255, 255, 255, 0.3);
}

.farm3d-burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.farm3d-burger.active span:nth-child(2) {
    opacity: 0;
}

.farm3d-burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu */
.farm3d-mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 90%;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.2);
    z-index: 10000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.farm3d-mobile-menu.active {
    right: 0;
}

.farm3d-mobile-menu-content {
    padding: 80px 20px 20px 20px;
}

.farm3d-mobile-menu-content h3 {
    color: var(--farm3d-primary-color);
    margin-bottom: 20px;
    font-size: 1.5em;
}

.farm3d-mobile-category {
    background: #f8f9fa;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.farm3d-mobile-category:hover {
    background: #e8f5e9;
    border-left-color: #38a169;
}

.farm3d-mobile-category.active {
    background: linear-gradient(135deg, var(--farm3d-primary-color) 0%, #38b6ff 100%);
    color: white;
    border-left-color: var(--farm3d-primary-color);
}

.farm3d-mobile-category.active i {
    color: white !important;
}

.farm3d-mobile-category .count {
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85em;
}

/* Blog Content */
.farm3d-blog-content {
    padding: 0 1.25rem 5rem 1.25rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Header Spacer - not needed with sticky positioning */
.farm3d-header-spacer {
    display: none;
}

/* Hero Section */
.farm3d-hero {
    background: linear-gradient(135deg, var(--farm3d-primary-color) 0%, #38b6ff 100%);
    color: white;
    padding: 60px 40px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 40px;
}

.farm3d-hero h1 {
    font-size: 2.5em;
    margin: 0 0 15px 0;
    color: white;
}

.farm3d-hero p {
    font-size: 1.2em;
    margin: 0;
    color: white;
    opacity: 0.95;
}

/* Articles Grid */
.farm3d-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Article Card */
.farm3d-article-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.farm3d-article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.farm3d-article-image {
    height: 220px;
    background: linear-gradient(135deg, #38a169 0%, var(--farm3d-primary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.farm3d-article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.farm3d-default-icon {
    font-size: 5em;
    color: white;
}

.farm3d-article-content {
    padding: 20px;
}

.farm3d-category-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
    margin-bottom: 12px;
}

.farm3d-article-content h3 {
    margin: 10px 0 15px 0;
    font-size: 1.4em;
    line-height: 1.3;
}

.farm3d-article-content h3 a {
    color: #262830;
    text-decoration: none;
    transition: color 0.3s ease;
}

.farm3d-article-content h3 a:hover {
    color: var(--farm3d-primary-color);
}

.farm3d-article-content p {
    color: #666;
    line-height: 1.6;
    margin: 0 0 20px 0;
    font-size: 0.95em;
}

.farm3d-article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.farm3d-date {
    color: #999;
    font-size: 0.85em;
}

.farm3d-read-more {
    background: var(--farm3d-primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.farm3d-read-more:hover {
    background: #2c5282;
    transform: translateX(3px);
}

/* Loading Spinner */
.farm3d-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--farm3d-primary-color);
}

.farm3d-loading .spinner {
    font-size: 4em;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* No Posts */
.farm3d-no-posts {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.farm3d-no-posts p:first-child {
    font-size: 4em;
    margin: 0 0 20px 0;
}

.farm3d-no-posts p:last-child {
    font-size: 1.2em;
    margin: 0;
}

/* Newsletter CTA */
.farm3d-newsletter {
    background: linear-gradient(135deg, #38a169 0%, var(--farm3d-primary-color) 100%);
    color: white;
    border-radius: 16px;
    padding: 50px 40px;
    text-align: center;
    margin: 60px auto 40px auto;
    max-width: 1400px;
}

.farm3d-newsletter h3 {
    color: white;
    margin: 0 0 15px 0;
    font-size: 2em;
}

.farm3d-newsletter p {
    font-size: 1.15em;
    margin: 0 0 30px 0;
    color: white;
    opacity: 0.95;
}

.farm3d-newsletter-form {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.farm3d-newsletter-form input {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    box-sizing: border-box;
}

.farm3d-newsletter-form button {
    background: white;
    color: var(--farm3d-primary-color);
    padding: 15px 40px;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.farm3d-newsletter-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .farm3d-header {
        top: 0.5rem;
    }

    .farm3d-header-container {
        padding: 1rem;
    }

    .farm3d-categories-scroll {
        display: none;
    }

    .farm3d-burger {
        display: flex;
    }

    .farm3d-hero {
        padding: 40px 20px;
    }

    .farm3d-hero h1 {
        font-size: 1.8em;
    }

    .farm3d-hero p {
        font-size: 1em;
    }

    .farm3d-articles-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .farm3d-newsletter {
        padding: 40px 20px;
    }

    .farm3d-newsletter h3 {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .farm3d-header-logo .farm3d-title {
        font-size: 1rem;
    }

    .farm3d-blog-content {
        padding: 0 0.75rem 5rem 0.75rem;
    }
}
