/* Wiki MixMaster - Arbre de Mix CSS */
/* Container principal */
.mix-tree-container {
    display: flex;
    height: calc(100vh - 70px);
    position: relative;
    background: var(--bg-primary);
}
.mix-tree-container.fullscreen { position: fixed; inset: 0; height: 100vh; z-index: 9999; }

/* SIDEBAR */
.tree-sidebar {
    width: 300px;
    min-width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}
.tree-sidebar.hidden { width: 0; min-width: 0; padding: 0; border: none; }
.tree-sidebar.hidden > * { opacity: 0; pointer-events: none; }

.sidebar-toggle {
    position: absolute;
    left: 300px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 60px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.3s ease, background 0.2s;
    z-index: 150;
}
.sidebar-toggle:hover { background: var(--accent-color); color: #fff; }

.sidebar-header { padding: 1rem; border-bottom: 1px solid var(--border-color); }
.sidebar-header h1 { font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; color: var(--text-primary); }
.sidebar-header h1 i { color: var(--accent-color); }

.sidebar-select { width: 100%; padding: 0.6rem 0.75rem; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-primary); font-size: 0.9rem; }
.sidebar-select:focus { outline: none; border-color: var(--accent-color); }

.target-info { padding: 1rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 1rem; }
.target-sprite { /* width: 70px; */ height: 70px; object-fit: cover; background: var(--bg-tertiary); border-radius: 10px; }
.target-details h2 { font-size: 1rem; margin-bottom: 0.25rem; }
.target-level { font-size: 0.85rem; color: var(--text-secondary); }
.target-race { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.75rem; margin-top: 0.35rem; }
.target-race img { width: 14px; height: 14px; }

