@charset "UTF-8";

/* ===========================================
   CSS Variables - Thème Sombre Gaming
   =========================================== */
:root {
    --mastery-bg-primary: #0a0e14;
    --mastery-bg-secondary: #131921;
    --mastery-bg-tertiary: #1a2332;
    --mastery-bg-panel: rgba(19, 25, 33, 0.95);

    --mastery-border: #2a3a4a;
    --mastery-border-light: #3a4a5a;
    --mastery-border-glow: rgba(100, 200, 255, 0.3);

    --mastery-text-primary: #e8eef4;
    --mastery-text-secondary: #8899aa;
    --mastery-text-muted: #5a6a7a;

    --mastery-accent: #4da6ff;
    --mastery-accent-glow: rgba(77, 166, 255, 0.4);

    --mastery-success: #2ecc71;
    --mastery-success-glow: rgba(46, 204, 113, 0.4);

    --mastery-warning: #f1c40f;
    --mastery-warning-glow: rgba(241, 196, 15, 0.4);

    --mastery-danger: #e74c3c;
    --mastery-locked: #5a6a7a;

    --mastery-attack: #e74c3c;
    --mastery-defense: #3498db;
    --mastery-utility: #9b59b6;

    --mastery-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --mastery-shadow-glow: 0 0 30px var(--mastery-accent-glow);

    --mastery-radius: 8px;
    --mastery-radius-lg: 12px;

    --mastery-transition: all 0.2s ease;
    --mastery-transition-slow: all 0.3s ease;
}

/* ===========================================
   Base & Container
   =========================================== */
body.mastery-tree-active {
    overflow: hidden;
}

.mastery-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--mastery-bg-primary);
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--mastery-text-primary);
    overflow: hidden;
}

/* ===========================================
   Header
   =========================================== */
.mastery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: linear-gradient(180deg, var(--mastery-bg-secondary) 0%, var(--mastery-bg-primary) 100%);
    border-bottom: 1px solid var(--mastery-border);
    z-index: 100;
    gap: 20px;
}

.mastery-header-left,
.mastery-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.mastery-header-right {
    justify-content: flex-end;
}

.mastery-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.mastery-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--mastery-text-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Tree Selector */
.mastery-tree-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.mastery-select {
    background: var(--mastery-bg-tertiary);
    border: 1px solid var(--mastery-border);
    border-radius: var(--mastery-radius);
    color: var(--mastery-text-primary);
    padding: 6px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--mastery-transition);
}

.mastery-select:hover {
    border-color: var(--mastery-accent);
}

.mastery-select:focus {
    outline: none;
    border-color: var(--mastery-accent);
    box-shadow: 0 0 0 2px var(--mastery-accent-glow);
}

.mastery-select option {
    background: var(--mastery-bg-secondary);
    color: var(--mastery-text-primary);
}

.mastery-active-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--mastery-warning);
    color: #000;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--mastery-radius);
    text-transform: uppercase;
}

/* Tabs */
.mastery-tabs {
    display: flex;
    gap: 4px;
    background: var(--mastery-bg-tertiary);
    padding: 4px;
    border-radius: var(--mastery-radius-lg);
    border: 1px solid var(--mastery-border);
}

.mastery-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--mastery-radius);
    color: var(--mastery-text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--mastery-transition);
}

.mastery-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--mastery-text-primary);
}

.mastery-tab.active,
.mastery-tab[data-screen="attaque"].active {
    background: var(--mastery-attack);
    color: white;
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.4);
}

.mastery-tab[data-screen="defense"].active {
    background: var(--mastery-defense);
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.4);
}

.mastery-tab[data-screen="utilitaire"].active {
    background: var(--mastery-utility);
    box-shadow: 0 2px 10px rgba(155, 89, 182, 0.4);
}

.mastery-tab-icon {
    font-size: 1rem;
}

.mastery-tab-label {
    font-weight: 500;
}

/* Stats */
.mastery-stats {
    display: flex;
    gap: 8px;
}

.mastery-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--mastery-bg-tertiary);
    border: 1px solid var(--mastery-border);
    border-radius: var(--mastery-radius);
}

.mastery-stat-icon {
    font-size: 1rem;
}

.mastery-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--mastery-warning);
}

