/* =============================================================================
   PLANNING V2 — Panel (sidebar gauche)
   ============================================================================= */

.p2-panel {
    width: var(--p2-panel-width);
    min-width: var(--p2-panel-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-panel);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

/* ── Header panel (aligné sur l'en-tête de la grille) ─────────────────────── */
.p2-panel-header {
    height: var(--p2-header-height);
    padding: 0 8px;
    border-bottom: 1px solid var(--border-panel);
    background: var(--bg-card);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}
.p2-panel-header .p2-panel-toggle {
    width: 100%;
}

/* ── Toggle Shifts / Fixes ──────────────────────────────────────────────────── */
.p2-panel-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    padding: 2px;
    gap: 2px;
}

.p2-toggle-btn {
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-md) - 2px);
    padding: 5px 8px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--trans-fast);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.p2-toggle-btn.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: var(--shadow-xs);
}
.p2-toggle-btn i { font-size: 13px; }

/* ── Corps scrollable ───────────────────────────────────────────────────────── */
.p2-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.p2-panel-body::-webkit-scrollbar { width: 4px; }
.p2-panel-body::-webkit-scrollbar-track { background: transparent; }
.p2-panel-body::-webkit-scrollbar-thumb { background: var(--border-panel); border-radius: 4px; }


/* ── Footer panel (bouton "Nouveau") ────────────────────────────────────────── */
.p2-panel-footer {
    padding: 8px;
    border-top: 1px solid var(--border-panel);
    flex-shrink: 0;
}

.p2-new-shift-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-panel);
    background: transparent;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--trans-fast);
}
.p2-new-shift-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb, 59,130,246), .05);
}

/* ── Shift Card ─────────────────────────────────────────────────────────────── */
.p2-shift-card {
    border-radius: var(--radius-md);
    padding: 8px 10px;
    cursor: grab;
    transition: all var(--trans-fast);
    border: 1px solid transparent;
    position: relative;
    user-select: none;
}
.p2-shift-card:hover { border-color: rgba(255,255,255,.1); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.p2-shift-card:active { cursor: grabbing; transform: scale(.97); }
.p2-shift-card.is-paint-selected {
    transform: scale(1.02);
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-sm);
    z-index: 2;
}

.p2-shift-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 4px;
}

.p2-shift-card-name {
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.p2-shift-card-hours {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.85;
}

.p2-shift-card-segments {
    display: flex;
    gap: 2px;
    margin-top: 4px;
    height: 3px;
    border-radius: 2px;
    overflow: hidden;
}
.p2-shift-card-seg {
    border-radius: 2px;
}

.p2-shift-card-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
    gap: 2px;
}
.p2-shift-card:hover .p2-shift-card-actions { display: flex; }

.p2-shift-card-action {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(0,0,0,.25);
    border: none;
    color: rgba(255,255,255,.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: background var(--trans-fast);
}
.p2-shift-card-action:hover { background: rgba(0,0,0,.5); color: #fff; }
.p2-shift-card-action.danger:hover { background: rgba(220,38,38,.6); }

/* ── Fixed Card ─────────────────────────────────────────────────────────────── */
.p2-fixed-card {
    border-radius: var(--radius-md);
    padding: 8px 10px;
    cursor: grab;
    transition: all var(--trans-fast);
    border: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.p2-fixed-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: rgba(255,255,255,.15); }
.p2-fixed-card:active { cursor: grabbing; }

.p2-fixed-card-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.p2-fixed-card-name {
    font-size: var(--text-xs);
    font-weight: 700;
    color: #fff;
    flex: 1;
}

/* ── Four Week Mode (Horizontal layout) ─────────────────────────────────────── */
.p2-layout.is-four-week {
    flex-direction: column;
}

.p2-layout.is-four-week .p2-panel {
    width: 100%;
    min-width: unset;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    border-right: none;
    border-bottom: 1px solid var(--border-panel);
    flex-direction: row;
    box-sizing: border-box;
}

.p2-layout.is-four-week .p2-panel-header {
    display: flex !important;
    align-items: center;
    border-bottom: none;
    border-right: 1px solid var(--border-panel);
    height: 100%;
    width: calc(var(--p2-member-col) + 1px);
    min-width: calc(var(--p2-member-col) + 1px);
    max-width: calc(var(--p2-member-col) + 1px);
    padding: 0 8px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.p2-layout.is-four-week .p2-panel-body {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 8px;
    gap: 8px;
    align-items: center;
    height: 100%;
    flex: 1;
    box-sizing: border-box;
}

.p2-layout.is-four-week .p2-panel-body::-webkit-scrollbar { height: 4px; }

.p2-layout.is-four-week .p2-shift-card,
.p2-layout.is-four-week .p2-fixed-card {
    min-width: 150px;
    margin-bottom: 0;
    flex-shrink: 0;
    padding: 4px 8px;
    height: 32px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.p2-layout.is-four-week .p2-shift-card-header {
    margin-bottom: 0;
    width: 100%;
    display: flex;
    align-items: center;
}

.p2-layout.is-four-week .p2-shift-card-segments {
    display: none; /* Hide mini segments in compact list */
}

.p2-layout.is-four-week .p2-panel-footer {
    display: flex !important;
    border-top: none;
    border-left: none;
    align-items: center;
    height: 100%;
    padding: 0 8px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.p2-panel-switch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 32px;
    width: 100%;
    padding: 0 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-panel);
    background: var(--bg-body);
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--trans-fast);
    flex-shrink: 0;
    box-sizing: border-box;
}
.p2-panel-switch-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}
.p2-panel-switch-btn i {
    font-size: 14px;
}

.p2-layout.is-four-week .p2-new-shift-btn {
    height: 32px;
    padding: 0 12px;
    width: auto;
    white-space: nowrap;
}

