/**
 * Styles pour Narrative Sidebar V2
 */

/* Conteneur des items sélectionnés */
.selected-items-v2 {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    min-height: 40px;
}

.selected-items-v2:empty::before {
    content: 'Aucun élément sélectionné';
    color: var(--text-muted);
    font-style: italic;
}

/* Item sélectionné individuel */
.selected-item-v2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    background: var(--bg-primary);
    border-radius: 3px;
    border-left: 3px solid var(--primary);
    font-size: 0.875rem;
}

.selected-item-v2 span {
    flex: 1;
}

/* Boutons d'actions */
.item-actions-v2 {
    display: flex;
    gap: 0.5rem;
}

.btn-modify-v2 {
    flex: 1;
}

.btn-new-v2 {
    white-space: nowrap;
}

/* Dropdown de localisation */
.location-select-v2 {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.location-select-v2:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Popup de sélection (style segments.php) */
.inline-popup {
    position: fixed;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    max-width: 400px;
    z-index: 10000;
}

.inline-popup-header {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9375rem;
}

.inline-popup-content {
    padding: 0.5rem;
    max-height: 350px;
    overflow-y: auto;
}

.inline-popup-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
    user-select: none;
}

.inline-popup-item:hover {
    background: var(--bg-hover);
}

.inline-popup-item input[type="checkbox"] {
    cursor: pointer;
}

.inline-popup-item .color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.inline-popup-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Champ readonly pour temps de début */
.field-readonly input {
    background: var(--bg-secondary) !important;
    cursor: not-allowed !important;
    color: var(--text-muted);
    font-weight: 500;
}

/* Groupe de conditions (ET/OU) */
.condition-group {
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    border-left: 3px solid var(--primary);
}

.condition-group strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-size: 0.875rem;
}

.condition-fact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem;
    background: var(--bg-primary);
    border-radius: 3px;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.condition-fact-item span {
    flex: 1;
}

/* Boutons de gestion */
.btn-xs {
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
    line-height: 1.2;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Formulaire création inline */
.create-form-inline {
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    border: 1px dashed var(--border-color);
}

.create-form-inline input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.create-form-inline .form-actions {
    display: flex;
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .inline-popup {
        left: 10px !important;
        right: 10px;
        max-width: none;
    }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .inline-popup {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }

    .location-select-v2 option {
        background: var(--bg-primary);
    }
}

/* Animation d'ouverture popup */
@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.inline-popup {
    animation: popupFadeIn 0.15s ease-out;
}

/* Toggle badge pour v1/v2 */
.sidebar-version-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary);
    color: white;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1;
}

.sidebar-version-badge.v2 {
    background: #10b981;
}