.mastery-stat-label {
    font-size: 0.75rem;
    color: var(--mastery-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Buttons */
.mastery-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--mastery-bg-tertiary);
    border: 1px solid var(--mastery-border);
    border-radius: var(--mastery-radius);
    color: var(--mastery-text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--mastery-transition);
}

.mastery-btn:hover {
    background: var(--mastery-bg-secondary);
    border-color: var(--mastery-border-light);
    transform: translateY(-1px);
}

.mastery-btn-close {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.3);
    color: var(--mastery-danger);
}

.mastery-btn-close:hover {
    background: var(--mastery-danger);
    border-color: var(--mastery-danger);
    color: white;
}

.mastery-btn-toggle {
    padding: 10px 12px;
}

.mastery-btn-toggle.active {
    background: var(--mastery-accent);
    border-color: var(--mastery-accent);
    color: white;
}

/* ===========================================
   Main Content
   =========================================== */
.mastery-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Canvas Wrapper */
.mastery-canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 50%, rgba(77, 166, 255, 0.03) 0%, transparent 60%),
        var(--mastery-bg-primary);
}

#masteryTreeCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    touch-action: none;
}

/* Fabric.js crée un wrapper div autour du canvas - s'assurer qu'il est bien positionné */
.mastery-canvas-wrapper .canvas-container {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 3;
    background: transparent !important;
}

.mastery-canvas-wrapper .canvas-container .lower-canvas,
.mastery-canvas-wrapper .canvas-container .upper-canvas {
    background: transparent !important;
}

.mastery-canvas-wrapper .canvas-container .upper-canvas {
    z-index: 4 !important;
}

.mastery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    pointer-events: none;
    opacity: 0.9;
}

/* Legend */
.mastery-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    background: var(--mastery-bg-panel);
    border: 1px solid var(--mastery-border);
    border-radius: var(--mastery-radius);
    z-index: 10;
    backdrop-filter: blur(10px);
}

.mastery-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--mastery-text-secondary);
}

.mastery-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.mastery-legend-acquired {
    background: var(--mastery-success);
    box-shadow: 0 0 8px var(--mastery-success-glow);
}

.mastery-legend-available {
    background: var(--mastery-warning);
    box-shadow: 0 0 8px var(--mastery-warning-glow);
}

.mastery-legend-locked {
    background: var(--mastery-locked);
}

/* Zoom Controls */
.mastery-zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 400px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

.mastery-zoom-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mastery-bg-panel);
    border: 1px solid var(--mastery-border);
    border-radius: var(--mastery-radius);
    color: var(--mastery-text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--mastery-transition);
    backdrop-filter: blur(10px);
}

.mastery-zoom-btn:hover {
    background: var(--mastery-bg-tertiary);
    border-color: var(--mastery-accent);
    color: var(--mastery-accent);
}

/* ===========================================
   Info Panel
   =========================================== */
.mastery-panel {
    width: 360px;
    background: var(--mastery-bg-panel);
    border-left: 1px solid var(--mastery-border);
    display: flex;
    flex-direction: column;
    z-index: 20;
    backdrop-filter: blur(10px);
}

.mastery-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Empty State */
.mastery-panel-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    height: 100%;
}

.mastery-panel-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.mastery-panel-empty h3 {
    color: var(--mastery-text-primary);
    margin: 0 0 8px 0;
    font-size: 1.1rem;
}

