/* Style professionnel pour la documentation OnlyBot - Palette Bleu/Gris Moderne */

:root {
    --bg-primary: #1a1d24;
    --bg-secondary: #252932;
    --bg-sidebar: #1f2329;
    --text-primary: #e8eaed;
    --text-secondary: #9ca3af;
    --accent: #e43f6b;
    --accent-hover: #d12d5a;
    --accent-secondary: #6366f1;
    --accent-tertiary: #8b5cf6;
    --border: #2d3239;
    --code-bg: #1f2329;
    --code-border: #2d3239;
    
    /* Couleurs par catégorie */
    --color-map: #3b82f6;
    --color-npc: #6366f1;
    --color-storage: #8b5cf6;
    --color-inventory: #a78bfa;
    --color-job: #ec4899;
    --color-guilde: #f43f5e;
    --color-character: #f59e0b;
    --color-sale: #10b981;
    --color-buy: #14b8a6;
    --color-craft: #f59e0b;
    --color-fight: #ef4444;
    --color-global: #64748b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #1a1d24;
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.header-logo:hover {
    opacity: 0.8;
}

.header-logo-circle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 4px;
}

.header-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header-search {
    flex: 1;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    z-index: 10002;
}

.header-search input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.header-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(228, 63, 107, 0.15);
    background: var(--bg-primary);
}

.header-search::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    opacity: 0.5;
}

.header-search::after {
    content: "";
    position: absolute;
    left: 24px;
    top: 60%;
    transform: translateY(-50%) rotate(45deg);
    width: 2px;
    height: 8px;
    background: var(--text-secondary);
    opacity: 0.5;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 64px;
    width: 280px;
    height: calc(100vh - 64px);
    background: var(--bg-sidebar);
    overflow-y: auto;
    padding: 16px 0;
    border-right: 1px solid var(--border);
    z-index: 999;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.sidebar-nav {
    list-style: none;
    padding: 0;
}

.sidebar-nav-item {
    margin: 2px 0;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 14px;
    font-weight: normal;
}

.sidebar-nav-link:hover {
    background: rgba(228, 63, 107, 0.12);
    color: var(--text-primary);
    border-left-color: var(--accent);
    transform: translateX(2px);
}

.sidebar-nav-link.active {
    background: rgba(228, 63, 107, 0.18);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 500;
}

.sidebar-nav-link-icon {
    display: none;
}

.sidebar-nav-link[data-submenu] .sidebar-nav-link-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.sidebar-nav-link[data-submenu].active .sidebar-nav-link-icon,
.sidebar-nav-link[data-submenu]:hover .sidebar-nav-link-icon {
    transform: rotate(90deg);
}

.sidebar-nav-submenu {
    list-style: none;
    padding-left: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-nav-submenu.expanded {
    max-height: 2000px;
}

.sidebar-nav-submenu-item {
    margin: 0;
}

.sidebar-nav-submenu-link {
    display: block;
    padding: 8px 20px 8px 48px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    font-weight: normal;
    position: relative;
}

.sidebar-nav-submenu-link::before {
    content: '→';
    position: absolute;
    left: 28px;
    color: var(--text-secondary);
    opacity: 0.5;
    font-size: 12px;
    transition: all 0.2s ease;
}

/* Indentation supplémentaire pour les sous-éléments des catégories (fonctions dans Méthodes Script) */
.sidebar-nav-submenu .sidebar-nav-submenu .sidebar-nav-submenu-link {
    padding-left: 68px;
}

.sidebar-nav-submenu .sidebar-nav-submenu .sidebar-nav-submenu-link::before {
    left: 48px;
}

.sidebar-nav-submenu .sidebar-nav-submenu .sidebar-nav-submenu-link:hover {
    padding-left: 72px;
}

.sidebar-nav-submenu .sidebar-nav-submenu .sidebar-nav-submenu-link.active {
    padding-left: 66px;
}

.sidebar-nav-submenu-link:hover {
    background: rgba(228, 63, 107, 0.1);
    color: var(--text-primary);
    padding-left: 52px;
}

.sidebar-nav-submenu-link:hover::before {
    color: var(--accent);
    opacity: 1;
    transform: translateX(2px);
}

.sidebar-nav-submenu-link.active {
    color: var(--accent);
    background: rgba(228, 63, 107, 0.2);
    font-weight: 600;
    border-left: 2px solid var(--accent);
    padding-left: 46px;
}

.sidebar-nav-submenu-link.active::before {
    color: var(--accent);
    opacity: 1;
}

/* Mise en évidence pour les catégories actives dans Méthodes Script */
.sidebar-nav-submenu-item > .sidebar-nav-submenu-link.active {
    background: rgba(228, 63, 107, 0.25);
    font-weight: 600;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    margin-top: 64px;
    padding: 40px;
    max-width: 1200px;
    width: 100%;
}

.content-header {
    margin-bottom: 32px;
}

.content-title {
    font-size: 36px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--accent);
}

.content-title span:first-child {
    display: none;
}

.content-description {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 32px;
    line-height: 1.7;
    opacity: 0.85;
}

/* Function Card */
.function-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    filter: none !important;
    backdrop-filter: none !important;
}

