@import url('../styles.css');
@import url('cta.css');

/* ==================== STYLES BLOG GEO RANK ==================== */

/* Variables */
:root {
    --blog-accent-color: #f59e0b;
    --blog-bg-color: #ffffff;
    --blog-text-color: #1e293b;
    --blog-text-light: #64748b;
    --blog-border-color: #e2e8f0;
    --blog-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --blog-card-hover-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 6px 10px rgba(0, 0, 0, 0.08);
}

/* ==================== BLOG MAIN ==================== */
.blog-main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* ==================== HERO BLOG ==================== */
.blog-hero {
    text-align: center;
    padding: 4rem 0 3rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    margin-bottom: 3rem;
}

.blog-hero-content h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--blog-text-color);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--color-primary), var(--blog-accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.blog-hero-description {
    font-size: 1.25rem;
    color: var(--blog-text-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ==================== ARTICLES GRID ==================== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* ==================== ARTICLE CARD ==================== */
.article-card {
    background: var(--blog-bg-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--blog-card-shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--blog-border-color);
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--blog-card-hover-shadow);
    border-color: var(--color-primary);
}

.article-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.article-content {
    padding: 1.5rem;
}

.article-meta {
    margin-bottom: 1rem;
}

.article-meta time {
    color: var(--blog-text-light);
    font-size: 0.875rem;
    font-weight: 500;
}

.article-title {
    margin-bottom: 1rem;
}

.article-title a {
    color: var(--blog-text-color);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    transition: color 0.2s ease;
}

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

.article-excerpt {
    color: var(--blog-text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* Fallback pour les autres navigateurs */
    display: block;
    max-height: 4.8rem; /* 3 lignes * 1.6rem */
    position: relative;
}

.article-excerpt::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 1.6rem;
    background: linear-gradient(transparent, var(--blog-bg-color));
    pointer-events: none;
}

/* Support pour line-clamp standard */
@supports (-webkit-line-clamp: 3) or (line-clamp: 3) {
    .article-excerpt {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        max-height: none;
    }
    
    .article-excerpt::before {
        display: none;
    }
}

.article-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    border-top: 1px solid var(--blog-border-color);
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination-link:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.pagination-link.prev {
    margin-right: auto;
}

.pagination-link.next {
    margin-left: auto;
}

.pagination-info {
    color: var(--blog-text-light);
    font-weight: 500;
}

/* ==================== ARTICLE FULL ==================== */
.article-full {
    max-width: 800px;
    margin: 0 auto;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.breadcrumb a {
    color: var(--blog-text-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.breadcrumb .separator {
    color: var(--blog-border-color);
}

.breadcrumb .current {
    color: var(--blog-text-color);
    font-weight: 500;
}

.article-header {
    text-align: center;
    margin-bottom: 2rem;
}

.article-meta-header {
    margin-bottom: 1rem;
}

.article-date {
    color: var(--blog-text-light);
    font-size: 0.95rem;
    font-weight: 500;
}

.article-title-full {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--blog-text-color);
    line-height: 1.2;
    margin-bottom: 0;
}

.article-cover {
    width: 100%;
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden;
}

.article-cover img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.article-content-full {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--blog-text-color);
    margin-bottom: 3rem;
}

.article-content-full h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--blog-text-color);
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--blog-border-color);
}

.article-content-full h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--blog-text-color);
    margin: 2rem 0 1rem;
}

.article-content-full h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--blog-text-color);
    margin: 1.5rem 0 0.75rem;
}

.article-content-full p {
    margin-bottom: 1.5rem;
}

.article-content-full ul,
.article-content-full ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.article-content-full li {
    margin-bottom: 0.5rem;
}

.article-content-full strong {
    color: var(--blog-text-color);
    font-weight: 600;
}

/* ==================== ARTICLE FOOTER ==================== */
.article-footer {
    padding: 2rem 0;
    border-top: 1px solid var(--blog-border-color);
    border-bottom: 1px solid var(--blog-border-color);
}