.mastery-panel-empty p {
    color: var(--mastery-text-muted);
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Panel Content Styles (generated by JS) */
.mastery-panel h3 {
    margin: 0 0 8px 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.mastery-panel h4 {
    color: var(--mastery-text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--mastery-border);
}

.mastery-panel p {
    color: var(--mastery-text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 8px 0;
}

.mastery-panel ul {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.mastery-panel ul li {
    padding: 6px 0 6px 20px;
    position: relative;
    color: var(--mastery-text-secondary);
    font-size: 0.9rem;
}

.mastery-panel ul li::before {
    content: "›";
    position: absolute;
    left: 4px;
    color: var(--mastery-accent);
    font-weight: bold;
}

.mastery-panel hr {
    border: none;
    border-top: 1px solid var(--mastery-border);
    margin: 16px 0;
}

/* Skill Detail Header */
.skill-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.skill-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

.skill-description {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: var(--mastery-radius);
    border-left: 3px solid var(--mastery-accent);
}

/* Skill Info Entry */
.skill-info-entry {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--mastery-border);
    border-radius: var(--mastery-radius);
    margin-bottom: 8px;
    transition: var(--mastery-transition);
}

.skill-info-entry:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--mastery-border-light);
}

.skill-info-entry img {
    width: 40px;
    height: 40px;
    border-radius: var(--mastery-radius);
    border: 2px solid var(--mastery-border);
    background: var(--mastery-bg-primary);
    flex-shrink: 0;
}

.skill-info-entry strong {
    color: var(--mastery-text-primary);
    font-size: 0.95rem;
    display: block;
    margin-bottom: 4px;
}

.skill-info-entry .small {
    color: var(--mastery-text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Buttons in Panel */
.mastery-panel .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: var(--mastery-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--mastery-transition);
}

.mastery-panel .btn-success {
    background: linear-gradient(135deg, var(--mastery-success) 0%, #27ae60 100%);
    color: white;
    box-shadow: 0 4px 15px var(--mastery-success-glow);
}

.mastery-panel .btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--mastery-success-glow);
}

.mastery-panel .btn-secondary {
    background: var(--mastery-bg-tertiary);
    color: var(--mastery-text-muted);
    border: 1px solid var(--mastery-border);
}

.mastery-panel .btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mastery-panel .btn-outline-secondary {
    background: transparent;
    color: var(--mastery-text-secondary);
    border: 1px solid var(--mastery-border);
}

.mastery-panel .btn-outline-secondary:hover {
    background: var(--mastery-bg-tertiary);
    border-color: var(--mastery-border-light);
}

/* Alert */
.mastery-panel .alert {
    padding: 12px 16px;
    border-radius: var(--mastery-radius);
    font-size: 0.9rem;
}

.mastery-panel .alert-success {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: var(--mastery-success);
}

/* Scrollbar */
.mastery-panel-content::-webkit-scrollbar {
    width: 6px;
}

.mastery-panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.mastery-panel-content::-webkit-scrollbar-thumb {
    background: var(--mastery-border);
    border-radius: 3px;
}

.mastery-panel-content::-webkit-scrollbar-thumb:hover {
    background: var(--mastery-border-light);
}

/* ===========================================
   Skill Spider Tooltip (on canvas hover)
   =========================================== */
#skill-spider-tooltip {
    position: fixed;
    background: var(--mastery-bg-panel);
    border: 1px solid var(--mastery-border);
    border-radius: var(--mastery-radius);
    padding: 12px 16px;
    max-width: 280px;
    z-index: 9999;
    pointer-events: none;
    backdrop-filter: blur(10px);
    box-shadow: var(--mastery-shadow);
}

#skill-spider-tooltip strong {
    display: block;
    color: var(--mastery-warning);
    font-size: 0.95rem;
    margin-bottom: 6px;
}

#skill-spider-tooltip p {
    color: var(--mastery-text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 4px 0;
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 1024px) {
    .mastery-panel {
        width: 320px;
    }

    .mastery-zoom-controls {
        right: 340px;
    }

    .mastery-tab-label {
        display: none;
    }

    .mastery-tab {
        padding: 10px 14px;
    }

    .mastery-btn span {
        display: none;
    }

    .mastery-btn {
        padding: 10px 12px;
    }
}

@media (max-width: 768px) {
    .mastery-header {
        padding: 10px 12px;
        flex-wrap: wrap;
    }

    .mastery-header-left,
    .mastery-header-right {
        min-width: auto;
    }

    .mastery-header-center {
        order: 3;
        width: 100%;
        margin-top: 8px;
    }

    .mastery-title {
        display: none;
    }

    .mastery-main {
        flex-direction: column;
    }

    .mastery-panel {
        width: 100%;
        height: 40vh;
        border-left: none;
        border-top: 1px solid var(--mastery-border);
    }

    .mastery-zoom-controls {
        right: 20px;
        bottom: 45vh;
    }

    .mastery-legend {
        bottom: 45vh;
        left: 10px;
        padding: 8px 12px;
        gap: 10px;
    }

    .mastery-legend-item span:last-child {
        display: none;
    }
}

/* ===========================================
   Animations
   =========================================== */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px var(--mastery-success-glow);
    }
    50% {
        box-shadow: 0 0 20px var(--mastery-success-glow), 0 0 30px var(--mastery-success-glow);
    }
}

.mastery-node-pulse {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mastery-panel-content > * {
    animation: fade-in 0.2s ease-out;
}