.function-card * {
    filter: none !important;
    backdrop-filter: none !important;
}

.function-card .function-name,
.function-card .function-name * {
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.function-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    border-radius: 12px 12px 0 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.function-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(228, 63, 107, 0.2);
    transform: translateY(-2px);
}

.function-card:hover::before {
    opacity: 1;
}

.function-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.function-name {
    font-size: 24px;
    font-weight: 500;
    font-family: 'Courier New', monospace;
    letter-spacing: -0.3px;
    filter: none !important;
    backdrop-filter: none !important;
    color: var(--accent);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Style pour les liens dans les noms de fonctions (pages index) */
.function-name a,
.function-name .function-link {
    filter: none !important;
    backdrop-filter: none !important;
    color: var(--accent) !important;
    display: inline-block;
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    letter-spacing: inherit;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    text-shadow: none !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

.function-name a:hover,
.function-name .function-link:hover {
    color: var(--accent-hover) !important;
}

.function-category {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(228, 63, 107, 0.15);
    border: 1px solid rgba(228, 63, 107, 0.3);
    border-radius: 6px;
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.function-description {
    margin-bottom: 20px;
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 15px;
}

.function-description p {
    color: var(--text-primary);
    opacity: 0.9;
}

.function-params {
    margin-bottom: 20px;
}

.function-params-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.function-params-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
    margin-right: 8px;
}

.params-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.params-table th,
.params-table td {
    padding: 12px 16px;
    text-align: left;
}

.params-table th {
    background: rgba(228, 63, 107, 0.1);
    color: var(--text-primary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.params-table td {
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    transition: all 0.2s ease;
}

.params-table tr:last-child td {
    border-bottom: none;
}

.params-table tr:hover td {
    background: rgba(228, 63, 107, 0.1);
    color: var(--text-primary);
}

.params-table code {
    background: rgba(228, 63, 107, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--accent);
    font-weight: 500;
    font-size: 13px;
}

.function-return {
    margin-bottom: 20px;
}

.function-return-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.function-return-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
    margin-right: 8px;
}

.function-return-value {
    color: var(--text-primary);
    background: rgba(228, 63, 107, 0.1);
    padding: 10px 14px;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.function-example {
    margin-top: 24px;
}

.function-example-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.function-example-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
    margin-right: 8px;
}

.code-block {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 16px;
    position: relative;
}

.code-block::before {
    content: 'lua';
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
}

.code-block code {
    font-family: 'Courier New', monospace;
    font-size: 15px;
    color: #e4e7eb;
    line-height: 1.6;
    white-space: pre;
}

.code-block.lua code {
    color: #e4e7eb;
}

/* Styles pour la coloration syntaxique Lua */
.code-block code .token,
.code-block.lua code .token {
    display: inline;
}

/* Mots-clés (function, end, if, etc.) */
.code-block code .token.keyword,
.code-block.lua code .token.keyword {
    color: #e43f6b !important;
    font-weight: 500;
}

/* Chaînes de caractères */
.code-block code .token.string,
.code-block.lua code .token.string {
    color: #10b981 !important;
}

/* Nombres */
.code-block code .token.number,
.code-block.lua code .token.number {
    color: #f59e0b !important;
}

/* Commentaires */
.code-block code .token.comment,
.code-block.lua code .token.comment {
    color: #64748b !important;
    font-style: italic;
}

/* Préfixes de fonctions (global_, map_, etc.) */
.code-block code .token.function-prefix,
.code-block.lua code .token.function-prefix {
    color: #3b82f6 !important;
    font-weight: 500;
}

/* Noms de fonctions après le préfixe */
.code-block code .token.function-name,
.code-block.lua code .token.function-name {
    color: #60a5fa !important;
}

/* Définition de fonction (nom après function) */
.code-block code .token.function-definition,
.code-block.lua code .token.function-definition {
    color: #f06292 !important;
    font-weight: 500;
}

/* Appels de fonctions */
.code-block code .token.function-call,
.code-block.lua code .token.function-call {
    color: #60a5fa !important;
}

/* Variables */
.code-block code .token.variable,
.code-block.lua code .token.variable {
    color: #fbbf24 !important;
}

/* Opérateurs */
.code-block code .token.operator,
.code-block.lua code .token.operator {
    color: #e43f6b !important;
}

/* Ponctuation */
.code-block code .token.punctuation,
.code-block.lua code .token.punctuation {
    color: #9ca3af !important;
}

/* Styles pour les liens dans les pages index */
.function-link {
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;
    color: var(--accent);
}

.function-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    transition: width 0.2s ease;
}

.function-link:hover {
    color: var(--accent-hover);
}

.function-link:hover::after {
    width: 100%;
}

.btn-view-docs {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(228, 63, 107, 0.2);
}

.btn-view-docs:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(228, 63, 107, 0.3);
    background: linear-gradient(135deg, var(--accent-hover), var(--accent-secondary));
}

.btn-view-docs:active {
    transform: translateY(0);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 8px 16px;
    background: rgba(228, 63, 107, 0.1);
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--accent-hover);
}