.progress-section { padding: 1rem; border-bottom: 1px solid var(--border-color); }
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.progress-title { font-size: 0.85rem; color: var(--text-secondary); }
.progress-percent { font-size: 1.25rem; font-weight: 700; color: #27ae60; }
.progress-bar { height: 8px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; margin-bottom: 0.75rem; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #27ae60, #2ecc71); border-radius: 4px; transition: width 0.5s ease; }
.progress-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.progress-stat { text-align: center; padding: 0.5rem; background: var(--bg-tertiary); border-radius: 6px; }
.progress-stat-value { font-size: 1.1rem; font-weight: 700; }
.progress-stat-label { font-size: 0.7rem; color: var(--text-secondary); }
.progress-stat.owned .progress-stat-value { color: #27ae60; }
.progress-stat.drops .progress-stat-value { color: #3498db; }
.progress-stat.mixes .progress-stat-value { color: #9b59b6; }

.required-section { flex: 1; overflow-y: auto; padding: 1rem; min-height: 0; }
.required-title { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.required-search { margin-bottom: 0.75rem; }
.required-search input { width: 100%; padding: 0.5rem 0.75rem; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-primary); font-size: 0.85rem; }
.required-search input:focus { outline: none; border-color: var(--accent-color); }
.required-search input::placeholder { color: var(--text-secondary); }
.required-list { display: flex; flex-direction: column; gap: 0.5rem; }
.required-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem; background: var(--bg-tertiary); border-radius: 8px; cursor: pointer; transition: all 0.2s; border: 1px solid transparent; }
.required-item:hover { background: rgba(94, 114, 175, 0.2); border-color: rgba(94, 114, 175, 0.3); }
.required-item.owned { background: rgba(39, 174, 96, 0.15); border-color: rgba(39, 174, 96, 0.3); }
.required-item-img { position: relative; width: 44px; height: 44px; flex-shrink: 0; background: rgba(20, 25, 35, 0.8); border-radius: 6px; overflow: hidden; }
.required-item-img img { width: 100%; height: 100%; object-fit: cover; }
.qty-badge { position: absolute; bottom: 0; right: 0; background: #e74c3c; color: #fff; font-size: 0.6rem; font-weight: 700; padding: 1px 3px; border-radius: 3px 0 0 0; line-height: 1; }
.required-item-info { flex: 1; min-width: 0; }
.required-item-name { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.required-item-type { font-size: 0.7rem; color: var(--text-secondary); display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.required-item-type img { width: 14px; height: 14px; }
.required-item-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-color); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; flex-shrink: 0; }
.required-item.owned .required-item-check { background: #27ae60; border-color: #27ae60; color: #fff; }
.required-item-info-btn { width: 26px; height: 26px; border-radius: 6px; border: none; background: rgba(94,114,175,0.2); color: var(--accent-color, #5E72AF); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; flex-shrink: 0; transition: all 0.2s; }
.required-item-info-btn:hover { background: var(--accent-color, #5E72AF); color: #fff; }

/* Modale Hench Info */
.hench-info-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 10001; display: none; align-items: center; justify-content: center; padding: 1rem; }
.hench-info-modal-overlay.active { display: flex; }
.hench-info-modal { background: var(--bg-secondary, #1a1d2e); border-radius: 12px; width: 95%; height: 90%; max-width: 1200px; display: flex; flex-direction: column; border: 1px solid var(--border-color, #2a2d3e); overflow: hidden; }
.hench-info-modal-header { padding: 1rem 1.25rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color, #2a2d3e); flex-shrink: 0; }
.hench-info-modal-title { font-size: 1.1rem; font-weight: 600; color: var(--text-primary, #e8eaf0); display: flex; align-items: center; gap: 0.5rem; }
.hench-info-modal-title i { color: var(--accent-color, #5E72AF); }
.hench-info-modal-title .modal-header-icon { display: flex; align-items: center; justify-content: center; }
.hench-info-modal-title .modal-header-icon img { width: 24px; height: 24px; object-fit: contain; }
.hench-info-modal-close { background: none; border: none; color: var(--text-secondary, #8892b0); font-size: 1.5rem; cursor: pointer; line-height: 1; }
.hench-info-modal-close:hover { color: var(--text-primary, #e8eaf0); }
.hench-info-modal-body { flex: 1; overflow: hidden; }
.hench-info-modal-body iframe { width: 100%; height: 100%; border: none; }
.hench-info-modal-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--border-color, #2a2d3e); display: flex; justify-content: flex-end; gap: 0.75rem; flex-shrink: 0; }
.hench-info-modal-btn { padding: 0.6rem 1.25rem; border-radius: 8px; font-size: 0.9rem; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; transition: all 0.2s; }
.hench-info-modal-btn-primary { background: var(--accent-color, #5E72AF); color: #fff; border: none; }
.hench-info-modal-btn-primary:hover { background: #4a5a8f; }
.hench-info-modal-btn-secondary { background: transparent; color: var(--text-secondary, #8892b0); border: 1px solid var(--border-color, #2a2d3e); }
.hench-info-modal-btn-secondary:hover { color: var(--text-primary, #e8eaf0); border-color: var(--text-secondary, #8892b0); }

.back-link { padding: 1rem; border-top: 1px solid var(--border-color, rgba(255,255,255,0.1)); flex-shrink: 0; margin-top: auto; background: var(--bg-secondary, rgba(20, 22, 30, 0.98)); }
.back-link a { display: flex; align-items: center; gap: 0.5rem; color: var(--text-secondary, #8892b0); text-decoration: none; font-size: 0.9rem; white-space: nowrap; overflow: hidden; }
.back-link a:hover { color: var(--text-primary, #fff); }

/* ACCÈS REQUIS (Connexion / VIP) */
.access-required { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg-primary); z-index: 100; }
.access-box { text-align: center; padding: 2.5rem 3rem; max-width: 480px; background: var(--bg-secondary); border-radius: 20px; border: 1px solid var(--border-color); box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
[data-theme="light"] .access-box { background: #ffffff; border-color: #e0e0e0; box-shadow: 0 20px 60px rgba(0,0,0,0.1); }
.access-box-icon { width: 80px; height: 80px; margin: 0 auto 1.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.access-box-icon.login { background: linear-gradient(135deg, rgba(94, 114, 175, 0.2), rgba(94, 114, 175, 0.1)); color: #5E72AF; }
.access-box-icon.vip { background: linear-gradient(135deg, rgba(241, 196, 15, 0.2), rgba(243, 156, 18, 0.1)); color: #f1c40f; }
.access-box h2 { font-size: 1.4rem; margin-bottom: 0.75rem; color: var(--text-primary); font-weight: 600; }
[data-theme="light"] .access-box h2 { color: #1a1a2e; }
.access-box p { color: var(--text-secondary); margin-bottom: 1.75rem; line-height: 1.7; font-size: 0.95rem; }
[data-theme="light"] .access-box p { color: #666; }
.access-box .btn-access { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1.75rem; font-weight: 600; border-radius: 10px; text-decoration: none; transition: all 0.3s ease; font-size: 0.95rem; }
.access-box .btn-login { background: #5E72AF; color: #fff; }
.access-box .btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(94, 114, 175, 0.4); }
.access-box .btn-vip { background: linear-gradient(135deg, #f1c40f, #f39c12); color: #1a1a2e; }
.access-box .btn-vip:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(241, 196, 15, 0.4); }
.access-box .btn-secondary-link { display: block; margin-top: 1rem; color: var(--text-secondary); font-size: 0.85rem; text-decoration: none; }
[data-theme="light"] .access-box .btn-secondary-link { color: #666; }
.access-box .btn-secondary-link:hover { color: var(--text-primary); }
[data-theme="light"] .access-box .btn-secondary-link:hover { color: #1a1a2e; }

/* SHARED ARBRE BANNER */
.shared-banner { position: fixed; bottom: 20px; left: 20px; padding: 0.75rem 1rem; background: var(--bg-secondary); border-radius: 12px; border: 1px solid var(--border-color); display: flex; align-items: center; gap: 1rem; box-shadow: 0 4px 20px rgba(0,0,0,0.3); z-index: 1000; max-width: calc(100% - 40px); transition: all 0.3s ease; }
.shared-banner.hidden { opacity: 0; transform: translateX(-100%); pointer-events: none; }
[data-theme="light"] .shared-banner { background: #ffffff; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.shared-banner-info { display: flex; align-items: center; gap: 0.75rem; }
.shared-banner-info i { color: #5E72AF; }
.shared-banner-info span { font-size: 0.85rem; color: var(--text-secondary); }
[data-theme="light"] .shared-banner-info span { color: #666; }
.shared-banner-info strong { color: var(--text-primary); }
[data-theme="light"] .shared-banner-info strong { color: #1a1a2e; }
.shared-banner-actions { display: flex; gap: 0.5rem; }
.shared-banner .btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; border-radius: 6px; border: none; cursor: pointer; transition: all 0.2s; }
.shared-banner .btn-close { background: transparent; color: var(--text-secondary); padding: 0.25rem 0.5rem; font-size: 1rem; }
.shared-banner .btn-close:hover { color: var(--text-primary); }
[data-theme="light"] .shared-banner .btn-close { color: #999; }
[data-theme="light"] .shared-banner .btn-close:hover { color: #333; }
.shared-banner .btn-copy { background: var(--bg-tertiary); color: var(--text-primary); }
[data-theme="light"] .shared-banner .btn-copy { background: #f0f0f0; color: #1a1a2e; }
.shared-banner .btn-copy:hover { background: #5E72AF; color: #fff; }

/* MODAL SAUVEGARDE - Compatible mode clair/sombre */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; z-index: 10000; backdrop-filter: blur(5px); }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--bg-secondary, #1a1d28); border-radius: 16px; border: 1px solid var(--border-color, rgba(255,255,255,0.1)); width: 90%; max-width: 450px; max-height: 90vh; overflow-y: auto; color: var(--text-primary, #fff); }
[data-theme="light"] .modal-box { background: #ffffff; border-color: #e0e0e0; color: #1a1a2e; }
.modal-header { padding: 1.25rem; border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.1)); display: flex; align-items: center; justify-content: space-between; }
[data-theme="light"] .modal-header { border-color: #e0e0e0; }
.modal-header h3 { font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; color: var(--text-primary, #fff); margin: 0; }
[data-theme="light"] .modal-header h3 { color: #1a1a2e; }
.modal-header h3 i { color: var(--accent-color, #5E72AF); }
.modal-close { background: none; border: none; color: var(--text-secondary, #8892b0); font-size: 1.25rem; cursor: pointer; padding: 0.25rem; }
.modal-close:hover { color: var(--text-primary, #fff); }
[data-theme="light"] .modal-close { color: #666; }
[data-theme="light"] .modal-close:hover { color: #1a1a2e; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-color, rgba(255,255,255,0.1)); display: flex; justify-content: flex-end; gap: 0.75rem; }
[data-theme="light"] .modal-footer { border-color: #e0e0e0; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-secondary, #8892b0); margin-bottom: 0.5rem; }
[data-theme="light"] .form-group label { color: #666; }
.form-group input[type="text"], .form-group input[type="email"] { width: 100%; padding: 0.6rem 0.75rem; background: var(--bg-tertiary, #2d323e); border: 1px solid var(--border-color, rgba(255,255,255,0.1)); border-radius: 6px; color: var(--text-primary, #fff); font-size: 0.9rem; }
[data-theme="light"] .form-group input[type="text"], [data-theme="light"] .form-group input[type="email"] { background: #f5f5f5; border-color: #ddd; color: #1a1a2e; }
.form-group input:focus { outline: none; border-color: var(--accent-color, #5E72AF); }
.form-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-color, #5E72AF); }
.form-check label { font-size: 0.9rem; color: var(--text-primary, #fff); cursor: pointer; }
[data-theme="light"] .form-check label { color: #1a1a2e; }
.form-check small { display: block; font-size: 0.75rem; color: var(--text-secondary, #8892b0); margin-top: 0.25rem; margin-left: 1.6rem; }
[data-theme="light"] .form-check small { color: #666; }

.share-link-box { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.share-link-box input { flex: 1; padding: 0.5rem 0.75rem; background: var(--bg-tertiary, #2d323e); border: 1px solid var(--border-color, rgba(255,255,255,0.1)); border-radius: 6px; color: var(--text-primary, #fff); font-size: 0.8rem; }
[data-theme="light"] .share-link-box input { background: #f5f5f5; border-color: #ddd; color: #1a1a2e; }
.share-link-box button { padding: 0.5rem 1rem; background: var(--accent-color, #5E72AF); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 0.8rem; }
.share-link-box button:hover { opacity: 0.9; }

.btn { padding: 0.6rem 1.25rem; border-radius: 8px; border: none; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all 0.2s; }
.btn-primary { background: var(--accent-color, #5E72AF); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--bg-tertiary, #2d323e); color: var(--text-primary, #fff); }
[data-theme="light"] .btn-secondary { background: #e0e0e0; color: #1a1a2e; }
.btn-secondary:hover { background: var(--border-color, #3d4354); }
[data-theme="light"] .btn-secondary:hover { background: #ccc; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }

/* MODALES - Design comme henchs.php */
.settings-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-y: auto;
}
.settings-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.settings-modal {
    background: var(--bg-secondary, #2d323e);
    border: 1px solid var(--border-color, #3d4354);
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    margin: 20px auto;
    transition: all 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
[data-theme="light"] .settings-modal {
    background: #ffffff;
    border-color: #e0e0e0;
}
.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color, #3d4354);
}
[data-theme="light"] .settings-modal-header {
    border-color: #e0e0e0;
}
.settings-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary, #e8eaf0);
}
[data-theme="light"] .settings-modal-header h3 {
    color: #1a1a2e;
}
.settings-modal-header h3 i {
    color: #5E72AF;
}
.settings-modal-close {
    background: transparent;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    color: var(--text-secondary, #8890a8);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.25rem;
}
.settings-modal-close:hover {
    color: var(--text-primary, #e8eaf0);
}
[data-theme="light"] .settings-modal-close {
    color: #666;
}
[data-theme="light"] .settings-modal-close:hover {
    color: #1a1a2e;
}
.settings-modal-body {
    padding: 1.5rem;
}
.settings-group {
    margin-bottom: 1.25rem;
}
.settings-group:last-child {
    margin-bottom: 0;
}
.settings-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary, #b8bdd0);
    margin-bottom: 0.5rem;
}
[data-theme="light"] .settings-label {
    color: #666;
}
.settings-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-tertiary, #3d4152);
    border: 1px solid var(--border-color, #4a4f65);
    border-radius: 8px;
    color: var(--text-primary, #e8eaf0);
    font-size: 0.9rem;
}
[data-theme="light"] .settings-input {
    background: #f5f5f5;
    border-color: #ddd;
    color: #1a1a2e;
}
.settings-input:focus {
    outline: none;
    border-color: #5E72AF;
}
.settings-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary, #3d4152);
    border-radius: 8px;
    cursor: pointer;
}
[data-theme="light"] .settings-checkbox {
    background: #f5f5f5;
}
.settings-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: #5E72AF;
}
.settings-checkbox-text {
    flex: 1;
}
.settings-checkbox-label {
    font-size: 0.9rem;
    color: var(--text-primary, #e8eaf0);
}
[data-theme="light"] .settings-checkbox-label {
    color: #1a1a2e;
}
.settings-checkbox-hint {
    font-size: 0.75rem;
    color: var(--text-secondary, #8890a8);
    margin-top: 0.25rem;
}
[data-theme="light"] .settings-checkbox-hint {
    color: #666;
}
.settings-info {
    font-size: 0.8rem;
    color: var(--text-secondary, #8890a8);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
[data-theme="light"] .settings-info {
    color: #666;
}
.settings-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color, #3d4354);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
[data-theme="light"] .settings-modal-footer {
    border-color: #e0e0e0;
}
.settings-modal-footer .btn-danger {
    margin-right: auto;
}

/* TOAST NOTIFICATION */
.toast-notification { position: fixed; top: 90px; right: 30px; padding: 1rem 1.5rem; border-radius: 10px; font-weight: 500; display: flex; align-items: center; gap: 0.6rem; box-shadow: 0 4px 20px rgba(0,0,0,0.3); transform: translateX(120%); transition: transform 0.3s ease; z-index: 10001; font-size: 0.9rem; }
.toast-notification.show { transform: translateX(0); }
.toast-notification.success { background: #27ae60; color: white; }
.toast-notification.error { background: #e74c3c; color: white; }
.toast-notification.info { background: var(--accent-color, #5E72AF); color: white; }

/* MES ARBRES MODAL - Items */
.arbre-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--bg-tertiary, #2d323e); border-radius: 8px; cursor: pointer; transition: all 0.2s; border: 1px solid transparent; }
[data-theme="light"] .arbre-item { background: #f5f5f5; }
.arbre-item:hover { border-color: var(--accent-color, #5E72AF); background: rgba(94, 114, 175, 0.1); }
.arbre-item img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.arbre-item-info { flex: 1; min-width: 0; }
.arbre-item-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary, #fff); }
[data-theme="light"] .arbre-item-name { color: #1a1a2e; }
.arbre-item-meta { font-size: 0.75rem; color: var(--text-secondary, #8892b0); }
[data-theme="light"] .arbre-item-meta { color: #666; }

/* MAIN */
.main { flex: 1; position: relative; overflow: hidden; background: var(--bg-primary, #0a0b0f); }
.main::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(var(--border-color, rgba(255,255,255,0.1)) 1px, transparent 1px), linear-gradient(90deg, var(--border-color, rgba(255,255,255,0.1)) 1px, transparent 1px); background-size: 50px 50px; pointer-events: none; opacity: 0.3; z-index: 0; }
#tree-svg { width: 100%; height: 100%; cursor: grab; position: relative; z-index: 1; }
#tree-svg:active { cursor: grabbing; }

/* D3 - Couleurs explicites pour éviter les problèmes de variables */
.link { fill: none; stroke: #5E72AF; stroke-width: 3px; }
.link-glow { fill: none; stroke: #5E72AF; stroke-width: 12px; opacity: 0.2; }
.node { cursor: pointer; }
.node-bg { fill: #1a1d28; stroke: rgba(255,255,255,0.15); stroke-width: 2; transition: all 0.3s; }
[data-theme="light"] .node-bg { fill: #ffffff; stroke: rgba(0,0,0,0.15); }
.node:hover .node-bg { stroke: #5E72AF !important; stroke-width: 2; filter: drop-shadow(0 0 15px rgba(94, 114, 175, 0.6)); }
.node.root .node-bg { stroke: #5E72AF; stroke-width: 3; filter: drop-shadow(0 0 20px rgba(94, 114, 175, 0.5)); }
.node.owned .node-bg { stroke: #27ae60 !important; filter: drop-shadow(0 0 12px rgba(39, 174, 96, 0.5)); }
.node.has-more .node-bg { stroke: #f39c12 !important; stroke-dasharray: 5,3; }
.node-name { fill: #fff; font-size: 10px; font-weight: 600; text-anchor: middle; }
.node-level { fill: rgba(255,255,255,0.7); font-size: 9px; }
.node-badge { pointer-events: none; }
.formula-selector { cursor: pointer; }
.formula-selector rect { fill: rgba(94, 114, 175, 0.3); stroke: #5E72AF; stroke-width: 1; rx: 4; }
.formula-selector:hover rect { fill: rgba(94, 114, 175, 0.6); stroke: #7B8EC9; }
.formula-selector text { fill: #fff; font-size: 9px; text-anchor: middle; pointer-events: none; }
.plus-indicator { pointer-events: none; }
.plus-indicator circle { fill: #5E72AF; }
.plus-indicator text { fill: #fff; font-size: 14px; font-weight: bold; text-anchor: middle; dominant-baseline: central; }
.expand-btn { fill: #f39c12; font-size: 10px; cursor: pointer; text-anchor: middle; }
.expand-btn:hover { fill: #e67e22; }
.action-btn { cursor: pointer; }

/* TOOLBAR - sort du bas, collée au bord, AU-DESSUS de l'arbre */
.toolbar-wrapper { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 0; z-index: 100; margin: 6px;}
.toolbar-toggle { width: 60px; height: 24px; background: var(--bg-secondary, rgba(20, 22, 30, 0.98)); border: 1px solid var(--border-color, rgba(255,255,255,0.1)); border-bottom: none; border-radius: 8px 8px 0 0; color: var(--text-secondary, #8892b0); cursor: pointer; display: flex; align-items: center; justify-content: center; margin-bottom: -1px; }
.toolbar-toggle:hover { background: #5E72AF; color: #fff; }
.toolbar { display: flex; gap: 0.5rem; background: var(--bg-secondary, rgba(20, 22, 30, 0.98)); padding: 0.5rem; border-radius: 12px 12px 0 0; border: 1px solid var(--border-color, rgba(255,255,255,0.1)); border-bottom: none; backdrop-filter: blur(10px); transition: all 0.3s ease; margin: 0; }
.toolbar-wrapper.hidden .toolbar { height: 0; padding: 0; overflow: hidden; opacity: 0; border: none; }
.tool-btn { width: 40px; height: 40px; border-radius: 8px; border: none; background: var(--bg-tertiary, rgba(30, 35, 50, 0.8)); color: var(--text-secondary, #8892b0); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.tool-btn:hover { background: #5E72AF; color: #fff; }
.tool-btn.active { background: #5E72AF; color: #fff; }
.tool-separator { width: 1px; background: rgba(255,255,255,0.15); margin: 0.25rem; }
.zoom-display { display: flex; align-items: center; padding: 0 0.75rem; color: var(--text-secondary, #8892b0); font-size: 0.85rem; font-weight: 600; }

/* LOADING */
.loading-overlay { position: absolute; inset: 0; background: var(--bg-primary); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 500; opacity: 0.98; }
.loading-overlay.hidden { display: none; }
.loading-spinner { width: 50px; height: 50px; border: 4px solid var(--border-color); border-top-color: var(--accent-color); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-secondary); font-size: 0.9rem; }

/* MODAL CONFIRMATION */
.confirm-modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); z-index: 10000; opacity: 0; visibility: hidden; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; }
.confirm-modal-overlay.active { opacity: 1; visibility: visible; }
.confirm-modal { background: var(--bg-secondary, #2d323e); border: 1px solid var(--border-color, #3d4354); border-radius: 16px; width: 90%; max-width: 420px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.confirm-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color, #3d4354); }
.confirm-modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; color: var(--text-primary, #e8eaf0); }
.confirm-modal-header h3 i { color: #f39c12; }
.confirm-modal-close { background: transparent; border: none; border-radius: 8px; width: 36px; height: 36px; color: var(--text-secondary, #8890a8); cursor: pointer; transition: all 0.2s; font-size: 1.1rem; }
.confirm-modal-close:hover { color: var(--text-primary, #e8eaf0); }
.confirm-modal-body { padding: 1.5rem; }
.confirm-modal-body p { margin: 0 0 1rem 0; color: var(--text-primary, #e8eaf0); line-height: 1.6; }
.confirm-modal-body .warning-box { background: rgba(243, 156, 18, 0.15); border: 1px solid rgba(243, 156, 18, 0.3); border-radius: 8px; padding: 1rem; display: flex; align-items: flex-start; gap: 0.75rem; }
.confirm-modal-body .warning-box i { color: #f39c12; font-size: 1.2rem; margin-top: 2px; }
.confirm-modal-body .warning-box span { font-size: 0.9rem; color: var(--text-secondary, #b8bdd0); }
.confirm-modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color, #3d4354); display: flex; justify-content: flex-end; gap: 0.75rem; }
.confirm-btn { border: none; border-radius: 8px; padding: 0.75rem 1.25rem; font-weight: 600; font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; transition: all 0.2s; }
.confirm-btn-cancel { background: var(--bg-tertiary, #3d4152); color: var(--text-primary, #e8eaf0); }
.confirm-btn-cancel:hover { background: var(--border-color, #4a4f65); }
.confirm-btn-continue { background: #f39c12; color: #fff; }
.confirm-btn-continue:hover { background: #e67e22; }

/* EMPTY */
.empty-state { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; color: var(--text-secondary); }
.empty-state i { font-size: 4rem; opacity: 0.3; margin-bottom: 1rem; color: var(--accent-color); }
.empty-state h2 { color: var(--text-primary); margin-bottom: 0.5rem; }

/* FAB Menu */
.fab-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.fab-menu { position: relative; }
.fab-actions { position: absolute; bottom: 62px; right: 2px; display: flex; flex-direction: column; gap: 12px; align-items: center; opacity: 0; visibility: hidden; transform: translateY(20px); transition: all 0.3s ease; }
.fab-menu.open .fab-actions { opacity: 1; visibility: visible; transform: translateY(0); }
.fab-action { width: 45px; height: 45px; border-radius: 50%; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1rem; box-shadow: 0 3px 10px rgba(0,0,0,0.25); transition: all 0.3s ease; position: relative; }
.fab-action:hover { transform: scale(1.1); }
.fab-action.calc-btn { background: #e67e22; color: white; }
.fab-action.calc-btn:hover { background: #d35400; }
.fab-action.share-btn { background: #27ae60; color: white; }
.fab-action.share-btn:hover { background: #229954; }
.fab-action.settings-btn { background: var(--bg-tertiary); color: var(--text-primary); }
.fab-action.settings-btn:hover { background: var(--accent-color); color: white; }
.fab-action-tooltip { position: absolute; right: 55px; background: var(--bg-secondary); color: var(--text-primary); padding: 6px 12px; border-radius: 6px; font-size: 0.75rem; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.2s; box-shadow: 0 2px 8px rgba(0,0,0,0.15); border: 1px solid var(--border-color); }
.fab-action:hover .fab-action-tooltip { opacity: 1; }
.fab-main { width: 50px; height: 50px; border-radius: 50%; border: none; background: var(--wiki-accent, #5E72AF); color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; box-shadow: 0 4px 15px rgba(94,114,175,0.4); transition: all 0.3s ease; }
.fab-main:hover { background: #4a5a8f; }
.fab-main i { transition: transform 0.3s ease; }
.fab-main.active i { transform: rotate(45deg); }
.scroll-top-btn { opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.scroll-top-btn.visible { opacity: 1; visibility: visible; }
.scroll-top-btn.visible.fab-open { transform: translateY(-165px); }
.scroll-top-btn:hover { background: var(--accent-color) !important; color: white !important; }

/* Settings Modal simple */
.arbre-settings-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 10001; opacity: 0; visibility: hidden; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; }
.arbre-settings-modal-overlay.active { opacity: 1; visibility: visible; }
.arbre-settings-modal { background: var(--bg-secondary, #2d323e); border: 1px solid var(--border-color, #3d4354); border-radius: 16px; width: 90%; max-width: 450px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.arbre-settings-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color, #3d4354); }
.arbre-settings-modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; color: var(--text-primary, #e8eaf0); }
.arbre-settings-modal-header h3 i { color: var(--accent-color, #5E72AF); }
.arbre-settings-modal-close { background: transparent; border: none; border-radius: 8px; width: 36px; height: 36px; font-size: 1.5rem; color: var(--text-muted, #8890a8); cursor: pointer; transition: all 0.2s; }
.arbre-settings-modal-close:hover { color: var(--text-primary, #e8eaf0); }
.arbre-settings-modal-body { padding: 1.5rem; }
.arbre-settings-group { margin-bottom: 1.5rem; }
.arbre-settings-group:last-child { margin-bottom: 0; }
.arbre-settings-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary, #b8bdd0); margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }
.arbre-settings-option { display: flex; justify-content: space-between; align-items: center; padding: 1rem; background: var(--bg-tertiary, #3d4152); border-radius: 10px; margin-bottom: 0.5rem; }
.arbre-settings-option-text { font-size: 0.95rem; color: var(--text-primary, #e8eaf0); }
.arbre-settings-hint { font-size: 0.8rem; color: var(--text-muted, #8890a8); margin: 0.5rem 0 0 0; line-height: 1.4; }
.arbre-settings-modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color, #3d4354); display: flex; justify-content: flex-end; }
.arbre-settings-save-btn { background: var(--accent-color, #5E72AF); color: white; border: none; border-radius: 8px; padding: 0.75rem 1.5rem; font-weight: 600; font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; transition: all 0.2s; }
.arbre-settings-save-btn:hover { background: #4a5a8f; transform: translateY(-2px); }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--border-color, #3d4354); border-radius: 24px; transition: 0.3s; }
.toggle-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: var(--accent-color, #5E72AF); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

@media (max-width: 768px) {
    .tree-sidebar { width: 260px; min-width: 260px; }
    .sidebar-toggle { left: 260px; }
    .tool-btn { width: 36px; height: 36px; }
    .fab-container { bottom: 15px; right: 15px; }
}
