/* 
  Neurocap71 - Charte et styles spécifiques pour l'application "Mon Prof de Maths"
  Facilitation graphique, cartes aérées, badges pastel et stepper dynamique.
*/

:root {
    --maths-primary: #3B82F6;
    --maths-primary-hover: #2563EB;
    --maths-bg: #F8FAFC;
    --maths-card-bg: #FFFFFF;
    --maths-border: #E2E8F0;
    --maths-text: #1E293B;
    --maths-text-muted: #64748B;
    
    --level-easy-bg: #E6F4EA;
    --level-easy-text: #137333;
    --level-medium-bg: #FEF7E0;
    --level-medium-text: #B06000;
    --level-hard-bg: #FCE8E6;
    --level-hard-text: #C5221F;
    --level-adaptive-bg: #F3E8FF;
    --level-adaptive-text: #7E22CE;
}

.maths-app-wrapper {
    max-width: 900px;
    margin: 2rem auto;
    padding: 1.5rem;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--maths-text);
}

/* Header Stepper Bar */
.maths-stepper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #F1F5F9;
}

.maths-back-btn {
    background: #F1F5F9;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--maths-text);
    transition: all 0.2s ease;
}

.maths-back-btn:hover {
    background: #E2E8F0;
    transform: translateX(-2px);
}

.maths-step-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #CBD5E1;
    transition: all 0.3s ease;
}

.step-dot.active {
    background: var(--maths-primary);
    transform: scale(1.3);
}

.step-dot.completed {
    background: #10B981;
}

.step-indicator-text {
    font-weight: 700;
    color: var(--maths-primary);
    font-size: 0.95rem;
}

/* Card Container */
.maths-card {
    background: var(--maths-card-bg);
    border: 1px solid var(--maths-border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.maths-title-center {
    text-align: center;
    margin-bottom: 2rem;
}

.maths-title-center h1 {
    font-size: 2.2rem;
    color: #0F172A;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.maths-subtitle {
    color: var(--maths-text-muted);
    font-size: 1.1rem;
}

/* Mascot & Speech Bubbles */
.mascot-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}

.mascot-svg {
    width: 90px;
    height: 110px;
    flex-shrink: 0;
}

.speech-bubble {
    background: #EFF6FF;
    border: 2px solid #BFDBFE;
    border-radius: 16px;
    border-bottom-left-radius: 2px;
    padding: 0.9rem 1.4rem;
    font-weight: 700;
    color: #1E40AF;
    font-size: 1rem;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1);
    max-width: 320px;
}

