/* ============================================
   RMGT Blog — Dark Tech Theme
   Inspiré de la maquette refonte rue-montgallet
   ============================================ */

:root {
    --bg: #0f1115;
    --bg-elevated: #1a1d24;
    --card-bg: #1e293b;
    --card-hover: #243044;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent-orange: #f97316;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-purple: #a855f7;
    --text: #ffffff;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border: #1e293b;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-full: 9999px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ===== Header ===== */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(15, 17, 21, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.site-header .container {
    display: flex; justify-content: space-between; align-items: center;
    height: 64px;
}
.site-header .logo {
    color: var(--text); font-size: 1.25rem; font-weight: 800;
    text-decoration: none; letter-spacing: -0.02em;
}
.site-header .logo span { color: var(--primary); }
.site-header nav { display: flex; gap: 1.5rem; align-items: center; }
.site-header nav a {
    color: var(--text-muted); font-size: 0.875rem; font-weight: 600;
    text-decoration: none; text-transform: capitalize;
    transition: color 0.15s;
}
.site-header nav a:hover { color: var(--text); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.625rem 1.25rem; border: none; border-radius: var(--radius-full);
    font-size: 0.875rem; font-weight: 600; cursor: pointer;
    text-decoration: none; transition: all 0.15s; gap: 0.5rem;
}
.btn-primary { background: var(--primary); color: var(--text); }
.btn-primary:hover { background: var(--primary-hover); color: var(--text); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* ===== Blog list ===== */
.blog-list { padding: 3rem 0; }
.blog-list h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; letter-spacing: -0.02em; }

.articles-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem; margin: 2rem 0;
}
.article-card {
    background: var(--card-bg); border-radius: var(--radius); overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.2s; cursor: pointer;
}
.article-card:hover {
    background: var(--card-hover); border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}
.article-card .hero { width: 100%; height: 180px; object-fit: cover; }
.article-card .card-body { padding: 1.25rem; }
.article-card h2 { font-size: 1.1rem; margin-bottom: 0.5rem; font-weight: 700; line-height: 1.3; }
.article-card h2 a { color: var(--text); text-decoration: none; }
.article-card h2 a:hover { color: var(--primary); }
.article-card time { font-size: 0.8rem; color: var(--text-dim); }
.article-card p { margin: 0.5rem 0; color: var(--text-muted); font-size: 0.9rem; }
.read-more { color: var(--primary); font-size: 0.85rem; font-weight: 600; }

/* ===== Article ===== */
.blog-article { max-width: 768px; margin: 0 auto; padding: 3rem 24px; }
.article-header h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; letter-spacing: -0.02em; }
.article-meta { color: var(--text-dim); font-size: 0.875rem; margin-bottom: 2rem; }
.article-meta .author { font-weight: 600; color: var(--text-muted); margin-right: 1rem; }
.hero-image { width: 100%; border-radius: var(--radius); margin-bottom: 2rem; }
.article-content { color: var(--text-muted); line-height: 1.7; }
.article-content h1, .article-content h2, .article-content h3 { color: var(--text); margin: 2rem 0 1rem; }
.article-content h2 { font-size: 1.5rem; }
.article-content h3 { font-size: 1.2rem; }
.article-content p { margin-bottom: 1rem; }
.article-content ul, .article-content ol { margin-left: 1.5rem; margin-bottom: 1rem; }
.article-content li { margin-bottom: 0.3rem; }
.article-content a { color: var(--primary); text-decoration: underline; }
.article-content code {
    background: var(--card-bg); padding: 0.15rem 0.4rem;
    border-radius: 4px; font-size: 0.875rem; color: var(--primary);
}
.article-content pre {
    background: var(--card-bg); padding: 1rem; border-radius: var(--radius-sm);
    overflow-x: auto; margin-bottom: 1rem; border: 1px solid var(--border);
}
.article-content pre code { background: none; color: var(--text); }
.article-content blockquote {
    border-left: 3px solid var(--primary); padding-left: 1rem;
    margin: 1rem 0; color: var(--text-dim); font-style: italic;
}
.article-content img { max-width: 100%; border-radius: var(--radius-sm); }
.article-content strong { color: var(--text); }