.article-actions-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.article-share {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.share-label {
    color: var(--blog-text-light);
    font-size: 0.875rem;
    font-weight: 500;
}

.share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--blog-border-color);
    background: var(--blog-bg-color);
    color: var(--blog-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-2px);
}

/* ==================== RELATED ARTICLES ==================== */
.related-articles {
    margin-top: 3rem;
    padding-top: 3rem;
}

.related-articles h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--blog-text-color);
    margin-bottom: 2rem;
    text-align: center;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.no-related {
    text-align: center;
    color: var(--blog-text-light);
    font-style: italic;
    grid-column: 1 / -1;
}

/* ==================== ERROR 404 ==================== */
.error-404 {
    text-align: center;
    padding: 4rem 0;
}

.error-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--blog-text-color);
    margin-bottom: 1rem;
}

.error-content p {
    color: var(--blog-text-light);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ==================== NO ARTICLES ==================== */
.no-articles {
    text-align: center;
    padding: 4rem 0;
    color: var(--blog-text-light);
    font-size: 1.1rem;
}

/* ==================== SQUELETTES DE CHARGEMENT ==================== */
.skeleton-card {
    border: var(--blog-border);
    border-radius: var(--blog-border-radius);
    background: var(--blog-card-bg);
    overflow: hidden;
    transition: all 0.3s ease;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    background: var(--blog-skeleton-bg);
    position: relative;
    overflow: hidden;
}

.skeleton-image .skeleton {
    width: 100%;
    height: 100%;
    background: var(--blog-skeleton-bg);
}

.skeleton-content {
    padding: 1.5rem;
}

.skeleton-meta {
    margin-bottom: 1rem;
}

.skeleton-title {
    margin-bottom: 1rem;
}

.skeleton-title .skeleton {
    height: 24px;
    width: 80%;
    margin-bottom: 0.5rem;
}

.skeleton-excerpt {
    margin-bottom: 1.5rem;
}

.skeleton-excerpt .skeleton:first-child {
    height: 16px;
    width: 100%;
    margin-bottom: 0.5rem;
}

.skeleton-excerpt .skeleton:last-child {
    height: 16px;
    width: 70%;
}

.skeleton-button {
    text-align: center;
}

.skeleton-button .skeleton {
    height: 44px;
    width: 120px;
    margin: 0 auto;
    border-radius: 25px;
}

.skeleton-text {
    background: var(--blog-skeleton-bg);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.skeleton {
    background: var(--blog-skeleton-bg);
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        var(--blog-skeleton-bg) 0%,
        var(--blog-skeleton-shine) 20%,
        var(--blog-skeleton-bg) 40%,
        var(--blog-skeleton-bg) 100%
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Variables CSS pour les squelettes */
:root {
    --blog-skeleton-bg: #f0f0f0;
    --blog-skeleton-shine: #e0e0e0;
}

/* Mode sombre pour les squelettes */
@media (prefers-color-scheme: dark) {
    :root {
        --blog-skeleton-bg: #2a2a2a;
        --blog-skeleton-shine: #3a3a3a;
    }
}

/* ==================== INFINITE SCROLL ==================== */
.infinite-scroll-loader {
    text-align: center;
    padding: 40px 20px;
    margin: 20px 0;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-light);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.no-more-articles {
    text-align: center;
    padding: 40px 20px;
    margin: 20px 0;
}

.no-more-articles p {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-primary);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-4) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

/* Animation d'apparition pour les nouveaux articles */
.article-card {
    animation: fadeInUp 0.6s ease forwards;
}

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

/* ==================== SEARCH BAR ==================== */
.blog-search-section {
    margin-bottom: 3rem;
}

.blog-search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--blog-bg-color);
    border: 2px solid var(--blog-border-color);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--blog-card-shadow);
}

.search-input-wrapper:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.search-input-wrapper.search-focused {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.search-input-wrapper.searching {
    border-color: var(--blog-accent-color);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1), 0 4px 12px rgba(245, 158, 11, 0.15);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.2), 0 4px 12px rgba(245, 158, 11, 0.25);
    }
}

