/* 
 * رأي 2015 - Optimisations SEO et Performance CSS
 * Fichier d'optimisation pour améliorer le SEO et les Core Web Vitals
 */

/* Police arabe optimisée */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&family=Cairo:wght@400;600;700&display=swap');

/* Variables CSS pour cohérence */
:root {
    --primary-color: #1ebba3;
    --primary-dark: #17a085;
    --secondary-color: #23384e;
    --text-color: #414141;
    --bg-color: #fafafa;
    --border-color: #dedede;
    --font-family: 'Tajawal', 'Cairo', 'Arial', sans-serif;
}

/* Optimisation globale pour RTL */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
}

/* Logo optimisé pour visibilité maximale */
.logo {
    float: right;
    margin: 5px 0;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.02);
}

.logo img {
    display: block;
    max-width: 100%;
    height: auto;
    width: 280px;
    height: 80px;
}

/* Optimisation des images pour SEO */
img {
    max-width: 100%;
    height: auto;
    border: 0;
}

img[loading="lazy"] {
    min-height: 100px;
    background: #f0f0f0;
}

/* Optimisation des liens pour SEO */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Header optimisé */
.header {
    background: var(--secondary-color);
    padding: 12px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Search box optimisé */
.site-search {
    float: right;
    margin-right: 80px;
}

input.search {
    font-family: var(--font-family);
    padding: 10px 15px;
    border: 2px solid transparent;
    border-radius: 25px;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 500px;
}

input.search:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 187, 163, 0.1);
}

.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-btn:hover {
    background: var(--primary-dark);
}

/* Breadcrumb optimisé pour SEO */
.breadcrumb {
    background: rgba(233, 236, 239, 0.5);
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.breadcrumb-item {
    display: inline;
    color: #6c757d;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    padding: 0 8px;
    color: #adb5bd;
}

.breadcrumb-item a {
    color: var(--primary-color);
    font-weight: 500;
}

/* Content optimisé pour lisibilité SEO */
.content {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    line-height: 1.8;
}

.content h1 {
    color: var(--primary-color);
    font-size: 2.2em;
    font-weight: 800;
    margin: 0 0 20px 0;
    line-height: 1.3;
}

.content h2 {
    color: var(--primary-dark);
    font-size: 1.8em;
    font-weight: 700;
    margin: 30px 0 15px 0;
}

.content h3 {
    color: var(--secondary-color);
    font-size: 1.4em;
    font-weight: 600;
    margin: 25px 0 12px 0;
}

.content p {
    margin-bottom: 15px;
    font-size: 17px;
}

.content ul, .content ol {
    margin: 15px 0 15px 30px;
    padding: 0;
}

.content li {
    margin-bottom: 8px;
}

/* Category cards optimisés */
.category-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.category-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

/* Footer optimisé */
.footer {
    background: #0d2235;
    color: rgba(255,255,255,0.7);
    padding: 40px 0 20px 0;
    margin-top: 60px;
}

.footer h4 {
    color: white;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 10px;
}

.footer h4::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50px;
    height: 3px;
    background: var(--primary-color);
}

.footer a {
    color: rgba(255,255,255,0.7);
    display: block;
    padding: 5px 0;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: white;
    text-decoration: none;
    padding-right: 5px;
}

/* Mobile optimizations */
@media (max-width: 800px) {
    .logo img {
        width: 200px;
        height: 57px;
    }
    
    .header {
        padding: 8px 0;
        position: relative;
    }
    
    .site-search {
        margin-right: 0;
        width: 100%;
    }
    
    input.search {
        font-size: 16px; /* Évite le zoom sur iOS */
    }
    
    .content {
        padding: 20px 15px;
    }
    
    .content h1 {
        font-size: 1.8em;
    }
    
    .content h2 {
        font-size: 1.5em;
    }
}

/* Performance: Réduire les repaints */
.wrapper,
.content,
.category-card {
    will-change: transform;
}

/* Accessibility improvements */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip to content link pour accessibilité */
.skip-to-content {
    position: absolute;
    top: -40px;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 0 8px;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* Print styles pour SEO */
@media print {
    .header,
    .footer,
    .sidebar,
    .search,
    .social {
        display: none;
    }
    
    .content {
        box-shadow: none;
        border: none;
    }
}
