/**
 * STYLES DU GÉNÉRATEUR D'ESCAPE GAME
 */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

:root {
    --primary: #6366f1;
    --primary-light: #a5b4fc;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
}

/* === LAYOUT PRINCIPAL === */
.app-container {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

/* === SIDEBAR === */
.sidebar {
    width: 280px;
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-700);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-logo-icon {
    font-size: 1.75rem;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 25px;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-500);
    padding: 0 20px;
    margin-bottom: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--gray-300);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--gray-800);
    color: white;
}

.nav-item.active {
    background: var(--gray-800);
    color: var(--primary-light);
    border-left-color: var(--primary);
}

.nav-item-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--gray-700);
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
}

/* === HEADER === */
.header {
    background: white;
    padding: 15px 30px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* === BOUTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--gray-600);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.1rem;
}

.btn-icon {
    padding: 10px;
    border-radius: 50%;
}

/* === CONTENT AREA === */
.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* === PANELS === */
.panel {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.panel-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title-icon {
    font-size: 1.25rem;
}

.panel-body {
    padding: 25px;
}

/* === FORMULAIRES === */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-label-required::after {
    content: ' *';
    color: var(--error);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* === SÉLECTEUR DE THÈME === */
.theme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.theme-card {
    border: 3px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    user-select: none;
}

.theme-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.theme-card:active {
    transform: translateY(-1px);
}

.theme-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(99, 102, 241, 0.1) 100%);
}

.theme-card-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.theme-card-name {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 5px;
}

.theme-card-desc {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* === BIBLIOTHÈQUE D'ÉNIGMES === */
.enigma-library {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    gap: 12px;
    width: 100%;
}

.enigma-type-card {
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.enigma-type-card:hover {
    border-color: var(--primary);
    border-style: solid;
    background: white;
    transform: scale(1.02);
    box-shadow: var(--shadow);
}

.enigma-type-card:active {
    transform: scale(0.98);
}

.enigma-type-card.dragging {
    opacity: 0.5;
}

.enigma-type-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.enigma-type-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
}

/* === LISTE DES ÉNIGMES === */
.enigma-list {
    min-height: 200px;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 15px;
    background: var(--gray-50);
}

.enigma-list.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.enigma-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--gray-400);
    text-align: center;
}

.enigma-list-empty-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.enigma-item {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: grab;
    transition: all 0.2s ease;
}

.enigma-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow);
}

.enigma-item.dragging {
    opacity: 0.5;
}

.enigma-item-drag {
    color: var(--gray-400);
    cursor: grab;
}

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

.enigma-item-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.enigma-item-content {
    flex: 1;
    min-width: 0;
}

.enigma-item-type {
    font-size: 0.8rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.enigma-item-question {
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.enigma-item-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

/* Modal large pour la bibliothèque */
.modal.modal-large {
    max-width: 900px;
}

.modal .library-modal {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: calc(90vh - 40px);
    padding: 25px;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--gray-600);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* === PREVIEW PANEL === */
.preview-container {
    background: var(--gray-800);
    border-radius: var(--radius);
    overflow: hidden;
}

.preview-header {
    background: var(--gray-900);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.preview-dot-red {
    background: #ef4444;
}

.preview-dot-yellow {
    background: #f59e0b;
}

.preview-dot-green {
    background: #10b981;
}

.preview-frame {
    width: 100%;
    height: 500px;
    border: none;
    background: white;
}

/* === ALERTS & TOASTS === */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--gray-800);
    color: white;
    padding: 15px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* === TABS === */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    color: var(--gray-500);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .sidebar {
        width: 70px;
    }

    .sidebar-header,
    .nav-section-title,
    .nav-item span:not(.nav-item-icon),
    .sidebar-footer {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 15px;
    }

    .nav-item-icon {
        font-size: 1.5rem;
    }

    .main-content {
        margin-left: 70px;
    }
}

@media (max-width: 768px) {

    /* Mobile menu toggle button */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 200;
        width: 48px;
        height: 48px;
        background: var(--primary);
        border: none;
        border-radius: 12px;
        cursor: pointer;
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
        transition: all 0.3s ease;
    }

    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }

    .hamburger-line {
        width: 22px;
        height: 3px;
        background: white;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Sidebar overlay */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 90;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Sidebar mobile */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
        display: flex;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .header {
        padding: 12px 15px;
        padding-top: 30px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        max-width: 100%;
    }

    .header-title {
        font-size: 1.1rem;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-actions {
        display: flex;
        gap: 8px;
        justify-content: center;
    }

    .header-actions .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
        flex: 1;
        max-width: 150px;
        justify-content: center;
    }

    .content-area {
        padding: 12px;
        overflow-x: hidden;
        max-width: 100%;
    }

    .theme-selector {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .enigma-library {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .enigma-type-card {
        padding: 10px 6px !important;
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .enigma-type-icon {
        font-size: 1.4rem !important;
        margin-bottom: 4px !important;
    }

    .enigma-type-name {
        font-size: 0.7rem !important;
        line-height: 1.2 !important;
        word-break: break-word !important;
    }

    .panel {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .panel-body {
        padding: 15px;
    }

    .panel-header {
        padding: 15px;
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .panel-title {
        font-size: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .enigma-item {
        flex-wrap: wrap;
        padding: 12px;
    }

    .enigma-item-content {
        width: calc(100% - 100px);
    }

    .enigma-item-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
    }

    .modal {
        width: 95%;
        max-height: 95vh;
    }

    /* Masquer le bouton sur desktop */
    .mobile-menu-toggle {
        display: flex;
    }
}

/* Masquer sur desktop */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }

    .sidebar-overlay {
        display: none;
    }
}

/* === UTILITIES === */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--gray-500);
}

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

.font-bold {
    font-weight: 600;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

/* === LIBRARY STYLES === */
.nav-item-highlight {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white !important;
    border-radius: var(--radius);
    margin: 0 10px;
    animation: pulse-glow 2s infinite;
}

.nav-item-highlight:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: scale(1.02);
}

.nav-item-highlight span {
    color: white !important;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.5);
    }

    50% {
        box-shadow: 0 0 15px rgba(99, 102, 241, 0.8);
    }
}