/* Landing Page Signposts */
.landing-signpost-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.signpost-item {
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: 14px;
    padding: 1.2rem;
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    color: #0F172A;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.signpost-item:nth-child(1) { border-left: 6px solid #3B82F6; }
.signpost-item:nth-child(2) { border-left: 6px solid #10B981; }
.signpost-item:nth-child(3) { border-left: 6px solid #F59E0B; }
.signpost-item:nth-child(4) { border-left: 6px solid #EC4899; }

/* Grid Selectors (Classe, Path, Thèmes) */
.maths-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.maths-grid-1col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.maths-option-btn {
    background: var(--maths-card-bg);
    border: 2px solid #E2E8F0;
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--maths-text);
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.maths-option-btn:hover {
    border-color: var(--maths-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(59, 130, 246, 0.1);
    background: #F8FAFC;
}

.maths-option-btn .btn-arrow {
    font-size: 1.4rem;
    color: var(--maths-primary);
    transition: transform 0.2s ease;
}

.maths-option-btn:hover .btn-arrow {
    transform: translateX(4px);
}

/* Path Choice Cards */
.path-card {
    border: 2px solid #E2E8F0;
    border-radius: 18px;
    padding: 1.8rem;
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
    cursor: pointer;
    background: white;
    transition: all 0.25s ease;
}

.path-card:hover {
    border-color: var(--maths-primary);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.08);
    transform: translateY(-2px);
}

.path-icon {
    font-size: 2.5rem;
    background: #EFF6FF;
    padding: 0.8rem;
    border-radius: 14px;
    line-height: 1;
}

.path-content h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 0.4rem;
}

.path-content p {
    color: var(--maths-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Badges de difficulté */
.difficulty-card {
    border-radius: 16px;
    padding: 1.4rem;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    width: 100%;
}

.difficulty-card.easy {
    background: var(--level-easy-bg);
    color: var(--level-easy-text);
    border-color: #A7F3D0;
}

.difficulty-card.medium {
    background: var(--level-medium-bg);
    color: var(--level-medium-text);
    border-color: #FDE68A;
}

.difficulty-card.hard {
    background: var(--level-hard-bg);
    color: var(--level-hard-text);
    border-color: #FECACA;
}

.difficulty-card.adaptive {
    background: var(--level-adaptive-bg);
    color: var(--level-adaptive-text);
    border-color: #E9D5FF;
}

.difficulty-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.05);
}

.diff-badge-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 800;
    font-size: 1.15rem;
}

.diff-badge-tag {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(255,255,255,0.7);
}

/* Screen Exercise View */
.exercise-breadcrumb {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--maths-text-muted);
    margin-bottom: 1.5rem;
}

.exercise-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.level-indicator-badge {
    padding: 0.4rem 1rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.exercise-counter {
    font-weight: 700;
    color: var(--maths-text-muted);
    font-size: 1rem;
}

.exercise-question-box {
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.exercise-question-box h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 1.5rem;
}

.exercise-input-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    align-items: center;
}

.maths-input-field {
    width: 140px;
    padding: 0.8rem 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    border: 2px solid #CBD5E1;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.maths-input-field:focus {
    border-color: var(--maths-primary);
}

.maths-qcm-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.qcm-option-btn {
    background: white;
    border: 2px solid #CBD5E1;
    border-radius: 12px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.qcm-option-btn:hover {
    border-color: var(--maths-primary);
    background: #EFF6FF;
}

.qcm-option-btn.selected {
    border-color: var(--maths-primary);
    background: #DBEAFE;
    color: #1E40AF;
}

/* Action CTA Buttons */
.maths-cta-btn {
    background: var(--maths-primary);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 1.1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s ease, transform 0.1s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.maths-cta-btn:hover {
    background: var(--maths-primary-hover);
    transform: translateY(-1px);
}

/* Accordion Hint Box */
.hint-accordion {
    margin-top: 1.5rem;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    overflow: hidden;
}

.hint-accordion-header {
    background: #F8FAFC;
    padding: 1rem 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    color: #475569;
}

.hint-accordion-content {
    padding: 1.2rem 1.5rem;
    background: #FEFCE8;
    border-top: 1px solid #FEF08A;
    color: #854D0E;
    font-size: 1rem;
    display: none;
}

.hint-accordion-content.active {
    display: block;
}

/* Feedback & "À Retenir" Box */
.feedback-box {
    border-radius: 16px;
    padding: 1.8rem;
    margin-bottom: 1.5rem;
}

.feedback-box.correct {
    background: #ECFDF5;
    border: 2px solid #A7F3D0;
    color: #065F46;
}

.feedback-box.incorrect {
    background: #FEF2F2;
    border: 2px solid #FCA5A5;
    color: #991B1B;
}

.a-retenir-card {
    background: #FFFBEB;
    border: 2px solid #FDE68A;
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.a-retenir-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 800;
    color: #92400E;
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
}

.a-retenir-text {
    color: #78350F;
    font-size: 1rem;
    line-height: 1.5;
}

/* Smart Tutor Adaptive Alert */
.tutor-adaptive-alert {
    background: #F3E8FF;
    border: 2px solid #D8B4FE;
    border-radius: 14px;
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #6B21A8;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* Mastery Progress Dashboard */
.mastery-dashboard {
    margin-top: 2rem;
}

.mastery-gauge-group {
    margin-bottom: 1.2rem;
}

.mastery-gauge-label {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
}

.mastery-progress-bar {
    height: 12px;
    background: #E2E8F0;
    border-radius: 10px;
    overflow: hidden;
}

.mastery-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #10B981);
    border-radius: 10px;
    transition: width 0.8s ease;
}

/* Course Upload Form ("J'ai mon cours") */
.course-upload-box {
    border: 2px dashed #CBD5E1;
    border-radius: 18px;
    padding: 2rem;
    text-align: center;
    background: #F8FAFC;
    margin: 1.5rem 0;
}

.course-textarea {
    width: 100%;
    height: 140px;
    padding: 1rem;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    margin-top: 1rem;
    resize: vertical;
}

@media (max-width: 640px) {
    .maths-grid-2x2 {
        grid-template-columns: 1fr;
    }
    .maths-qcm-options {
        grid-template-columns: 1fr;
    }
    .maths-card {
        padding: 1.5rem;
    }
}

/* User Header Bar & Auth System */
.user-account-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0F172A;
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.user-status-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.user-badge.superadmin {
    background: #EF4444;
    color: white;
}

.user-badge.testeur {
    background: #10B981;
    color: white;
}

.user-actions-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.btn-auth-nav {
    background: #334155;
    color: white;
    border: none;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-auth-nav:hover {
    background: #475569;
}

.btn-auth-admin {
    background: #8B5CF6;
    color: white;
}

.btn-auth-admin:hover {
    background: #7C3AED;
}

/* Modal Overlay */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-modal-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    position: relative;
}

.auth-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #F1F5F9;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-weight: bold;
}

.auth-form-group {
    margin-bottom: 1.2rem;
}

.auth-form-group label {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: #334155;
}

.auth-form-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #CBD5E1;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
}

.auth-form-input:focus {
    border-color: #3B82F6;
}

/* Superadmin Panel Styles */
.admin-testers-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.admin-testers-table th, .admin-testers-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #E2E8F0;
    text-align: left;
}

.admin-testers-table th {
    background: #F8FAFC;
    color: #475569;
    font-weight: 700;
}

.btn-delete-tester {
    background: #FEE2E2;
    color: #991B1B;
    border: none;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-delete-tester:hover {
    background: #FCA5A5;
}