.breadcrumb-separator {
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Footer */
.footer {
    margin-top: 60px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 24px 16px;
    }
    
    .content-title {
        font-size: 28px;
    }
}

/* Syntax highlighting */
.hljs {
    background: var(--code-bg) !important;
    color: var(--text-primary) !important;
}

/* Amélioration des scrollbars */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Styles pour la recherche globale */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    max-height: 500px;
    overflow-y: auto;
    z-index: 10001;
    display: none;
    min-width: 100%;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(228, 63, 107, 0.12);
}

.search-result-item-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--accent);
    font-family: 'Courier New', monospace;
}

.search-result-item-name mark {
    background: rgba(228, 63, 107, 0.3);
    color: var(--accent);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.search-result-item-category {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-item-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.4;
}

.search-results-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.header-search {
    position: relative;
}

/* Styles pour le contenu des guides */
.guide-content {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 15px;
}

.guide-content h2 {
    font-size: 28px;
    font-weight: 600;
    margin-top: 40px;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

.guide-content h3 {
    font-size: 22px;
    font-weight: 600;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.guide-content p {
    margin-bottom: 16px;
    color: var(--text-primary);
    opacity: 0.9;
}

.guide-content ul,
.guide-content ol {
    margin-bottom: 20px;
    padding-left: 30px;
    color: var(--text-primary);
}

.guide-content li {
    margin-bottom: 8px;
    color: var(--text-primary);
    opacity: 0.9;
}

.guide-content a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.guide-content a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.guide-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.guide-content img,
.guide-image {
    width: 100%;
    max-width: 1248px;
    border-radius: 8px;
    margin: 20px auto;
    display: block;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
