/**
 * Parcours Interactifs - Styles
 *
 * @package FormationSecurite
 */

/* ==========================================================================
   Variables
   ========================================================================== */
:root {
    --parcours-primary: var(--primary-color, #1976d2);
    --parcours-success: #2e7d32;
    --parcours-warning: #f57c00;
    --parcours-danger: #c62828;
    --parcours-bg: #f8fafc;
    --parcours-border: #e2e8f0;
    --parcours-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --parcours-radius: 12px;
}

/* ==========================================================================
   Page Liste Parcours
   ========================================================================== */
.parcours-list-page {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.parcours-list-page .page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.parcours-list-page .page-header h1 {
    font-size: 2rem;
    color: var(--parcours-primary);
    margin-bottom: 0.5rem;
}

.parcours-list-page .page-header h1 i {
    margin-right: 0.5rem;
}

.parcours-list-page .page-description {
    color: #64748b;
    font-size: 1.1rem;
}

/* Actions */
.parcours-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Sections */
.parcours-section {
    margin-bottom: 3rem;
}

.parcours-section h2 {
    font-size: 1.25rem;
    color: #334155;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.parcours-section h2 i {
    color: var(--parcours-primary);
}

/* Grille de cartes */
.parcours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Carte parcours */
.parcours-card {
    background: white;
    border-radius: var(--parcours-radius);
    box-shadow: var(--parcours-shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.parcours-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.parcours-card.completed {
    border: 2px solid var(--parcours-success);
}

.parcours-card.parcours-draft {
    border: 2px dashed var(--parcours-warning);
}

.parcours-card-image {
    position: relative;
    height: 160px;
    background: var(--parcours-bg);
    overflow: hidden;
}

.parcours-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.parcours-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
}

.parcours-placeholder i {
    font-size: 3rem;
}

.parcours-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.parcours-badge.draft {
    background: var(--parcours-warning);
    color: white;
}

.parcours-badge.completed {
    background: var(--parcours-success);
    color: white;
}

.parcours-badge.in-progress {
    background: var(--parcours-primary);
    color: white;
}

.parcours-card-content {
    padding: 1.25rem;
}

.parcours-card-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.parcours-metier {
    display: inline-block;
    background: var(--parcours-bg);
    color: #64748b;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
}

.parcours-meta {
    display: flex;
    gap: 1rem;
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.parcours-meta i {
    margin-right: 0.25rem;
}

.parcours-actions-row {
    display: flex;
    gap: 0.5rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--parcours-bg);
    border-radius: var(--parcours-radius);
    color: #64748b;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ==========================================================================
   Page Éditeur
   ========================================================================== */
.parcours-editor-page {
    padding: 1.5rem 0;
    min-height: calc(100vh - 150px);
    background: var(--parcours-bg);
}

.editor-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--parcours-radius);
    box-shadow: var(--parcours-shadow);
}

.btn-back {
    color: #64748b;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.btn-back:hover {
    color: var(--parcours-primary);
}

.editor-header h1 {
    flex: 1;
    font-size: 1.25rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editor-header h1 i {
    color: var(--parcours-primary);
}

.editor-actions {
    display: flex;
    gap: 0.75rem;
}

/* Contenu éditeur */
.editor-content {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 1.5rem;
}

.editor-panel {
    background: white;
    border-radius: var(--parcours-radius);
    box-shadow: var(--parcours-shadow);
    padding: 1.25rem;
}

.editor-panel h2 {
    font-size: 1rem;
    color: #334155;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--parcours-border);
}

.editor-panel h2 i {
    color: var(--parcours-primary);
}

/* Config panel */
.config-panel .form-group {
    margin-bottom: 1.25rem;
}

.config-panel label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.5rem;
}

.config-panel .form-control {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--parcours-border);
    border-radius: 8px;
    font-size: 0.9rem;
}

.config-panel .form-control:focus {
    outline: none;
    border-color: var(--parcours-primary);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.thumbnail-upload {
    border: 2px dashed var(--parcours-border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.thumbnail-placeholder {
    color: #94a3b8;
}

.thumbnail-placeholder i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.thumbnail-preview {
    margin-bottom: 0.75rem;
}

.thumbnail-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 6px;
    object-fit: cover;
}

.thumbnail-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
}

/* Steps panel */
.steps-panel {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

.steps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--parcours-border);
}

.steps-header h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border: none;
}

.steps-count {
    font-weight: normal;
    color: #64748b;
    font-size: 0.85rem;
}

/* Step item */
.step-item {
    background: var(--parcours-bg);
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--parcours-border);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
}

