/* === Gonarthrose.fr - Custom Styles === */

:root {
    --primary: #1ba296;
    --primary-dark: #158a7e;
    --accent: #e67e22;
    --text: #2c3e50;
    --bg-light: #f8f9fa;
}

/* Base */
body {
    font-family: 'Inter', sans-serif;
    color: var(--text);
}

/* Override Bootstrap primary */
.bg-primary { background-color: var(--primary) !important; }
.btn-primary { background-color: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background-color: var(--primary-dark); border-color: var(--primary-dark); }
.text-primary { color: var(--primary) !important; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background-color: var(--primary); border-color: var(--primary); }
.badge.bg-primary { background-color: var(--primary) !important; }

/* Navbar */
.navbar { box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.navbar-brand { font-size: 1.3rem; }

/* Hero */
.hero-section { position: relative; overflow: visible; }
.hero-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    z-index: 3;
}

/* Hero visual */
.hero-visual {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 50%;
    overflow: hidden;
    z-index: 1;
}
.hero-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 40%);
    mask-image: linear-gradient(to right, transparent 0%, black 40%);
}
.hero-visual::after {
    display: none;
}
@media (max-width: 991px) {
    .hero-visual { width: 40%; opacity: 0.5; }
}
@media (max-width: 767px) {
    .hero-visual { display: none; }
}

/* Category cards */
.category-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
}
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}
.category-card .card-img-top {
    height: 160px;
    object-fit: cover;
}
.category-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

/* Article cards */
.article-card {
    transition: transform 0.2s, box-shadow 0.2s;
}
.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
}

/* Article content */
.article-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
    color: var(--primary-dark);
}
.article-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}
.article-content p { line-height: 1.8; margin-bottom: 1rem; }
.article-content ul, .article-content ol { margin-bottom: 1rem; }
.article-content li { margin-bottom: 0.3rem; line-height: 1.7; }
.article-content img { max-width: 100%; height: auto; border-radius: 8px; }
.article-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    background: var(--bg-light);
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
}
.article-content table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}
.article-content th, .article-content td {
    border: 1px solid #dee2e6;
    padding: 0.75rem;
}
.article-content th { background: var(--bg-light); font-weight: 600; }

/* Table of Contents */
.toc-box {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    overflow: hidden;
}
.toc-box-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 0.7rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.toc-box-label {
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}
.toc-box-count {
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
}
.toc-box-nav {
    padding: 0.6rem 0;
}
.toc-box-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: toc-num;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.toc-box-nav li {
    counter-increment: toc-num;
    border-bottom: 1px solid #f2f3f5;
}
.toc-box-nav li:nth-last-child(-n+2) {
    border-bottom: none;
}
.toc-box-nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1.1rem;
    text-decoration: none;
    color: var(--text);
    font-size: 0.84rem;
    line-height: 1.3;
    transition: background 0.15s, color 0.15s;
}
.toc-box-nav a::before {
    content: counter(toc-num);
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--bg-light);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.toc-box-nav a:hover {
    background: rgba(27, 162, 150, 0.05);
    color: var(--primary-dark);
}
.toc-box-nav a:hover::before {
    background: var(--primary);
    color: #fff;
}
@media (max-width: 575px) {
    .toc-box-nav ul {
        grid-template-columns: 1fr;
    }
    .toc-box-nav li:last-child {
        border-bottom: none;
    }
    .toc-box-nav li:nth-last-child(2) {
        border-bottom: 1px solid #f2f3f5;
    }
}

/* FAQ accordion */
.faq-section .accordion-button:not(.collapsed) {
    background-color: rgba(13, 115, 119, 0.05);
    color: var(--primary-dark);
}
.faq-section .accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 115, 119, 0.25);
}

/* Admin sidebar */
.admin-sidebar {
    width: 250px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow-y: auto;
}
.admin-content {
    margin-left: 250px;
    min-height: 100vh;
}
.admin-sidebar .nav-link {
    padding: 0.6rem 1rem;
    border-radius: 6px;
    margin: 2px 0;
    transition: background 0.2s;
}
.admin-sidebar .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff !important;
}

/* Responsive admin */
@media (max-width: 991px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .admin-sidebar.show {
        transform: translateX(0);
    }
    .admin-content {
        margin-left: 0;
    }
}

/* Share buttons */
.share-buttons .btn { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* Footer */
footer a:hover { color: #fff !important; }

/* Breadcrumb */
.breadcrumb { font-size: 0.875rem; background: transparent; padding: 0; }

/* Text purple for hospital icon */
.text-purple { color: #9b59b6; }

/* === Search Autocomplete === */
.search-autocomplete { position: relative; }
.search-autocomplete .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
    z-index: 2;
    pointer-events: none;
}
.search-autocomplete .search-input {
    padding-left: 38px;
    border-radius: 50px;
    border: 1px solid #dee2e6;
    font-size: 0.9rem;
}
.search-autocomplete .search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(27, 162, 150, 0.15);
}
.search-autocomplete .search-results {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 1050;
    max-height: 360px;
    overflow-y: auto;
}
.search-result-item {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
    cursor: pointer;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:first-child { border-radius: 12px 12px 0 0; }
.search-result-item:last-child { border-radius: 0 0 12px 12px; }
.search-result-item:only-child { border-radius: 12px; }
.search-result-item:hover,
.search-result-item.active {
    background: rgba(27, 162, 150, 0.08);
    color: var(--primary-dark);
}
.search-result-title {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
}
.search-result-title mark {
    background: rgba(27, 162, 150, 0.2);
    color: var(--primary-dark);
    padding: 0 1px;
    border-radius: 2px;
}
.search-result-category {
    display: inline-block;
    font-size: 0.75rem;
    color: #8e9aaf;
    margin-top: 2px;
}
.search-no-results {
    padding: 16px;
    text-align: center;
    color: #8e9aaf;
    font-size: 0.875rem;
}

/* Hero variant: white input on teal background */
.search-hero {
    flex: 1;
    min-width: 220px;
    max-width: 320px;
}
.search-hero .search-input {
    background: rgba(255,255,255,0.95);
    border: none;
    color: var(--text);
    height: 48px;
    font-size: 0.95rem;
}
.search-hero .search-input::placeholder { color: #8e9aaf; }
.search-hero .search-input:focus {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}
.search-hero .search-icon { color: var(--primary); }

/* Category variant: centered */
.search-category .search-input { height: 44px; }

/* Sidebar variant: compact */
.search-sidebar .search-input {
    font-size: 0.85rem;
    height: 38px;
    padding-left: 34px;
}
.search-sidebar .search-icon { left: 10px; font-size: 0.8rem; }
