/* =============================================
   PROJECT MAP v2 — Theme Bois Legendaire
   ============================================= */

/* Immersive mode like Galaxy View */
#view-project-map {
    position: relative;
    padding: 0;
    max-width: none;
    margin: 0;
    overflow: hidden;
    background: #2C1E12;
}

#view-project-map.active {
    position: fixed !important;
    top: 0 !important;
    left: var(--sb-width-open, 260px) !important;
    width: calc(100vw - var(--sb-width-open, 260px)) !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 5;
    display: block !important;
}

body.sidebar-collapsed #view-project-map.active {
    left: var(--sb-width-closed, 64px) !important;
    width: calc(100vw - var(--sb-width-closed, 64px)) !important;
}

/* Mobile */
@media (max-width: 900px) {
    #view-project-map.active {
        left: 0 !important;
        width: 100vw !important;
    }
}

.pm-canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* ── Toolbar ── */
.pm-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(30,20,12,0.96) 0%, rgba(30,20,12,0.7) 70%, transparent 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: none;
}

.pm-toolbar > * { pointer-events: auto; }

.pm-toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pm-toolbar-title {
    font-size: 18px;
    font-weight: 700;
    color: #F2E8D8;
    letter-spacing: -0.3px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.pm-toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Filter buttons */
.pm-filter-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.pm-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(212,164,76,0.15);
    background: rgba(74,53,37,0.5);
    color: rgba(242,232,216,0.6);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pm-filter-btn:hover {
    background: rgba(74,53,37,0.8);
    color: #F2E8D8;
    border-color: rgba(212,164,76,0.3);
}

.pm-filter-btn.active {
    background: rgba(212,164,76,0.2);
    color: #F2E8D8;
    border-color: rgba(212,164,76,0.4);
    box-shadow: 0 0 12px rgba(212,164,76,0.15);
}

.pm-filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Tool buttons */
.pm-tool-btn {
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid rgba(212,164,76,0.2);
    background: rgba(74,53,37,0.6);
    color: rgba(242,232,216,0.75);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.pm-tool-btn:hover {
    background: rgba(212,164,76,0.2);
    color: #F2E8D8;
    border-color: rgba(212,164,76,0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ── Card Editor Modal ── */
.pm-editor-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pmFadeIn 0.2s ease;
}

.pm-editor {
    width: 440px;
    max-width: 90vw;
    background: linear-gradient(135deg, rgba(58,42,26,0.98), rgba(44,30,18,0.98));
    border: 1px solid rgba(212,164,76,0.2);
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(212,164,76,0.05), inset 0 1px 0 rgba(212,164,76,0.1);
    animation: pmSlideUp 0.3s ease;
    overflow: hidden;
}

.pm-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(212,164,76,0.1);
}

.pm-editor-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #F2E8D8;
}

.pm-editor-close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: rgba(212,164,76,0.1);
    color: rgba(242,232,216,0.5);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.pm-editor-close:hover {
    background: rgba(192,96,64,0.25);
    color: #C06040;
}

.pm-editor-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pm-editor-body label {
    font-size: 12px;
    font-weight: 500;
    color: rgba(242,232,216,0.45);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.pm-editor-body input[type="text"],
.pm-editor-body textarea,
.pm-editor-body select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(212,164,76,0.15);
    background: rgba(36,26,14,0.8);
    color: #F2E8D8;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.pm-editor-body input[type="text"]:focus,
.pm-editor-body textarea:focus,
.pm-editor-body select:focus {
    border-color: rgba(212,164,76,0.5);
    box-shadow: 0 0 0 3px rgba(212,164,76,0.1);
}

.pm-editor-body textarea {
    resize: vertical;
    min-height: 60px;
}

.pm-editor-body select {
    cursor: pointer;
}

.pm-editor-body select option {
    background: #3A2A1A;
    color: #F2E8D8;
}

.pm-editor-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.pm-editor-row > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pm-editor-row > label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(242,232,216,0.6);
    cursor: pointer;
    margin-top: 4px;
}

.pm-editor-body input[type="range"] {
    width: 100%;
    accent-color: #D4A44C;
    cursor: pointer;
}

.pm-editor-body input[type="color"] {
    width: 100%;
    height: 36px;
    padding: 2px;
    border-radius: 10px;
    border: 1px solid rgba(212,164,76,0.15);
    background: rgba(36,26,14,0.8);
    cursor: pointer;
}

.pm-editor-body input[type="checkbox"] {
    accent-color: #D4A44C;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#pm-ed-progress-val {
    font-size: 12px;
    color: rgba(242,232,216,0.5);
    text-align: right;
}

.pm-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid rgba(212,164,76,0.1);
}

