﻿/* =========================================
           RESET & BASE
           ========================================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Palette officielle */
    --primary: #0B3D91;
    --primary-dark: #062A64;
    --primary-light: #1A56B8;
    --accent: #C8902E;
    --accent-light: #E5A93D;
    --surface: #FFFFFF;
    --surface-alt: #F4F6FA;
    --surface-hover: #EDF0F7;
    --text-primary: #1A1F36;
    --text-secondary: #4A5568;
    --text-muted: #8492A6;
    --border: #E2E8F0;
    --border-light: #EDF2F7;
    --shadow-sm: 0 1px 3px rgba(11, 61, 145, 0.06);
    --shadow-md: 0 4px 16px rgba(11, 61, 145, 0.08);
    --shadow-lg: 0 12px 40px rgba(11, 61, 145, 0.12);
    --shadow-xl: 0 20px 60px rgba(11, 61, 145, 0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-arabic: 'Noto Kufi Arabic', 'Inter', sans-serif;
    --max-width: 1280px;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--surface-alt);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* =========================================
           NAVBAR
           ========================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-light);
    height: 72px;
    transition: var(--transition);
}

.navbar.scrolled {
    box-shadow: var(--shadow-md);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-emblem {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.5px;
    box-shadow: 0 2px 8px rgba(11, 61, 145, 0.25);
}

.logo-info {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.logo-org {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.nav-btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--primary);
}

.lang-toggle {
    padding: 7px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-family: var(--font-main);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.02em;
}

.lang-toggle:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: rgba(11, 61, 145, 0.03);
}

/* =========================================
           HERO
           ========================================= */
.hero {
    position: relative;
    padding: 160px 0 100px;
    background: linear-gradient(165deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 80%, rgba(200, 144, 46, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 60% 50% at 80% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

.hero-bg-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.04;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 780px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 100px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    margin-bottom: 28px;
    backdrop-filter: blur(10px);
}

.hero-badge-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-light);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.hero-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    color: #FFFFFF;
    line-height: 1.15;
    margin-bottom: 18px;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.7;
    margin-bottom: 44px;
    font-weight: 400;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* =========================================
           SEARCH BAR
           ========================================= */
.search-container {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
}

.search-bar {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 14px;
    padding: 6px 8px 6px 20px;
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255, 255, 255, 0.2);
    transition: var(--transition);
    gap: 8px;
}

.search-bar:focus-within {
    box-shadow: var(--shadow-xl), 0 0 0 3px rgba(200, 144, 46, 0.3);
    transform: translateY(-1px);
}

.search-icon {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-primary);
    padding: 14px 8px;
}

.search-bar input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

#clear-search {
    background: var(--surface-hover);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

#clear-search:hover {
    background: #fee2e2;
    color: #dc2626;
}

.search-btn {
    padding: 12px 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: var(--font-main);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--primary-light);
}

.suggestions-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    max-height: 360px;
    overflow-y: auto;
    z-index: 100;
}

