/* Styles de base pour CELESTIAHUB */

/* Import Bootstrap via CDN - fallback */
@import url('https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css');

/* Variables CSS */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* Reset et base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

/* Classes utilitaires */
.btn {
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

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

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

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Form controls */
.form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 16px;
    transition: all 0.3s ease;
    width: 100%;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    outline: none;
}

/* Input groups */
.input-group {
    display: flex;
    width: 100%;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding: 12px 20px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid transparent;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #b8daff;
}

/* Grid system simple */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col, .col-md-6, .col-md-4, .col-md-3 {
    padding: 0 15px;
    flex: 1;
}

.col-md-6 {
    width: 50%;
}

.col-md-4 {
    width: 33.333%;
}

.col-md-3 {
    width: 25%;
}

/* Spacing utilities */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 1rem; }
.m-4 { margin: 1.5rem; }
.m-5 { margin: 3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-end { text-align: right; }

.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-info { color: var(--info-color); }
.text-muted { color: #6c757d; }
.text-white { color: white; }

/* Background utilities */
.bg-primary { background-color: var(--primary-color); }
.bg-success { background-color: var(--success-color); }
.bg-danger { background-color: var(--danger-color); }
.bg-warning { background-color: var(--warning-color); }
.bg-info { background-color: var(--info-color); }
.bg-light { background-color: var(--light-color); }
.bg-dark { background-color: var(--dark-color); }
.bg-white { background-color: white; }

/* Border utilities */
.border { border: 1px solid #dee2e6; }
.border-primary { border-color: var(--primary-color); }
.border-success { border-color: var(--success-color); }
.border-danger { border-color: var(--danger-color); }
.border-warning { border-color: var(--warning-color); }

.rounded { border-radius: 0.375rem; }
.rounded-top { border-top-left-radius: 0.375rem; border-top-right-radius: 0.375rem; }

/* Display utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }

/* Flex utilities */
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* Typography */
.h1, .h2, .h3, .h4, .h5, .h6,
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.2;
}

.h1, h1 { font-size: 2.5rem; }
.h2, h2 { font-size: 2rem; }
.h3, h3 { font-size: 1.75rem; }
.h4, h4 { font-size: 1.5rem; }
.h5, h5 { font-size: 1.25rem; }
.h6, h6 { font-size: 1rem; }

.small { font-size: 0.875rem; }

/* Progress bars */
.progress {
    height: 1rem;
    background-color: #e9ecef;
    border-radius: 0.375rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.6s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .col-md-6, .col-md-4, .col-md-3 {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .row {
        margin: 0;
    }
    
    .col, .col-md-6, .col-md-4, .col-md-3 {
        padding: 0;
    }
}

/* Simulation styles have been moved to simulation.css */

/* Styles pour l'en-tête principal */
.display-4 {
    color: #2c3e50 !important;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.lead {
    color: #495057 !important;
    font-weight: 500;
}

/* Correction des titres dans les cartes */
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6 {
    color: white !important;
    margin-bottom: 0;
}

/* Titres dans le corps des cartes */
.card-body h5,
.card-body h6 {
    color: #2c3e50 !important;
    font-weight: bold;
}

/* Titres des sections */
h1, h2, h3, h4, h5, h6 {
    color: #2c3e50 !important;
}

/* Styles pour les QCM cliquables */
.qcm-clickable {
    transition: all 0.3s ease;
    position: relative;
}

.qcm-clickable:hover {
    background-color: #f8f9fa !important;
    border-color: #007bff !important;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
    transform: translateY(-1px);
}

.qcm-clickable:active {
    transform: translateY(0px);
}

/* Modal pour les détails QCM */
.question-detail {
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.question-detail:hover {
    background: #e9ecef;
}

/* Badge de score QCM */
.qcm-summary .text-success {
    color: #28a745 !important;
}

.qcm-summary .text-warning {
    color: #ffc107 !important;
}

.qcm-summary .text-danger {
    color: #dc3545 !important;
}

/* Icônes Font Awesome dans la modal */
.fa-check-circle, .fa-times-circle {
    font-size: 1.2em;
}

/* Styles pour les cartes de stats cliquables */
.clickable-stat {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.clickable-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    border-color: #007bff;
}

.clickable-stat .click-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
    color: #007bff;
}

.clickable-stat:hover .click-indicator {
    opacity: 1;
}

.clickable-stat .click-indicator i {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}

.clickable-stat .click-indicator small {
    font-size: 9px;
    line-height: 1;
}

/* Modal d'évolution QCM */
.evolution-summary .border {
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.evolution-summary .border:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.chart-container {
    position: relative;
    height: 350px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-legend {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 8px;
    display: inline-block;
}

.period-selector {
    display: flex;
    gap: 8px;
    margin-right: auto;
}

.period-selector .btn {
    min-width: 70px;
}

/* Responsivité pour les modals sur mobile */
@media (max-width: 768px) {
    .modal-xl {
        max-width: 95%;
    }
    
    .evolution-summary .col-md-2,
    .evolution-summary .col-md-4 {
        margin-bottom: 15px;
    }
    
    .chart-container {
        height: 250px;
        padding: 10px;
    }
    
    .period-selector {
        flex-wrap: wrap;
    }
    
    .period-selector .btn {
        min-width: auto;
        font-size: 12px;
        padding: 4px 8px;
    }
}

/* === STYLES TELEGRAM === */
.telegram-connect-area {
    text-align: center;
    padding: 20px;
    border: 2px dashed #007bff;
    border-radius: 10px;
    background: rgba(0, 123, 255, 0.05);
    transition: all 0.3s ease;
}

.telegram-connect-area:hover {
    border-color: #0056b3;
    background: rgba(0, 123, 255, 0.1);
}

.telegram-status-card {
    background: linear-gradient(135deg, #28a745, #20c997);
    border-radius: 10px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.notification-preferences {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.notification-preferences h6 {
    color: #495057;
    margin-bottom: 15px;
}

.form-check {
    margin-bottom: 8px;
}

.form-check-label {
    font-size: 0.9rem;
    color: #6c757d;
}

.telegram-actions .btn {
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.telegram-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.features-list .feature-item {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: #6c757d;
}

.features-list .feature-item i {
    flex-shrink: 0;
}

/* Widget Telegram personnalisé */
#telegram-login-widget iframe {
    border-radius: 6px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

/* Styles pour l'historique des simulations avancées */
.simulation-clickable:hover {
    background-color: #f8f9fa !important;
    border-color: #007bff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.advanced-simulations-section {
    border-top: 2px solid #e9ecef;
    padding-top: 1rem;
}

.advanced-simulations-section h5 {
    color: #495057;
    font-weight: 600;
}

.simulation-item {
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
}

.simulation-item:hover {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0,123,255,0.15);
}

/* Styles pour la modal de détails de simulation */
.conversation-container {
    background: linear-gradient(to bottom, #f8f9fa, #ffffff);
    border-radius: 15px;
    padding: 1.5rem;
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.conversation-container::-webkit-scrollbar {
    width: 6px;
}

.conversation-container::-webkit-scrollbar-track {
    background: transparent;
}

.conversation-container::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.conversation-container::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

.message-bubble {
    word-wrap: break-word;
    max-width: 100%;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none !important;
}

.message-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.coach-advice-bubble {
    animation: slideInUp 0.4s ease-out;
    backdrop-filter: blur(10px);
}

.coach-advice-bubble:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(79, 172, 254, 0.35) !important;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation d'apparition des messages */
.message-item {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.final-report-section {
    border-top: 3px solid #28a745;
}

.report-content {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Amélioration de l'affichage du rapport final JSON */
.report-content pre {
    border-radius: 8px;
    border: 1px solid #495057;
    background: linear-gradient(135deg, #2c3e50, #34495e) !important;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #6c757d transparent;
}

.report-content pre::-webkit-scrollbar {
    height: 6px;
}

.report-content pre::-webkit-scrollbar-track {
    background: transparent;
}

.report-content pre::-webkit-scrollbar-thumb {
    background: #6c757d;
    border-radius: 3px;
}

.report-content pre::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

.report-content code {
    color: #f8f9fa !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Styles pour les messages avec évaluation */
.message-evaluation {
    backdrop-filter: blur(5px);
    border-radius: 8px;
    padding: 0.5rem !important;
    margin-top: 0.75rem !important;
}

/* Amélioration des stats cards dans l'historique */
.stats-summary .stat-card {
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
}

.stats-summary .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stats-summary .stat-card h4 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Responsive pour les badges de mode */
@media (max-width: 768px) {
    .simulation-item .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .simulation-item .text-end {
        text-align: left !important;
        margin-top: 0.5rem;
    }
    
    .stats-summary .row > div {
        margin-bottom: 0.5rem;
    }
}

/* Style pour les conversations */
.message-item {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Styles pour le modal QCM sans backdrop */
#editQuestionModal {
    z-index: 1060; /* Plus haut que le menu */
}

#editQuestionModal .modal-dialog {
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border: 3px solid #007bff;
    border-radius: 12px;
    margin: 30px auto;
    max-width: 90%;
    position: relative;
    z-index: 1061;
}

#editQuestionModal .modal-content {
    border-radius: 12px;
    overflow: hidden;
}

#editQuestionModal .modal-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-bottom: none;
    padding: 20px;
}

#editQuestionModal .modal-title {
    font-weight: bold;
    font-size: 1.2rem;
}

#editQuestionModal .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

#editQuestionModal .btn-close:hover {
    opacity: 1;
}

/* Animation pour attirer l'attention */
@keyframes modalPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

#editQuestionModal.show .modal-dialog {
    animation: modalPulse 0.5s ease-in-out;
}

/* Assurer que le modal est toujours visible */
#editQuestionModal.show {
    display: block !important;
}

 