/**
 * Related Articles Block - Frontend Styles
 * Version 2.0 - Multiple Designs
 */

/* ============================================
   Variables CSS par défaut
   ============================================ */
:root {
    --rab-color-primary: #8b5cf6;
    --rab-color-secondary: #06b6d4;
    --rab-color-text: #333333;
    --rab-color-text-hover: #000000;
    --rab-color-bg-hover: #f5f5f5;
    --rab-color-separator: #eeeeee;
    --rab-color-header-bg: #1e293b;
    --rab-color-badge-bg: #fef3c7;
    --rab-color-badge-text: #f59e0b;
    --rab-color-cta: #f43f5e;
}

/* Base commune */
.rab-block {
    margin: 2em 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
}

.rab-block *,
.rab-block *::before,
.rab-block *::after {
    box-sizing: border-box;
}

.rab-block a {
    text-decoration: none;
    background-image: none;
}

/* ============================================
   DESIGN CLASSIQUE
   ============================================ */
.rab-design-classic {
    padding: 0;
    border-left: 4px solid var(--rab-color-primary);
    background: transparent;
    border-radius: 0 4px 4px 0;
}

.rab-design-classic .rab-block-title {
    margin: 0;
    padding: 15px 20px 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--rab-color-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rab-design-classic .rab-articles-list {
    display: flex;
    flex-direction: column;
}

.rab-design-classic .rab-article-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px;
    color: var(--rab-color-text);
    border-bottom: 1px solid var(--rab-color-separator);
    transition: all 0.2s ease;
}

.rab-design-classic .rab-article-item:last-child {
    border-bottom: none;
}

.rab-design-classic .rab-article-item:hover {
    background: var(--rab-color-bg-hover);
    padding-left: 25px;
    color: var(--rab-color-text-hover);
}

.rab-design-classic .rab-article-title {
    flex: 1;
    font-size: 1em;
    line-height: 1.5;
    font-weight: 400;
}

.rab-design-classic .rab-article-arrow {
    margin-left: 15px;
    font-size: 1.2em;
    color: var(--rab-color-primary);
    opacity: 0.6;
    transition: all 0.2s ease;
}

.rab-design-classic .rab-article-item:hover .rab-article-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* ============================================
   DESIGN 1 : CARDS AVEC GRADIENT & GLOW
   ============================================ */
.rab-design-cards {
    background: linear-gradient(135deg, #fafbfc 0%, #f0f4f8 100%);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #e8ecf0;
}

.rab-design-cards .rab-block-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--rab-color-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rab-design-cards .rab-block-title::before {
    content: '';
    width: 20px;
    height: 3px;
    background: linear-gradient(90deg, var(--rab-color-primary), var(--rab-color-secondary));
    border-radius: 2px;
}

.rab-design-cards .rab-articles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rab-design-cards .rab-article-item {
    background: white;
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    color: #1e293b;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.rab-design-cards .rab-article-item:hover {
    transform: translateX(8px);
    border-color: var(--rab-color-primary);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.15);
}

.rab-design-cards .rab-article-content {
    flex: 1;
}

.rab-design-cards .rab-article-title {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 4px;
    color: #1e293b;
}

.rab-design-cards .rab-article-meta {
    font-size: 0.8rem;
    color: #94a3b8;
}

.rab-design-cards .rab-article-arrow {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--rab-color-primary) 0%, var(--rab-color-secondary) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.rab-design-cards .rab-article-item:hover .rab-article-arrow {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* ============================================
   DESIGN 2 : LISTE NUMÉROTÉE AVEC HEADER
   ============================================ */
.rab-design-numbered {
    background: white;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.rab-design-numbered .rab-block-header {
    background: linear-gradient(135deg, var(--rab-color-header-bg) 0%, #334155 100%);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rab-design-numbered .rab-block-title {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0;
}

.rab-design-numbered .rab-block-badge {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.rab-design-numbered .rab-articles-list {
    padding: 8px;
}

.rab-design-numbered .rab-article-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    color: #1f2937;
    border-radius: 12px;
    transition: all 0.25s ease;
    position: relative;
}

.rab-design-numbered .rab-article-item:hover {
    background: #f8fafc;
}

.rab-design-numbered .rab-article-item:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 60px;
    right: 16px;
    height: 1px;
    background: #f1f5f9;
}

.rab-design-numbered .rab-article-number {
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #64748b;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.rab-design-numbered .rab-article-item:hover .rab-article-number {
    background: var(--rab-color-header-bg);
    color: white;
}

.rab-design-numbered .rab-article-content {
    flex: 1;
}

.rab-design-numbered .rab-article-title {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 4px;
    color: #1f2937;
}

.rab-design-numbered .rab-article-meta {
    font-size: 0.75rem;
    color: #94a3b8;
}

.rab-design-numbered .rab-article-arrow {
    color: #cbd5e1;
    font-size: 1.2rem;
    transition: all 0.25s ease;
}

.rab-design-numbered .rab-article-item:hover .rab-article-arrow {
    color: var(--rab-color-header-bg);
    transform: translateX(4px);
}

/* ============================================
   DESIGN 3 : MINIMAL AVEC REVEAL
   ============================================ */
.rab-design-minimal {
    position: relative;
    padding-left: 20px;
}

.rab-design-minimal::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--rab-color-cta) 0%, #ec4899 50%, var(--rab-color-primary) 100%);
    border-radius: 4px;
}

.rab-design-minimal .rab-block-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--rab-color-cta);
    margin-bottom: 16px;
}

.rab-design-minimal .rab-articles-list {
    display: flex;
    flex-direction: column;
}

.rab-design-minimal .rab-article-item {
    display: block;
    color: #374151;
    padding: 16px 0;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.rab-design-minimal .rab-article-item:last-child {
    border-bottom: none;
}

.rab-design-minimal .rab-article-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: transparent;
    transition: all 0.3s ease;
}

.rab-design-minimal .rab-article-item:hover::before {
    background: var(--rab-color-cta);
}

.rab-design-minimal .rab-article-item:hover {
    padding-left: 12px;
    color: #1f2937;
}

.rab-design-minimal .rab-article-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.rab-design-minimal .rab-article-content {
    flex: 1;
}

.rab-design-minimal .rab-article-title {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    color: inherit;
}

.rab-design-minimal .rab-article-time {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 4px;
}

.rab-design-minimal .rab-article-cta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--rab-color-cta);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.rab-design-minimal .rab-article-item:hover .rab-article-cta {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media screen and (max-width: 600px) {
    .rab-block {
        margin: 1.5em 0;
    }
    
    /* Cards */
    .rab-design-cards {
        padding: 16px;
    }
    
    .rab-design-cards .rab-article-item {
        padding: 14px 16px;
    }
    
    .rab-design-cards .rab-article-item:hover {
        transform: translateX(4px);
    }
    
    /* Numbered */
    .rab-design-numbered .rab-block-header {
        padding: 16px 20px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .rab-design-numbered .rab-article-item {
        padding: 12px;
    }
    
    /* Minimal */
    .rab-design-minimal {
        padding-left: 16px;
    }
    
    .rab-design-minimal .rab-article-cta {
        display: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .rab-block {
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    
    .rab-article-arrow,
    .rab-article-cta {
        display: none;
    }
}

/* ============================================
   ACCESSIBILITÉ
   ============================================ */
.rab-block a:focus-visible {
    outline: 2px solid var(--rab-color-primary);
    outline-offset: 2px;
}

/* Animation d'entrée */
@keyframes rab-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rab-block.rab-animate {
    animation: rab-fade-in 0.4s ease-out;
}