#blog-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--blog-text-color);
    outline: none;
    padding: 0.25rem 0;
}

#blog-search-input::placeholder {
    color: var(--blog-text-light);
    font-style: italic;
}

.search-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    color: var(--blog-text-light);
    flex-shrink: 0;
}

#clear-search {
    background: none;
    border: none;
    color: var(--blog-text-light);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

#clear-search:hover {
    background: var(--blog-border-color);
    color: var(--blog-text-color);
}

#clear-search:active {
    transform: scale(0.95);
}

#search-button {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

#search-button:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

#search-button:active {
    transform: scale(0.95);
}

#search-button svg {
    width: 16px;
    height: 16px;
}

/* Responsive pour le bouton de recherche */
@media (max-width: 768px) {
    #search-button {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        margin-left: 0.5rem;
    }
    
    #search-button svg {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    #search-button {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
        margin-left: 0.4rem;
    }
    
    #search-button svg {
        width: 12px;
        height: 12px;
    }
}

/* ==================== SEARCH RESULTS ==================== */
#search-results-container {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.search-result {
    border: 2px solid var(--color-primary);
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.search-result:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.15);
}

.search-score {
    background: var(--color-primary);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Mise en surbrillance des termes recherchés */
mark {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
    font-weight: 600;
}

/* ==================== SEARCH INFO ==================== */
#search-info {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.search-query {
    color: var(--blog-text-color);
    font-weight: 500;
}

.search-count {
    background: var(--color-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ==================== NO RESULTS ==================== */
.no-search-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--blog-bg-color);
    border-radius: 12px;
    border: 1px solid var(--blog-border-color);
}

.no-results-content h3 {
    color: var(--blog-text-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.no-results-content p {
    color: var(--blog-text-light);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.search-suggestions {
    text-align: left;
    max-width: 400px;
    margin: 0 auto 2rem;
}

.search-suggestions h4 {
    color: var(--blog-text-color);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.search-suggestions ul {
    list-style: none;
    padding: 0;
}

.search-suggestions li {
    color: var(--blog-text-light);
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.search-suggestions li::before {
    content: "•";
    color: var(--color-primary);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* ==================== RESPONSIVE SEARCH ==================== */
@media (max-width: 768px) {
    .blog-search-section {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .search-input-wrapper {
        padding: 0.625rem 1.25rem;
    }
    
    #blog-search-input {
        font-size: 0.95rem;
    }
    
    .search-icon {
        width: 18px;
        height: 18px;
        margin-right: 0.625rem;
    }
    
    #clear-search {
        width: 24px;
        height: 24px;
    }
    
    #search-results-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    #search-info {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .no-search-results {
        padding: 3rem 1.5rem;
    }
    
    .no-results-content h3 {
        font-size: 1.25rem;
    }
    
    .no-results-content p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .blog-search-section {
        padding: 1rem;
    }
    
    .search-input-wrapper {
        padding: 0.5rem 1rem;
    }
    
    #blog-search-input {
        font-size: 0.9rem;
    }
    
    .search-score {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    mark {
        padding: 0.05rem 0.15rem;
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .blog-hero {
        padding: 2rem 0 1.5rem;
        margin-bottom: 2rem;
    }
    
    .blog-hero-content h1 {
        font-size: 2rem;
    }
    
    .blog-hero-description {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .article-title-full {
        font-size: 1.8rem;
    }
    
    .article-content-full {
        font-size: 1rem;
    }
    
    .article-content-full h2 {
        font-size: 1.5rem;
    }
    
    .article-content-full h3 {
        font-size: 1.3rem;
    }
    
    .pagination {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .pagination-link {
        width: 100%;
        justify-content: center;
    }
    
    .article-actions-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .article-share {
        justify-content: center;
    }
    
    .error-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .error-actions .btn {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .blog-main {
        padding: 1rem 0;
    }
    
    .article-content {
        padding: 1rem;
    }
    
    .article-title {
        font-size: 1.1rem;
    }
    
    .article-excerpt {
        font-size: 0.9rem;
    }
}