/* ===== FAQ ===== */
.faq-section { margin: 3rem 0; }
.faq-section h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; color: var(--text); }
.faq-item {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); margin-bottom: 0.5rem; overflow: hidden;
}
.faq-item summary {
    padding: 0.875rem 1rem; cursor: pointer; font-weight: 600;
    color: var(--text); list-style: none; transition: background 0.15s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+ "; color: var(--primary); font-weight: 700; }
.faq-item[open] summary::before { content: "− "; }
.faq-item summary:hover { background: var(--card-hover); }
.faq-item p { padding: 0 1rem 0.875rem; color: var(--text-muted); }

/* ===== Related products ===== */
.related-products { margin: 3rem 0; }
.related-products h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; color: var(--text); }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.product-card {
    background: var(--card-bg); border-radius: var(--radius-sm); padding: 1rem;
    border: 1px solid var(--border); transition: all 0.15s;
}
.product-card:hover { background: var(--card-hover); border-color: rgba(59, 130, 246, 0.3); }
.product-card a { text-decoration: none; color: var(--text); }
.product-card h3 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.product-price .price { font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.product-price .offers { font-size: 0.8rem; color: var(--text-dim); }
.btn-compare { display: inline-block; margin-top: 0.5rem; color: var(--primary); font-size: 0.8rem; font-weight: 600; }

/* ===== Similar articles ===== */
.similar-articles { margin: 3rem 0; }
.similar-articles h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; color: var(--text); }
.similar-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.similar-card {
    background: var(--card-bg); border-radius: var(--radius-sm); padding: 1rem;
    border: 1px solid var(--border); transition: all 0.15s;
}
.similar-card:hover { background: var(--card-hover); border-color: rgba(59, 130, 246, 0.3); }
.similar-card a { text-decoration: none; color: var(--text); }
.similar-card h3 { font-size: 0.9rem; margin: 0.3rem 0; font-weight: 600; }
.similarity-score { font-size: 0.75rem; color: var(--text-dim); }