.search-shortcuts {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.shortcut-tag {
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 100px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.shortcut-tag:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* =========================================
           STATISTICS BAR
           ========================================= */
.stats-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: 0;
    position: relative;
    z-index: 5;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 28px;
    border-right: 1px solid var(--border-light);
    transition: var(--transition);
}

.stat-item:last-child {
    border-right: none;
}

.stat-item:hover {
    background: var(--surface-alt);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: rgba(11, 61, 145, 0.08);
    color: var(--primary);
}

.stat-icon.amber {
    background: rgba(200, 144, 46, 0.1);
    color: var(--accent);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.stat-icon.purple {
    background: rgba(124, 58, 237, 0.1);
    color: #7C3AED;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* =========================================
           SECTIONS
           ========================================= */
.featured-section {
    padding: 64px 0 80px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.section-title-icon.blue {
    background: rgba(11, 61, 145, 0.08);
}

.section-title-icon.amber {
    background: rgba(200, 144, 46, 0.1);
}

.section-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.section-link:hover {
    color: var(--accent);
    gap: 8px;
}

/* =========================================
           CARDS
           ========================================= */
.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.doc-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 28px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.doc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: var(--transition);
}

.doc-card:hover {
    border-color: rgba(11, 61, 145, 0.15);
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.doc-card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    background: var(--surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.card-badge {
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-guide {
    background: rgba(11, 61, 145, 0.08);
    color: var(--primary);
}

.badge-kit {
    background: rgba(200, 144, 46, 0.1);
    color: var(--accent);
}

.badge-form {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
}

.badge-procedure {
    background: rgba(124, 58, 237, 0.08);
    color: #7C3AED;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 8px;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.65;
    flex: 1;
    margin-bottom: 18px;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.card-action {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.doc-card:hover .card-action {
    color: var(--accent);
    gap: 8px;
}

/* =========================================
           WORKSPACE (RESULTS + VIEWER)
           ========================================= */
.workspace-view {
    position: fixed;
    inset: 0;
    z-index: 500;
    padding-top: 72px;
    height: 100vh;
    background: var(--surface-alt);
    overflow: hidden;
}

.workspace-container {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    height: calc(100vh - 72px);
    overflow: hidden;
    padding: 20px;
}

.glass-panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.workspace-sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.workspace-nav-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-light);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    border: none;
    background: none;
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 12px;
}

.btn-back:hover {
    color: var(--accent);
}

.workspace-theme {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.sidebar-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--surface-alt);
    outline: none;
    transition: var(--transition);
}

.sidebar-input:focus {
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 3px rgba(11, 61, 145, 0.08);
}

.results-meta {
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.workspace-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.workspace-list::-webkit-scrollbar {
    width: 4px;
}

.workspace-list::-webkit-scrollbar-track {
    background: transparent;
}

.workspace-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.workspace-viewer {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    gap: 16px;
}

.viewer-info {
    flex: 1;
    min-width: 0;
}

.viewer-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewer-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover:not(:disabled) {
    background: var(--surface-alt);
    border-color: var(--primary-light);
    color: var(--primary);
}

.btn-icon:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-danger:hover {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #dc2626 !important;
}

.viewer-counter {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 40px;
    text-align: center;
}

.viewer-body {
    flex: 1;
    position: relative;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.viewer-body iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* =========================================
           RELATION BADGE
           ========================================= */
.relation-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.relation-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.relation-link {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.relation-link:hover {
    color: var(--accent);
}

/* =========================================
           HOVER PREVIEW
           ========================================= */
.hover-preview {
    position: fixed;
    z-index: 9999;
    padding: 16px 20px;
    max-width: 300px;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

/* =========================================
           FOOTER
           ========================================= */
.site-footer {
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.6);
    padding: 40px 0;
    text-align: center;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-logo {
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.04em;
}

.footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

.footer-copy {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 8px;
}

/* =========================================
           UTILITIES
           ========================================= */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeInUp 0.6s ease-out both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
           RESPONSIVE
           ========================================= */
@media (max-width: 1024px) {
    .workspace-container {
        grid-template-columns: 300px 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-item:nth-child(2) {
        border-right: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1.2rem;
    }

    .hero {
        padding: 130px 0 70px;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-item {
        padding: 18px 20px;
    }

    .featured-grid {
        grid-template-columns: 1fr;
    }

    .workspace-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .search-shortcuts {
        gap: 6px;
    }

    .nav-links .nav-btn-ghost {
        display: none;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-item {
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
}

/* Result Sidebar Cards */
.result-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border-color, #E2E8F0);
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
}

.result-card.active {
    border-color: var(--primary, #0B3D91);
    box-shadow: 0 4px 12px rgba(11, 61, 145, 0.1);
}

.result-card:hover {
    border-color: var(--accent, #C8902E);
}

.result-title {
    font-weight: 700;
    color: var(--primary, #0B3D91);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.result-snippet {
    font-size: 0.82rem;
    color: #64748B;
}

.search-highlight {
    background-color: rgba(200, 144, 46, 0.2);
    color: var(--primary, #0B3D91);
    padding: 0 0.15rem;
    font-weight: 700;
    border-radius: 3px;
}