.library-modal {
    width: 100%;
}

.library-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 20px;
    flex-shrink: 0;
}

.library-header h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.library-header p {
    color: var(--gray-500);
}

.library-filters {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-group label {
    font-weight: 600;
    color: var(--gray-700);
}

.level-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.level-tab {
    padding: 10px 20px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
    font-family: inherit;
}

.level-tab:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.level-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.library-content {
    flex: 1;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.library-placeholder,
.library-loading,
.library-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--gray-500);
}

.placeholder-icon,
.error-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.library-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.library-themes {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.library-theme {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.theme-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: var(--gray-50);
    cursor: pointer;
    transition: background 0.2s ease;
}

.theme-header:hover {
    background: var(--gray-100);
}

.theme-icon {
    font-size: 1.5rem;
}

.theme-name {
    font-weight: 600;
    flex: 1;
}

.theme-count {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.theme-arrow {
    color: var(--gray-400);
    transition: transform 0.3s ease;
}

.library-theme.expanded .theme-arrow {
    transform: rotate(180deg);
}

.theme-games {
    display: none;
    padding: 10px;
    background: white;
}

.library-theme.expanded .theme-games {
    display: block;
}

.game-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.game-card:last-child {
    margin-bottom: 0;
}

.game-card:hover {
    border-color: var(--primary);
    background: var(--gray-50);
    transform: translateX(5px);
}

.game-number {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.game-info {
    flex: 1;
    min-width: 0;
}

.game-info h4 {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--gray-800);
    font-size: 1rem;
}

.game-subject {
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 2px;
    font-weight: 500;
}

.game-enigmas {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Scrollbar personnalisée pour la bibliothèque */
.library-content::-webkit-scrollbar {
    width: 8px;
}

.library-content::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

.library-content::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

.library-content::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* === ACCESSIBILITÉ === */

/* Skip link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 10px;
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    z-index: 1000;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 10px;
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

/* Focus visible pour accessibilité clavier */
*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* Nav items focusables */
.nav-item:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: -2px;
    background: var(--gray-700);
}

/* === VALIDATION EN TEMPS RÉEL === */

/* Status de validation dans le header */
.validation-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.validation-status.valid {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.validation-status.invalid {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    cursor: help;
}

/* Champs avec validation */
.form-input.valid,
.form-textarea.valid {
    border-color: var(--success);
}

.form-input.valid:focus,
.form-textarea.valid:focus {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-input.invalid,
.form-textarea.invalid {
    border-color: var(--error);
}

.form-input.invalid:focus,
.form-textarea.invalid:focus {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* === BOUTONS UNDO/REDO === */

.btn-sm {
    padding: 6px 10px;
    font-size: 0.9rem;
}

.header-actions .btn-sm {
    min-width: 36px;
}

/* === SUPPORT TACTILE === */

/* Indicateur de drag tactile */
.enigma-item.dragging {
    opacity: 0.7;
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

/* Zone de drop active */
.enigma-list.drag-over {
    background: rgba(99, 102, 241, 0.05);
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
}

/* Cartes énigmes draggables */
.enigma-type-card {
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.enigma-type-card:active {
    transform: scale(0.98);
}

/* === RESPONSIVE AJUSTEMENTS === */

@media (max-width: 768px) {
    .header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .validation-status {
        order: 10;
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }

    .header-actions .btn-sm {
        padding: 8px 12px;
    }

    /* Cacher les boutons undo/redo sur très petit écran */
    @media (max-width: 480px) {
        .header-actions .btn-sm[title*="Annuler"],
        .header-actions .btn-sm[title*="Refaire"] {
            display: none;
        }
    }
}

/* === ANIMATIONS SUPPLÉMENTAIRES === */

@keyframes validation-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.validation-status.invalid .validation-error {
    animation: validation-pulse 2s ease-in-out infinite;
}

/* Toast amélioré pour les actions Undo */
.toast {
    animation: toast-slide-in 0.3s ease-out;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === IMPRESSION === */

@media print {
    .skip-link,
    .sidebar,
    .mobile-menu-toggle,
    .header-actions,
    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .panel {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}