.pm-btn {
    padding: 8px 20px;
    border-radius: 10px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pm-btn-primary {
    background: linear-gradient(135deg, #D4A44C, #E0B860);
    color: #1E140C;
    box-shadow: 0 4px 12px rgba(212,164,76,0.3);
}

.pm-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(212,164,76,0.45);
}

.pm-btn-danger {
    background: rgba(192,96,64,0.15);
    color: #C06040;
}

.pm-btn-danger:hover {
    background: rgba(192,96,64,0.25);
}

/* ── Context Menu ── */
.pm-context-menu {
    position: fixed;
    z-index: 10000;
    min-width: 200px;
    padding: 6px;
    background: rgba(44,30,18,0.97);
    border: 1px solid rgba(212,164,76,0.2);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(212,164,76,0.08);
    backdrop-filter: blur(20px);
    animation: pmFadeIn 0.15s ease;
}

.pm-ctx-item {
    padding: 8px 14px;
    border-radius: 8px;
    color: rgba(242,232,216,0.8);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
}

.pm-ctx-item:hover {
    background: rgba(212,164,76,0.15);
    color: #F2E8D8;
}

.pm-ctx-danger:hover {
    background: rgba(192,96,64,0.2);
    color: #C06040;
}

.pm-ctx-sep {
    height: 1px;
    margin: 4px 8px;
    background: rgba(212,164,76,0.1);
}

/* ── Animations ── */
@keyframes pmFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pmSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Minimap hint ── */
.pm-minimap-hint {
    position: absolute;
    bottom: 16px;
    left: 16px;
    padding: 6px 12px;
    background: rgba(30,20,12,0.7);
    border-radius: 8px;
    color: rgba(154,125,94,0.5);
    font-size: 11px;
    pointer-events: none;
}

/* ── Theme Picker ── */
.pm-theme-picker {
    display: flex;
    gap: 5px;
    align-items: center;
    margin-right: 8px;
}

.pm-theme-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.15);
    transition: all 0.2s;
    position: relative;
}

.pm-theme-dot:hover {
    transform: scale(1.15);
    border-color: rgba(255,255,255,0.4);
    box-shadow: 0 0 10px rgba(255,255,255,0.15);
}

.pm-theme-dot.active {
    border-color: rgba(255,255,255,0.7);
    box-shadow: 0 0 12px rgba(255,255,255,0.25);
    transform: scale(1.1);
}

.pm-theme-dot.active::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.6);
}

/* ── Project Dropdown ── */
.pm-project-wrap {
    position: relative;
}
.pm-project-btn {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pm-project-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: rgba(20,13,6,0.97);
    border: 1px solid rgba(212,164,76,0.25);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    z-index: 300;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.pm-project-menu.open { display: block; }
.pm-project-menu-sep {
    height: 1px;
    background: rgba(212,164,76,0.15);
    margin: 4px 2px;
}
.pm-project-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    color: rgba(242,232,216,0.75);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
    transition: all 0.15s;
    white-space: nowrap;
}
.pm-project-menu-item:hover {
    background: rgba(212,164,76,0.15);
    color: #F2E8D8;
}
.pm-project-menu-item.active {
    background: rgba(212,164,76,0.2);
    color: #F2E8D8;
}
.pm-project-menu-new { color: rgba(212,164,76,0.9); }
.pm-project-menu-new:hover {
    background: rgba(212,164,76,0.18);
    color: #D4A44C;
}

/* ── Active project label ── */
.pm-active-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #F2E8D8;
    padding: 5px 12px;
    border-radius: 8px;
    background: rgba(212,164,76,0.12);
    border: 1px solid rgba(212,164,76,0.2);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}
.pm-active-label:empty { display: none; }
.pm-active-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

/* ── Décalage toolbar-right pour éviter le Spotify player ── */
.pm-toolbar-right {
    margin-right: 70px;
}

/* Snap / Aimant button */
.pm-snap-btn { font-size: 16px; padding: 5px 10px; }
.pm-snap-btn.pm-snap-active { background: rgba(212,164,76,0.25); border-color: rgba(212,164,76,0.7); color: #D4A44C; box-shadow: 0 0 10px rgba(212,164,76,0.35); }