.step-number {
    width: 28px;
    height: 28px;
    background: var(--parcours-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.step-title {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1e293b;
}

.step-title:focus {
    outline: none;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: #e2e8f0;
    color: #334155;
}

.btn-delete-step:hover {
    background: #fee2e2;
    color: var(--parcours-danger);
}

.step-content {
    padding: 1rem;
    border-top: 1px solid var(--parcours-border);
}

.step-content.collapsed {
    display: none;
}

.step-image-section,
.step-question-section,
.step-choices-section {
    margin-bottom: 1.25rem;
}

.step-content label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.5rem;
}

.step-image-upload {
    position: relative;
    border: 2px dashed var(--parcours-border);
    border-radius: 8px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

.step-image-upload:hover {
    border-color: var(--parcours-primary);
}

.step-image-upload img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.upload-placeholder {
    text-align: center;
    color: #94a3b8;
}

.upload-placeholder i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.btn-remove-image {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    background: var(--parcours-danger);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.step-question {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--parcours-border);
    border-radius: 8px;
    font-size: 0.9rem;
    resize: vertical;
}

.step-question:focus {
    outline: none;
    border-color: var(--parcours-primary);
}

/* Choices */
.choices-list {
    margin-bottom: 0.75rem;
}

.choice-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.choice-text {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--parcours-border);
    border-radius: 6px;
    font-size: 0.85rem;
}

.choice-next {
    width: 140px;
    padding: 0.5rem;
    border: 1px solid var(--parcours-border);
    border-radius: 6px;
    font-size: 0.8rem;
}

.btn-remove-choice {
    width: 32px;
    height: 32px;
    border: none;
    background: #fee2e2;
    color: var(--parcours-danger);
    border-radius: 6px;
    cursor: pointer;
}

.btn-remove-choice:hover {
    background: var(--parcours-danger);
    color: white;
}

/* Preview panel */
.preview-panel {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

.decision-tree {
    padding: 1rem;
    background: var(--parcours-bg);
    border-radius: 8px;
    min-height: 200px;
}

.tree-placeholder {
    text-align: center;
    color: #94a3b8;
    font-style: italic;
}

/* Empty steps */
.empty-steps {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

.empty-steps i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.5;
}

/* ==========================================================================
   Page Player
   ========================================================================== */
.parcours-player-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 1rem 0 4rem;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.player-header .btn-back {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.player-header .btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.parcours-info {
    flex: 1;
    text-align: center;
}

.parcours-info h1 {
    color: white;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    max-width: 300px;
    margin: 0 auto 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--parcours-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.btn-restart {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.btn-restart:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Player content */
.player-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
    padding: 0 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.step-image-container {
    background: #0f172a;
    border-radius: var(--parcours-radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.step-image-placeholder {
    color: #334155;
    font-size: 4rem;
}

/* Interaction zone */
.step-interaction {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.step-question-box {
    background: white;
    border-radius: var(--parcours-radius);
    padding: 1.5rem;
}

.step-question-box .step-title {
    font-size: 1.1rem;
    color: var(--parcours-primary);
    margin-bottom: 0.75rem;
}

.step-question-box .step-question {
    color: #334155;
    line-height: 1.6;
    border: none;
    padding: 0;
    font-size: 1rem;
}

/* Choices */
.step-choices {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem 1.25rem;
    background: white;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.choice-btn:hover {
    border-color: var(--parcours-primary);
    transform: translateX(4px);
}

.choice-btn:active {
    transform: scale(0.98);
}

.choice-letter {
    width: 32px;
    height: 32px;
    background: var(--parcours-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.choice-btn .choice-text {
    flex: 1;
    color: #1e293b;
    font-size: 0.95rem;
    border: none;
    padding: 0;
}

.choice-btn i {
    color: #94a3b8;
    transition: transform 0.2s;
}

.choice-btn:hover i {
    color: var(--parcours-primary);
    transform: translateX(4px);
}

/* Completion screen */
.completion-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 2rem;
}

.completion-content {
    background: white;
    border-radius: var(--parcours-radius);
    padding: 2.5rem;
    text-align: center;
    max-width: 500px;
    width: 100%;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.completion-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.completion-icon i {
    font-size: 2.5rem;
    color: white;
}

.completion-content h2 {
    font-size: 1.5rem;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.completion-content > p {
    color: #64748b;
    margin-bottom: 1.5rem;
}

.completion-summary {
    background: var(--parcours-bg);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.completion-summary h3 {
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 0.75rem;
}

.choices-history {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
}

.choices-history li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--parcours-border);
    font-size: 0.85rem;
    color: #334155;
}

.choices-history li:last-child {
    border-bottom: none;
}

.completion-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
    .editor-content {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        display: none;
    }

    .player-content {
        grid-template-columns: 1fr;
    }

    .step-image-container {
        aspect-ratio: 16/10;
    }
}

@media (max-width: 768px) {
    .parcours-list-page {
        padding: 1rem 0;
    }

    .parcours-grid {
        grid-template-columns: 1fr;
    }

    .editor-header {
        flex-wrap: wrap;
    }

    .editor-header h1 {
        order: -1;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .player-header {
        flex-wrap: wrap;
    }

    .parcours-info {
        order: -1;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .player-content {
        padding: 0 1rem;
    }

    .step-question-box {
        padding: 1rem;
    }

    .completion-content {
        padding: 1.5rem;
    }

    .completion-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .parcours-list-page .page-header h1 {
        font-size: 1.5rem;
    }

    .parcours-card-image {
        height: 140px;
    }

    .choice-item {
        flex-wrap: wrap;
    }

    .choice-next {
        width: 100%;
    }
}