.match-badge {
    display: inline-block; padding: 0.1rem 0.5rem; border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.3px; margin-bottom: 0.3rem;
}
.badge-same_product { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-same_brand { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-same_category { background: rgba(59, 130, 246, 0.15); color: var(--primary); border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-same_tags { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-topical { background: rgba(148, 163, 184, 0.1); color: var(--text-dim); border: 1px solid var(--border); }

/* ===== Comparison table ===== */
.comparison-table table { width: 100%; border-collapse: collapse; margin: 2rem 0; }
.comparison-table th, .comparison-table td { padding: 0.875rem; text-align: left; border-bottom: 1px solid var(--border); }
.comparison-table th { background: var(--card-bg); font-weight: 600; color: var(--text); }
.comparison-table td { color: var(--text-muted); }
.comparison-table .btn { padding: 0.3rem 0.8rem; background: var(--primary); color: var(--text); border-radius: var(--radius-full); font-size: 0.8rem; }

/* ===== Ask ===== */
.ask-page h1 { font-size: 2rem; font-weight: 800; margin: 2rem 0 0.5rem; letter-spacing: -0.02em; }
.ask-intro { color: var(--text-muted); margin-bottom: 1.5rem; }
.ask-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.ask-form .search-input {
    flex: 1; max-width: 600px; padding: 0.75rem 1rem;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 1rem;
}
.ask-form .search-input:focus { outline: none; border-color: var(--primary); }
.ask-form .search-input::placeholder { color: var(--text-dim); }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; color: var(--primary); font-style: italic; }
.ask-results { margin: 2rem 0; }
.ask-count { color: var(--text-muted); margin-bottom: 1rem; }
.ask-result {
    padding: 1rem 0; border-bottom: 1px solid var(--border);
}
.ask-result a { text-decoration: none; }
.ask-result h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.3rem; }
.ask-result h3:hover { color: var(--primary); }
.ask-result p { color: var(--text-muted); font-size: 0.9rem; }
.relevance { display: inline-block; margin-top: 0.3rem; font-size: 0.8rem; color: var(--primary); font-weight: 600; }

/* ===== Search ===== */
.search-page h1 { font-size: 2rem; font-weight: 800; margin: 2rem 0 0.5rem; }
.search-input {
    padding: 0.75rem 1rem; background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 1rem; width: 60%;
}
.search-input:focus { outline: none; border-color: var(--primary); }
.search-input::placeholder { color: var(--text-dim); }
.search-results { margin: 2rem 0; }
.search-result { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.search-result h3 a { color: var(--text); text-decoration: none; }
.search-result h3 a:hover { color: var(--primary); }

/* ===== Trends ===== */
.trends-page h1 { font-size: 2rem; font-weight: 800; margin: 2rem 0 0.5rem; letter-spacing: -0.02em; }
.trends-intro { color: var(--text-muted); margin-bottom: 2rem; }
.trends-list { display: flex; flex-direction: column; gap: 0.75rem; }
.trend-item {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 1rem 1.25rem;
}
.trend-item.has-match { border-left: 3px solid var(--accent-green); }
.trend-item.opportunity { border-left: 3px solid var(--accent-orange); background: rgba(249, 115, 22, 0.05); }
.trend-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.trend-source { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; font-weight: 600; }
.trend-match { font-size: 0.75rem; color: var(--accent-green); font-weight: 600; }
.trend-opportunity { font-size: 0.75rem; color: var(--accent-orange); font-weight: 600; }
.trend-item h3 a { color: var(--text); text-decoration: none; }
.trend-item h3 a:hover { color: var(--primary); }
.trend-article a { color: var(--primary); text-decoration: none; font-size: 0.875rem; }
.trend-form { margin-bottom: 2rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.trend-form .form-control { background: var(--card-bg); border: 1px solid var(--border); color: var(--text); }

/* ===== Review ===== */
.review-rating {
    background: rgba(249, 115, 22, 0.1); padding: 1rem; border-radius: var(--radius-sm);
    margin-bottom: 2rem; text-align: center; color: var(--accent-orange);
}

/* ===== Footer ===== */
.site-footer {
    background: var(--bg-elevated); border-top: 1px solid var(--border);
    padding: 2rem 0; margin-top: 4rem; text-align: center;
}
.site-footer p { color: var(--text-dim); font-size: 0.875rem; }

/* ===== Back to top ===== */
#back-to-top {
    position: fixed; bottom: 1.5rem; right: 1.5rem; width: 40px; height: 40px;
    border-radius: 50%; background: var(--primary); color: var(--text);
    border: none; font-size: 1.1rem; cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    display: none; z-index: 999; transition: all 0.2s;
}
#back-to-top:hover { background: var(--primary-hover); transform: translateY(-2px); }
#back-to-top.visible { display: flex; align-items: center; justify-content: center; }

/* ===== Admin ===== */
.admin { max-width: 1400px; margin: 0 auto; padding: 0 2rem; }
.admin h1 { font-size: 1.75rem; font-weight: 700; margin: 2rem 0 1rem; }
.admin-table { width: 100%; border-collapse: collapse; margin: 2rem 0; }
.admin-table th, .admin-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: var(--card-bg); font-weight: 600; color: var(--text); }
.admin-table td { color: var(--text-muted); }
.admin-table a { color: var(--text); text-decoration: none; }
.admin-table a:hover { color: var(--primary); }
.status { padding: 0.15rem 0.5rem; border-radius: var(--radius-full); font-size: 0.7rem; text-transform: uppercase; font-weight: 600; }
.status-published { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.status-draft { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.status-archived { background: rgba(148, 163, 184, 0.1); color: var(--text-dim); }

.admin-edit { max-width: 900px; margin: 0 auto; padding: 2rem 24px; }
.form-tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.form-tabs .tab {
    padding: 0.625rem 1.25rem; background: none; border: none; cursor: pointer;
    border-bottom: 2px solid transparent; color: var(--text-muted);
    font-size: 0.875rem; font-weight: 600;
}
.form-tabs .tab.active { border-bottom-color: var(--primary); color: var(--primary); }
.tab-panel { margin-bottom: 2rem; }
.form-row { margin-bottom: 1.25rem; }
.form-row label { display: block; margin-bottom: 0.3rem; font-weight: 600; font-size: 0.875rem; color: var(--text); }
.form-control {
    width: 100%; padding: 0.6rem 0.875rem; background: var(--card-bg);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-size: 0.9375rem;
}
.form-control:focus { outline: none; border-color: var(--primary); }
textarea.form-control { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.form-actions { margin-top: 2rem; display: flex; gap: 1rem; }
.markdown-preview { margin-top: 1rem; padding: 1rem; background: var(--card-bg); border-radius: var(--radius-sm); }
.editor-wrapper .EasyMDEContainer { max-width: 100%; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; align-items: center; gap: 1.5rem; margin: 2rem 0; }
.pagination a { color: var(--primary); text-decoration: none; }
.pagination span { color: var(--text-muted); font-size: 0.875rem; }

/* ===== No articles ===== */
.no-articles { color: var(--text-dim); text-align: center; padding: 3rem 0; }

/* ===== Admin nav ===== */
.admin-nav { display: none; }
.nav-admin-link { font-weight: 700; color: var(--primary) !important; }
.nav-sep { color: var(--text-dim); margin: 0 0.5rem; opacity: 0.5; }

/* ===== Dashboard stats ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin: 2rem 0; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 1.5rem; text-align: center; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ===== Quick links ===== */
.admin-quick-links { margin: 2rem 0; }
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.quick-link-card { display: flex; align-items: center; gap: 0.75rem; background: var(--card-bg); border-radius: var(--radius); padding: 1rem 1.25rem; color: var(--text); text-decoration: none; transition: border-color 0.2s; border: 1px solid var(--border); }
.quick-link-card:hover { border-color: var(--primary); }
.quick-link-icon { font-size: 1.25rem; }

/* ===== Admin filters ===== */
.admin-filters { margin: 1.5rem 0; }
.admin-filters form { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; }
.admin-filters .form-control { width: auto; min-width: 180px; }
.admin-filters input[type="text"] { flex: 1; min-width: 250px; }

/* ===== Product management ===== */
.product-search-item { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.75rem; background: var(--card-bg); border-radius: var(--radius-sm); margin-bottom: 0.5rem; }
.product-search-item span { color: var(--text); }
.product-price { color: var(--accent-green); font-weight: 600; }
.linked-product { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.75rem; background: var(--card-bg); border-radius: var(--radius-sm); margin-bottom: 0.5rem; }
.btn-danger { background: #ef4444; color: #fff; border: none; }
.btn-danger:hover { background: #dc2626; }

/* ===== Tag management ===== */
.tag-add-wrapper { display: flex; gap: 0.5rem; }
.tag-add-wrapper .form-control { flex: 1; }
.tag-badge { display: inline-flex; align-items: center; gap: 0.25rem; background: rgba(59, 130, 246, 0.15); color: var(--primary); padding: 0.25rem 0.75rem; border-radius: var(--radius-full); font-size: 0.875rem; margin: 0.25rem; }
.tag-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 0; line-height: 1; }
.tag-remove:hover { color: #ef4444; }
.tag-search-item { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.75rem; background: var(--card-bg); border-radius: var(--radius-sm); margin-bottom: 0.5rem; }

/* ===== IA actions ===== */
.ia-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.ia-result { margin: 1rem 0; }
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin: 1rem 0; }
.alert-success { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.alert-error { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.faq-preview { background: var(--card-bg); padding: 1rem; border-radius: var(--radius-sm); white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow-y: auto; font-size: 0.875rem; color: var(--text-muted); }

/* ===== Article row ===== */
.article-row td a { color: var(--text); text-decoration: none; }
.article-row td a:hover { color: var(--primary); }
