@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg-main: #FAFAFF;
  --bg-soft-pink: #F5F3FF;
  --bg-soft-purple: #F3EEFC;
  --primary: #8B5CF6;
  --primary-light: #C084FC;
  --primary-dark: #6D28D9;
  --purple: #7C3AED;
  --purple-light: #DDD6FE;
  --purple-soft: #F5F3FF;
  --sky-blue: #BDE0FE;
  --sky-blue-light: #EAF6FF;
  --cream: #FFF7E8;
  --text-dark: #2D253A;
  --text-secondary: #776D8A;
  --white: #FFFFFF;
}

:root.dark-mode, body.dark-mode, html[data-theme="dark"], html.dark-mode {
  --bg-main: #0b0f19;
  --bg-soft-pink: #0f172a;
  --bg-soft-purple: #1e1b4b;
  --sky-blue-light: #1e293b;
  --cream: #1e293b;
  --text-dark: #f8fafc;
  --text-secondary: #94a3b8;
  --white: #1e293b;
}

body.dark-mode {
  background: #0b0f19 !important;
  color: #f8fafc !important;
}

body.dark-mode.main-page {
  background: #0b0f19 !important;
}

html {
    scrollbar-gutter: stable;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-soft-pink) 0%, var(--bg-main) 100%);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.main-page {
    background: var(--bg-main);
    display: block;
    padding: 0;
}

/* Global Notification Messages */
.success, .error {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.5;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    word-break: break-word;
    animation: slideInMsg 0.4s ease-out;
    background: var(--bg-soft-pink);
    color: var(--primary-dark);
    border: 1px solid rgba(255, 143, 171, 0.15);
    border-left: 4px solid var(--primary);
}

@keyframes slideInMsg {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.success::before {
    content: '✨';
    font-size: 1.2rem;
}

.error::before {
    content: '⚠️';
    font-size: 1.2rem;
}

.success strong, .error strong {
    color: var(--text-dark);
    font-weight: 700;
}

body.dark-mode .success, body.dark-mode .error {
    background: rgba(255, 143, 171, 0.08);
    color: var(--primary-light);
    border-color: rgba(255, 143, 171, 0.2);
    border-left-color: var(--primary-light);
}

body.dark-mode .success strong, body.dark-mode .error strong {
    color: var(--purple-light);
}

/* Auth Container */
.auth-container {
    display: flex;
    gap: 0;
    width: 100%;
    max-width: 1000px;
    min-height: 650px;
    max-height: 90vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
}

.auth-welcome {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    flex: 0.6;
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
}

.auth-welcome .logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-welcome p {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.95;
    margin-bottom: 30px;
    max-width: 380px;
}

.auth-welcome .illustration {
    font-size: 5rem;
    margin-bottom: 20px;
}

.auth-form-section {
    position: relative;
    flex: 1.1;
    padding: 40px 50px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    max-width: 600px;
    margin: 0 auto;
    overflow-y: auto;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: #f8f9fa;
    padding: 5px;
    border-radius: 10px;
}

.tab-btn {
    flex: 1;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background-color: transparent;
    color: #6c757d;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #495057;
}

.tab-btn.active {
    background: white;
    color: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-contents-container {
    position: relative;
    min-height: 450px;
}

.tab-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.tab-content.active {
    position: relative;
    opacity: 1;
    visibility: visible;
}

.auth-form-section h2 {
    color: #212529;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.3px;
}

.auth-form-section .subtitle {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    color: #495057;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 4px rgba(232, 93, 122, 0.1);
}

.form-group input:invalid:not(:placeholder-shown),
.form-group select:invalid:not(:placeholder-shown) {
    border-color: #f06548;
}

.form-group input:invalid:not(:placeholder-shown):focus,
.form-group select:invalid:not(:placeholder-shown):focus {
    box-shadow: 0 0 0 4px rgba(240, 101, 72, 0.1);
}

.role-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

.role-option {
    flex: 1;
    padding: 15px 12px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

.role-option:hover {
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.role-option.selected {
    border-color: var(--primary-dark);
    background: #f3e8ff;
}

.role-option input {
    display: none;
}

.role-option .role-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.role-option .role-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 143, 171, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(232, 93, 122, 0.3);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.auth-link {
    text-align: center;
    margin-top: 30px;
    color: #6c757d;
}

.auth-link a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

.error {
    background: var(--bg-soft-pink);
    color: var(--primary-dark);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
}

.success {
    background: var(--bg-soft-pink);
    color: var(--primary-dark);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
}

.error-message {
    color: #c33;
    font-size: 0.85rem;
    margin-top: 5px;
}

/* Main Site Styles */
.main-wrapper {
    width: 100%;
    min-height: 100vh;
    background: #f8f9fa;
}

header,
.site-header {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 244, 255, 0.94) 100%),
        radial-gradient(circle at 18% 0%, rgba(102, 126, 234, 0.13), transparent 32%);
    border-bottom: 1px solid rgba(102, 126, 234, 0.12);
    box-shadow: 0 16px 40px rgba(33, 37, 41, 0.08);
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(18px);
}

nav,
.site-nav {
    max-width: 1220px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 76px;
    gap: 16px;
}

nav .logo,
.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: max-content;
    padding: 8px 12px 8px 8px;
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.46);
    box-shadow: 0 10px 26px rgba(33, 37, 41, 0.05);
}

.brand-lockup span,
nav .logo {
    font-size: 1.9rem;
    font-weight: 900;
    color: var(--primary-dark);
    letter-spacing: 0;
}

.nav-logo {
    height: 56px;
    width: auto;
    object-fit: contain;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 247, 252, 0.92));
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: 14px;
    padding: 6px 7px;
    box-shadow: 0 10px 24px rgba(33, 37, 41, 0.08);
    display: block;
}

nav ul,
.nav-menu {
    display: flex;
    list-style: none;
    gap: 4px;
    align-items: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: 16px;
    padding: 6px 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 28px rgba(33, 37, 41, 0.06);
}

/* Visual separator between nav sections */
.nav-menu > li.nav-separator {
    width: 1px;
    height: 24px;
    background: rgba(255, 143, 171, 0.12);
    margin: 0 4px;
    border-radius: 1px;
}

nav a,
.nav-link {
    color: #4d5360;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.94rem;
    line-height: 1;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 10px;
    border-radius: 12px;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

nav a::after {
    display: none;
}

nav a:hover,
.nav-link:hover {
    background: rgba(255, 143, 171, 0.09);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

nav a.active,
.nav-link.active {
    background: #ffffff;
    color: var(--primary-dark);
    box-shadow: 0 8px 18px rgba(255, 143, 171, 0.16);
}

.nav-icon-link {
    width: 42px;
    padding: 0;
    font-size: 1.05rem;
}

.logout-link {
    color: #6b7280;
}

.nav-tools {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding-left: 4px;
}

.nav-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 143, 171, 0.16);
    border-radius: 12px;
    background: #ffffff;
    color: var(--primary-dark);
    font-weight: 900;
    font-size: 0.92rem;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(255, 143, 171, 0.11);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
    position: relative;
}

.nav-tool-btn:hover {
    background: rgba(255, 143, 171, 0.09);
    transform: translateY(-1px);
}

.lang-toggle {
    font-size: 0.82rem;
}

nav .btn-connect {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    min-height: 44px;
    padding: 0 28px;
    border-radius: 14px;
    box-shadow: 0 12px 26px rgba(255, 143, 171, 0.32);
}

nav .btn-connect:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #5b21b6 100%);
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(255, 143, 171, 0.38);
    color: white;
}

/* ── Nav Dropdown "Explorer" ── */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #4d5360;
    font-weight: 700;
    font-size: 0.94rem;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.nav-dropdown-trigger:hover,
.nav-dropdown-trigger.active {
    background: rgba(255, 143, 171, 0.09);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

.nav-dropdown-trigger.active {
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(255, 143, 171, 0.16);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid rgba(255, 143, 171, 0.14);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(33, 37, 41, 0.14);
    padding: 10px;
    min-width: 260px;
    z-index: 200;
    flex-direction: column;
    gap: 2px;
}

.nav-dropdown-menu.right-aligned {
    left: auto;
    right: 0;
    transform: none;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
    display: flex;
}

.nav-dd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: #4d5360;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}

.nav-dd-item:hover {
    background: rgba(255, 143, 171, 0.08);
    color: var(--primary-dark);
    transform: translateX(2px);
}

.nav-dd-item.dd-active {
    background: rgba(255, 143, 171, 0.1);
    color: var(--primary-dark);
    font-weight: 700;
}

.nav-dd-icon {
    font-size: 0.9rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(255, 143, 171, 0.06);
    border-radius: 10px;
    flex-shrink: 0;
}

.nav-dd-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-dd-label {
    font-weight: 700;
    font-size: 0.88rem;
    line-height: 1.2;
}

.nav-dd-desc {
    font-size: 0.76rem;
    font-weight: 400;
    color: #9ca3af;
    line-height: 1.2;
}

.nav-dd-item:hover .nav-dd-desc,
.nav-dd-item.dd-active .nav-dd-desc {
    color: var(--primary-light);
}

/* Dark mode dropdown */
body.dark-mode .nav-dropdown-trigger {
    color: #cbd5e1;
}

body.dark-mode .nav-dropdown-trigger:hover,
body.dark-mode .nav-dropdown-trigger.active {
    background: rgba(167, 139, 250, 0.14);
    color: var(--purple-light);
}

body.dark-mode .nav-dropdown-menu {
    background: #1e293b;
    border-color: rgba(167, 139, 250, 0.15);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

body.dark-mode .nav-dd-item {
    color: #cbd5e1;
}

body.dark-mode .nav-dd-item:hover,
body.dark-mode .nav-dd-item.dd-active {
    background: rgba(167, 139, 250, 0.12);
    color: var(--purple-light);
}

body.dark-mode .nav-dd-icon {
    background: rgba(167, 139, 250, 0.1);
}

body.dark-mode .nav-dd-desc {
    color: #64748b;
}

body.dark-mode .nav-dd-item:hover .nav-dd-desc,
body.dark-mode .nav-dd-item.dd-active .nav-dd-desc {
    color: var(--primary-light);
}


main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 50px 40px;
}

.hero {
    text-align: center;
    padding: 40px 0;
}

.success-icon {
    font-size: 5rem;
    margin-bottom: 25px;
    filter: drop-shadow(0 4px 12px rgba(118, 75, 162, 0.25));
}

.hero h1 {
    font-size: 2.5rem;
    color: #212529;
    margin-bottom: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.hero h1 span {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 40px;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 28px;
    margin-top: 50px;
}

.feature-card {
    background: white;
    padding: 36px 28px;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

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

.feature-card .feature-icon {
    font-size: 3rem;
    margin-bottom: 18px;
}

.feature-card h3 {
    color: #212529;
    margin-bottom: 14px;
    font-size: 1.4rem;
    font-weight: 600;
}

.feature-card p {
    color: #6c757d;
    line-height: 1.7;
    font-size: 1.02rem;
}

/* ═══════════════════════════════════════
   HOME DASHBOARD — Professional Layout
   ═══════════════════════════════════════ */

main.home-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 40px 60px;
    display: flex;
    flex-direction: column;
    gap: 36px;
}

/* ── Hero Section ── */
.hd-hero {
    position: relative;
}

.hd-hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.hd-hero-text {
    flex: 1;
}

.hd-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 143, 171, 0.08);
    border: 1px solid rgba(255, 143, 171, 0.15);
    border-radius: 50px;
    padding: 6px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 16px;
}

.hd-hero-text h1 {
    font-size: 2.4rem;
    font-weight: 800;
    color: #1e1b4b;
    line-height: 1.15;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.hd-hero-text p {
    font-size: 1.1rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
    max-width: 500px;
}

.hd-hero-visual {
    flex-shrink: 0;
}

.hd-hero-orb {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 143, 171, 0.12) 0%, rgba(232, 93, 122, 0.08) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 143, 171, 0.12);
    animation: hd-float 4s ease-in-out infinite;
}

.hd-hero-emoji {
    font-size: 3rem;
}

@keyframes hd-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ── Stats Row ── */
.hd-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.hd-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    border: 1px solid rgba(255, 143, 171, 0.08);
    border-radius: 16px;
    padding: 18px 20px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.hd-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 143, 171, 0.1);
    border-color: rgba(255, 143, 171, 0.15);
}

.hd-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 143, 171, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.hd-stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hd-stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e1b4b;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.hd-stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Section Title ── */
.hd-section-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #1e1b4b;
    margin-bottom: 18px;
    letter-spacing: -0.3px;
}

/* ── Quick Access Grid ── */
.hd-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.hd-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #ffffff;
    border: 1px solid rgba(255, 143, 171, 0.08);
    border-radius: 16px;
    padding: 22px 20px;
    text-decoration: none;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.hd-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.hd-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(255, 143, 171, 0.12);
    border-color: rgba(255, 143, 171, 0.18);
}

.hd-card:hover::before {
    opacity: 1;
}

.hd-card-cours::before { background: var(--primary); }
.hd-card-examens::before { background: var(--primary-dark); }
.hd-card-ia::before { background: #f59e0b; }
.hd-card-progression::before { background: #10b981; }
.hd-card-forum::before { background: #3b82f6; }
.hd-card-prediction::before { background: #ef4444; }

.hd-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.hd-card-cours .hd-card-icon { background: rgba(255, 143, 171, 0.1); }
.hd-card-examens .hd-card-icon { background: rgba(232, 93, 122, 0.1); }
.hd-card-ia .hd-card-icon { background: rgba(245, 158, 11, 0.1); }
.hd-card-progression .hd-card-icon { background: rgba(16, 185, 129, 0.1); }
.hd-card-forum .hd-card-icon { background: rgba(59, 130, 246, 0.1); }
.hd-card-prediction .hd-card-icon { background: rgba(239, 68, 68, 0.1); }

.hd-card-body {
    flex: 1;
    min-width: 0;
}

.hd-card-body h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e1b4b;
    margin: 0 0 4px;
    line-height: 1.2;
}

.hd-card-body p {
    font-size: 0.82rem;
    color: #94a3b8;
    margin: 0;
    line-height: 1.4;
}

.hd-card-arrow {
    font-size: 1.2rem;
    font-weight: 700;
    color: #cbd5e1;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.hd-card:hover .hd-card-arrow {
    color: var(--primary);
    transform: translateX(4px);
}

/* ── More Tools Row ── */
.hd-tools-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hd-tool-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid rgba(255, 143, 171, 0.1);
    border-radius: 50px;
    padding: 10px 20px;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    color: #4b5563;
    transition: all 0.25s ease;
}

.hd-tool-chip:hover {
    background: rgba(255, 143, 171, 0.06);
    border-color: rgba(255, 143, 171, 0.2);
    color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 143, 171, 0.1);
}

/* ── Motivation Card ── */
.hd-motivation-card {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    background: linear-gradient(135deg, rgba(255, 143, 171, 0.04) 0%, rgba(232, 93, 122, 0.02) 100%);
    border: 1px solid rgba(255, 143, 171, 0.1);
    border-radius: 20px;
    padding: 28px 32px;
}

.hd-motivation-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 143, 171, 0.08);
    border-radius: 14px;
}

.hd-motivation-text h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e1b4b;
    margin: 0 0 6px;
}

.hd-motivation-text p {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .hd-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .hd-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    main.home-dashboard {
        padding: 20px 16px 40px;
        gap: 28px;
    }
    .hd-hero-content {
        flex-direction: column;
        text-align: center;
    }
    .hd-hero-text h1 {
        font-size: 1.8rem;
    }
    .hd-hero-orb {
        width: 80px;
        height: 80px;
    }
    .hd-hero-emoji {
        font-size: 2rem;
    }
    .hd-grid {
        grid-template-columns: 1fr;
    }
    .hd-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .hd-tools-row {
        justify-content: center;
    }
}

footer, .site-footer {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: none !important;
}

/* bachubChat */
.bachub-chat {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 250;
    font-family: inherit;
}

.bachub-chat-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 0 20px 0 10px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: 800;
    font-size: 0.96rem;
    cursor: pointer;
    box-shadow: 0 18px 34px rgba(255, 143, 171, 0.36);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bachub-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 40px rgba(255, 143, 171, 0.42);
}

.chat-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1.2rem;
}

.bachub-chat-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    display: none;
    width: min(360px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid rgba(102, 126, 234, 0.16);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(33, 37, 41, 0.18);
}

.bachub-chat.open .bachub-chat-panel {
    display: block;
}

.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.chat-panel-header strong,
.chat-panel-header span {
    display: block;
}

.chat-panel-header strong {
    font-size: 1.05rem;
}

.chat-panel-header span {
    margin-top: 3px;
    font-size: 0.82rem;
    opacity: 0.86;
}

.chat-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.17);
    color: white;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 260px;
    padding: 16px;
    overflow-y: auto;
    background: #f7f8fb;
}

.chat-message {
    max-width: 86%;
    padding: 11px 13px;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.45;
}

.chat-message.bot {
    align-self: flex-start;
    background: white;
    color: #3f4654;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.chat-message.user {
    align-self: flex-end;
    background: var(--primary-dark);
    color: white;
}

.chat-suggestions {
    display: flex;
    gap: 8px;
    padding: 12px 14px 0;
    background: white;
}

.chat-suggestions button {
    flex: 1;
    min-height: 34px;
    border: 1px solid rgba(255, 143, 171, 0.18);
    border-radius: 10px;
    background: #f8f6ff;
    color: var(--primary-dark);
    font-weight: 700;
    cursor: pointer;
}

.chat-form {
    display: flex;
    gap: 8px;
    padding: 14px;
    background: white;
}

.chat-form input {
    min-width: 0;
    flex: 1;
    border: 1px solid #dfe3eb;
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
}

.chat-form input:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 4px rgba(232, 93, 122, 0.1);
}

.chat-form button {
    border: 0;
    border-radius: 12px;
    padding: 0 14px;
    background: #212529;
    color: white;
    font-weight: 800;
    cursor: pointer;
}

body.dark-mode,
body.dark-mode .main-wrapper {
    background: #111827;
    color: #e5e7eb;
}

body.dark-mode header,
body.dark-mode .site-header {
    background:
        linear-gradient(135deg, rgba(17, 24, 39, 0.96) 0%, rgba(31, 27, 54, 0.94) 100%),
        radial-gradient(circle at 18% 0%, rgba(129, 140, 248, 0.18), transparent 32%);
    border-bottom-color: rgba(167, 139, 250, 0.18);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

body.dark-mode .nav-logo,
body.dark-mode nav ul,
body.dark-mode .nav-menu,
body.dark-mode .nav-tool-btn,
body.dark-mode .feature-card,
body.dark-mode .settings-card {
    background: #1f2937;
    border-color: rgba(167, 139, 250, 0.16);
}

body.dark-mode .brand-lockup {
    background: rgba(17, 24, 39, 0.72);
    border-color: rgba(167, 139, 250, 0.14);
}

body.dark-mode .nav-separator {
    background: rgba(167, 139, 250, 0.15);
}

body.dark-mode .nav-logo {
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(226, 232, 240, 0.92));
    border-color: rgba(167, 139, 250, 0.14);
}

body.dark-mode .brand-lockup span,
body.dark-mode select,
body.dark-mode input,
body.dark-mode textarea {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: rgba(167, 139, 250, 0.25) !important;
}

body.dark-mode select option,
body.dark-mode select optgroup {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

body.dark-mode .settings-header p {
    color: #cbd5e1 !important;
}

body.dark-mode nav a:hover,
body.dark-mode .nav-link:hover,
body.dark-mode nav a.active,
body.dark-mode .nav-link.active,
body.dark-mode .nav-tool-btn {
    background: rgba(167, 139, 250, 0.14);
    color: var(--purple-light);
}

body.dark-mode .hero h1,
body.dark-mode .feature-card h3,
body.dark-mode .settings-header h1,
body.dark-mode .settings-form h3 {
    color: #f8fafc;
}

body.dark-mode .feature-card {
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
}

/* Dark mode — Home Dashboard */
body.dark-mode .hd-hero-text h1 {
    color: #f1f5f9;
}

body.dark-mode .hd-hero-text p {
    color: #94a3b8;
}

body.dark-mode .hd-hero-badge {
    background: rgba(167, 139, 250, 0.12);
    border-color: rgba(167, 139, 250, 0.2);
    color: #c4b5fd;
}

body.dark-mode .hd-hero-orb {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.15) 0%, rgba(255, 143, 171, 0.1) 100%);
    border-color: rgba(167, 139, 250, 0.15);
}

body.dark-mode .hd-stat-card,
body.dark-mode .hd-card {
    background: #1e293b;
    border-color: rgba(167, 139, 250, 0.1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

body.dark-mode .hd-stat-card:hover,
body.dark-mode .hd-card:hover {
    box-shadow: 0 12px 32px rgba(255, 143, 171, 0.15);
    border-color: rgba(167, 139, 250, 0.2);
}

body.dark-mode .hd-stat-number {
    color: #f1f5f9;
}

body.dark-mode .hd-section-title {
    color: #e2e8f0;
}

body.dark-mode .hd-card-body h3 {
    color: #e2e8f0;
}

body.dark-mode .hd-card-arrow {
    color: #475569;
}

body.dark-mode .hd-card:hover .hd-card-arrow {
    color: var(--primary-light);
}

body.dark-mode .hd-tool-chip {
    background: #1e293b;
    border-color: rgba(167, 139, 250, 0.12);
    color: #cbd5e1;
}

body.dark-mode .hd-tool-chip:hover {
    background: rgba(255, 143, 171, 0.12);
    border-color: rgba(167, 139, 250, 0.25);
    color: var(--purple-light);
}

body.dark-mode .hd-motivation-card {
    background: linear-gradient(135deg, rgba(255, 143, 171, 0.06) 0%, rgba(232, 93, 122, 0.04) 100%);
    border-color: rgba(167, 139, 250, 0.12);
}

body.dark-mode .hd-motivation-icon {
    background: rgba(167, 139, 250, 0.12);
}

body.dark-mode .hd-motivation-text h3 {
    color: #e2e8f0;
}

body.dark-mode .hd-motivation-text p {
    color: #94a3b8;
}

body.dark-mode .bachub-chat-panel,
body.dark-mode .chat-suggestions,
body.dark-mode .chat-form {
    background: #1f2937;
}

body.dark-mode .chat-messages {
    background: #111827;
}

body.dark-mode .chat-message.bot,
body.dark-mode .chat-form input {
    background: #273449;
    border-color: rgba(167, 139, 250, 0.18);
    color: #e5e7eb;
}

body.dark-mode .chat-form button {
    background: #f8fafc;
    color: #111827;
}

html[dir="rtl"] body {
    text-align: right;
    font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
}

/* Navigation RTL */
html[dir="rtl"] .site-nav,
html[dir="rtl"] nav {
    direction: rtl;
}

html[dir="rtl"] .brand-lockup {
    flex-direction: row-reverse;
}

html[dir="rtl"] .nav-menu {
    flex-direction: row-reverse;
}

html[dir="rtl"] .nav-tools {
    padding-left: 0;
    padding-right: 4px;
}

/* Textes centrés inchangés */
html[dir="rtl"] .hero,
html[dir="rtl"] .feature-card,
html[dir="rtl"] footer {
    text-align: center;
}

/* Chat bubble */
html[dir="rtl"] .bachub-chat {
    right: auto;
    left: 28px;
}

html[dir="rtl"] .bachub-chat-panel {
    right: auto;
    left: 0;
}

/* Toast reminder */
html[dir="rtl"] .reminder-toast {
    right: auto;
    left: 24px;
}

/* Progress/Plan panels */
html[dir="rtl"] .progress-hero,
html[dir="rtl"] .progress-layout,
html[dir="rtl"] .form-grid {
    direction: rtl;
}

html[dir="rtl"] .snapshot-row span,
html[dir="rtl"] .focus-card span,
html[dir="rtl"] .panel-kicker,
html[dir="rtl"] .progress-eyebrow {
    text-align: right;
}

html[dir="rtl"] .task-row {
    direction: rtl;
}

html[dir="rtl"] .task-topline {
    flex-direction: row-reverse;
}

html[dir="rtl"] .task-meta {
    flex-direction: row-reverse;
}

/* Timer */
html[dir="rtl"] .timer-layout,
html[dir="rtl"] .timer-grid-config,
html[dir="rtl"] .timer-controls,
html[dir="rtl"] .timer-presets {
    direction: rtl;
}

html[dir="rtl"] .timer-preset-buttons {
    flex-direction: row-reverse;
}

/* Calendar */
html[dir="rtl"] .calendar-grid {
    direction: rtl;
}

html[dir="rtl"] .calendar-head {
    flex-direction: row-reverse;
}

/* Forum */
html[dir="rtl"] .forum-hero {
    flex-direction: row-reverse;
}

html[dir="rtl"] .forum-hero-copy {
    text-align: right;
}

html[dir="rtl"] .forum-layout {
    direction: rtl;
}

html[dir="rtl"] .forum-card {
    flex-direction: row-reverse;
}

html[dir="rtl"] .forum-card-meta {
    flex-direction: row-reverse;
}

html[dir="rtl"] .forum-card-answers {
    text-align: center;
}

html[dir="rtl"] .forum-question-head {
    flex-direction: row-reverse;
}

html[dir="rtl"] .forum-question-meta {
    flex-direction: row-reverse;
}

html[dir="rtl"] .forum-answer-card {
    flex-direction: row-reverse;
}

html[dir="rtl"] .forum-list-head {
    flex-direction: row-reverse;
}

html[dir="rtl"] .comment-actions {
    flex-direction: row-reverse;
}

html[dir="rtl"] .comment-reactions {
    flex-direction: row-reverse;
}

html[dir="rtl"] .comment-dropdown-menu {
    right: auto;
    left: 0;
}

html[dir="rtl"] .dropdown-item {
    text-align: right;
}

html[dir="rtl"] .edit-form-actions {
    flex-direction: row-reverse;
}

/* Prediction */
html[dir="rtl"] .predict-layout {
    direction: rtl;
}

html[dir="rtl"] .predict-hero-copy {
    text-align: right;
}

html[dir="rtl"] .predict-subject-row {
    direction: rtl;
}

html[dir="rtl"] .predict-subjects-header {
    flex-direction: row-reverse;
}

html[dir="rtl"] .predict-detail-row {
    flex-direction: row-reverse;
}

html[dir="rtl"] .predict-subject-info {
    text-align: right;
}

html[dir="rtl"] .predict-section-select label {
    text-align: right;
}

html[dir="rtl"] .predict-mentions-grid {
    direction: rtl;
}

/* Success / Error messages */
html[dir="rtl"] .success,
html[dir="rtl"] .error {
    border-left: none;
    border-right: 4px solid;
    text-align: right;
}

html[dir="rtl"] .success { border-right-color: #3c3; }
html[dir="rtl"] .error   { border-right-color: #c33; }

/* Auth */
html[dir="rtl"] .auth-container {
    flex-direction: row-reverse;
}

html[dir="rtl"] .form-group label {
    text-align: right;
}

html[dir="rtl"] .toggle-password {
    right: auto;
    left: 15px;
}

html[dir="rtl"] .password-wrapper input {
    padding-right: 14px;
    padding-left: 50px;
}

/* Settings */
html[dir="rtl"] .settings-card {
    direction: rtl;
    text-align: right;
}

@media (max-width: 768px) {
    html[dir="rtl"] .bachub-chat {
        right: auto;
        left: 16px;
    }

    html[dir="rtl"] .reminder-toast {
        right: auto;
        left: 16px;
    }
}

main.progression-page {
    max-width: 1320px;
    width: 100%;
}

.progression-page {
    display: grid;
    gap: 22px;
}

.progress-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 20px;
    align-items: stretch;
}

.progress-hero-copy,
.progress-score,
.progress-panel,
.progress-stat-card,
.task-row {
    border: 1px solid rgba(102, 126, 234, 0.12);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 14px 34px rgba(33, 37, 41, 0.06);
}

.progress-hero-copy {
    border-radius: 24px;
    padding: 28px 30px;
}

.progress-eyebrow,
.panel-kicker {
    margin: 0 0 10px;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
    color: #5f6b82;
}

.progress-hero h1 {
    margin: 0;
    font-size: 2.3rem;
    line-height: 1.05;
    color: #171b24;
}

.progress-hero h1 span:last-child {
    color: var(--primary-dark);
}

.progress-hero-copy p:last-child {
    margin-top: 14px;
    max-width: 62ch;
    color: #5c6577;
    line-height: 1.7;
}

.progress-score {
    border-radius: 24px;
    padding: 24px;
    display: grid;
    align-content: center;
    gap: 12px;
    background:
        linear-gradient(135deg, rgba(18, 24, 37, 0.97), rgba(49, 42, 90, 0.96)),
        radial-gradient(circle at top left, rgba(38, 198, 218, 0.18), transparent 40%);
    color: #eff3ff;
}

.progress-score-value {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
    color: #ffffff;
}

.progress-score-label {
    font-size: 0.95rem;
    color: rgba(239, 243, 255, 0.82);
    text-transform: uppercase;
    letter-spacing: 0;
}

.progress-score-meta {
    display: grid;
    gap: 4px;
    margin-top: 6px;
    font-size: 0.94rem;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.progress-stat-card {
    border-radius: 18px;
    padding: 18px 18px 16px;
    display: grid;
    gap: 8px;
}

.progress-stat-card span {
    color: #667085;
    font-size: 0.88rem;
    font-weight: 700;
}

.progress-stat-card strong {
    color: #171b24;
    font-size: 1.7rem;
    line-height: 1;
}

.progress-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 16px;
}

.progress-panel {
    border-radius: 24px;
    padding: 24px;
}

.progress-panel-soft {
    background: linear-gradient(180deg, rgba(248, 250, 255, 0.92), rgba(255, 255, 255, 0.94));
}

.panel-head {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}

.panel-head h2 {
    margin: 0;
    font-size: 1.35rem;
    color: #171b24;
}

.progress-form {
    display: grid;
    gap: 16px;
}

.progress-form .form-group {
    margin-bottom: 0;
}

.progress-form label {
    color: #344054;
    font-weight: 700;
}

.progress-form input,
.progress-form select,
.progress-form textarea {
    border: 1px solid #d0d5dd;
    border-radius: 14px;
    background: #fff;
    color: #101828;
    padding: 13px 14px;
    width: 100%;
    font: inherit;
}

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

.progress-form small {
    display: block;
    margin-top: 8px;
    color: #667085;
    line-height: 1.5;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.snapshot-list {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.snapshot-row {
    display: grid;
    gap: 5px;
    padding: 14px 15px;
    border-radius: 16px;
    background: rgba(102, 126, 234, 0.06);
}

.snapshot-row span {
    color: #667085;
    font-size: 0.86rem;
    font-weight: 700;
}

.snapshot-row strong {
    color: #101828;
    line-height: 1.5;
}

.focus-card {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.1), rgba(255, 255, 255, 0.95));
    border: 1px solid rgba(102, 126, 234, 0.1);
    margin-bottom: 12px;
}

.focus-card strong {
    color: #171b24;
    font-size: 1.02rem;
}

.focus-card span {
    color: #5c6577;
    line-height: 1.55;
}

.focus-card-alt {
    background: linear-gradient(180deg, rgba(38, 198, 218, 0.08), rgba(255, 255, 255, 0.95));
}

.empty-state {
    padding: 24px;
    border-radius: 18px;
    background: rgba(102, 126, 234, 0.06);
    border: 1px dashed rgba(102, 126, 234, 0.2);
    display: grid;
    gap: 10px;
}

.empty-state strong {
    color: #171b24;
    font-size: 1.02rem;
}

.empty-state p {
    color: #5c6577;
    line-height: 1.6;
}

.progress-bar {
    height: 10px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.12);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
}

.progress-tasks-panel {
    padding-top: 22px;
}

.timer-panel {
    margin-top: -2px;
}

.calendar-panel {
    display: grid;
    gap: 16px;
}

.calendar-head {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.calendar-head .timer-secondary {
    width: auto;
}

.calendar-hint {
    color: #5c6577;
    line-height: 1.6;
    max-width: 72ch;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
}

.calendar-day {
    min-height: 168px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(102, 126, 234, 0.12);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 255, 0.96)),
        #ffffff;
    display: grid;
    align-content: start;
    gap: 8px;
    box-shadow: 0 12px 28px rgba(33, 37, 41, 0.05);
}

.calendar-day.today {
    border-color: rgba(102, 126, 234, 0.28);
    box-shadow: 0 16px 32px rgba(102, 126, 234, 0.12);
}

.calendar-day.done {
    background:
        linear-gradient(180deg, rgba(38, 198, 218, 0.1), rgba(255, 255, 255, 0.96)),
        #ffffff;
}

.calendar-day-name,
.calendar-day-date,
.calendar-day-session,
.calendar-day-meta {
    display: block;
}

.calendar-day-name {
    color: #667085;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.calendar-day-date {
    color: #101828;
    font-size: 1.08rem;
    line-height: 1.2;
}

.calendar-day-session {
    color: #4b5fb0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.45;
}

.calendar-day-meta {
    color: #667085;
    font-size: 0.84rem;
    line-height: 1.45;
}

.calendar-day .badge {
    justify-self: start;
    margin-top: 4px;
}

.timer-head {
    margin-bottom: 10px;
}

/* ── Timer head ─────────────────────────────────────────────────── */
.timer-head-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-sound-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 143, 171, 0.18);
    border-radius: 50%;
    background: rgba(255, 143, 171, 0.08);
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.18s, transform 0.15s;
}

.timer-sound-btn:hover {
    background: rgba(255, 143, 171, 0.16);
    transform: scale(1.08);
}

.timer-sound-btn[data-muted="true"] {
    opacity: 0.45;
}

/* ── Timer layout ────────────────────────────────────────────────── */
.timer-layout {
    display: grid;
    grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.15fr);
    gap: 18px;
}

/* ── Timer display (ring zone) ───────────────────────────────────── */
.timer-display {
    display: grid;
    align-content: center;
    gap: 18px;
    padding: 22px 18px;
    border-radius: 26px;
    background: linear-gradient(145deg, var(--bg-soft-pink) 0%, #edf5ff 55%, #f0feff 100%);
    border: 1px solid rgba(102, 126, 234, 0.14);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.1);
}

/* ── SVG ring ────────────────────────────────────────────────────── */
.timer-ring-wrap {
    position: relative;
    width: 190px;
    height: 190px;
    margin: 0 auto;
}

.timer-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-ring-track {
    fill: none;
    stroke: rgba(255, 143, 171, 0.12);
    stroke-width: 12;
}

.timer-ring-progress {
    fill: none;
    stroke: url(#timerGradient);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 515;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.85s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s;
    filter: drop-shadow(0 0 6px rgba(255, 143, 171, 0.38));
}

/* Gradient défini dans le SVG inline ci-dessous via JS */

/* ── Ring inner content ──────────────────────────────────────────── */
.timer-ring-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    pointer-events: none;
}

.timer-ring-emoji {
    font-size: 1.6rem;
    line-height: 1;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.timer-ring-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7c6bb0;
    margin-top: 2px;
}

/* Pulse quand le timer tourne */
.timer-panel[data-timer-state="running"] .timer-ring-progress {
    animation: timerRingPulse 2s ease-in-out infinite;
}

.timer-panel[data-timer-state="running"] .timer-ring-emoji {
    animation: timerEmojiBounce 1.8s ease-in-out infinite;
}

.timer-panel[data-timer-state="done"] .timer-ring-emoji {
    animation: timerEmojiPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes timerRingPulse {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(102, 126, 234, 0.3)); }
    50%       { filter: drop-shadow(0 0 14px rgba(102, 126, 234, 0.65)); }
}

@keyframes timerEmojiBounce {
    0%, 100% { transform: translateY(0);   }
    50%       { transform: translateY(-3px); }
}

@keyframes timerEmojiPop {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1.2); opacity: 1; }
}

/* ── Clock text ──────────────────────────────────────────────────── */
.timer-clock {
    font-size: clamp(1.8rem, 3.2vw, 2.4rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #171b24;
    font-variant-numeric: tabular-nums;
}

/* ── Metrics ─────────────────────────────────────────────────────── */
.timer-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.timer-metrics div {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.timer-metrics span {
    color: #667085;
    font-size: 0.8rem;
    font-weight: 700;
}

.timer-metrics strong {
    color: #171b24;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}

/* ── Config side ─────────────────────────────────────────────────── */
.timer-config {
    display: grid;
    gap: 16px;
}

.timer-grid-config {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
    gap: 14px;
    align-items: end;
}

.timer-presets {
    display: grid;
    gap: 8px;
}

.timer-presets span {
    color: #344054;
    font-weight: 700;
}

.timer-preset-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.timer-preset {
    min-width: 54px;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(255, 143, 171, 0.18);
    border-radius: 12px;
    background: rgba(255, 143, 171, 0.08);
    color: var(--primary-dark);
    font-weight: 800;
    cursor: pointer;
    transition: background 0.18s, transform 0.12s;
}

.timer-preset:hover {
    background: rgba(255, 143, 171, 0.16);
    transform: translateY(-1px);
}

.timer-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.timer-secondary {
    min-height: 44px;
    padding: 0 16px;
    border: 1.5px solid rgba(167, 139, 250, 0.45);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.22), rgba(255, 143, 171, 0.32));
    color: var(--primary-dark);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(255, 143, 171, 0.12);
    transition: all 0.2s ease;
}

.timer-secondary:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff !important;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(255, 143, 171, 0.32);
}

.timer-state-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.12);
    color: #4b5fb0;
    font-size: 0.79rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: background 0.3s, color 0.3s;
}

.timer-panel[data-timer-state="running"] .timer-state-badge {
    background: rgba(38, 198, 218, 0.15);
    color: #0891b2;
}

.timer-panel[data-timer-state="done"] .timer-state-badge {
    background: rgba(34, 197, 94, 0.14);
    color: #16a34a;
}

.timer-panel[data-timer-state="paused"] .timer-state-badge {
    background: rgba(249, 168, 37, 0.14);
    color: #b45309;
}

/* ── Timer music zone (Photo 2 Idea) ──────────────────────────────── */
.timer-music-zone {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1.5px dashed rgba(167, 139, 250, 0.25);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timer-music-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid rgba(167, 139, 250, 0.15);
    padding-bottom: 8px;
}

.music-tab-btn {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 800;
    color: #64748b;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.music-tab-btn:hover {
    background: rgba(167, 139, 250, 0.08);
    color: var(--primary);
}

.music-tab-btn.active {
    background: rgba(255, 143, 171, 0.12);
    color: var(--primary-dark);
}

.music-tab-content {
    display: none;
}

.music-tab-content.active {
    display: block;
}

/* Ambient music grid */
.ambient-music-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.ambient-music-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 10px;
    border-radius: 16px;
    border: 1.5px solid rgba(167, 139, 250, 0.15);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    gap: 8px;
}

body:not(.dark-mode) .ambient-music-card {
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    color: #171b24;
}

.ambient-music-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 143, 171, 0.45);
    box-shadow: 0 6px 18px rgba(255, 143, 171, 0.12);
}

.ambient-music-card.active {
    border-color: var(--primary);
    background: rgba(255, 143, 171, 0.08);
    box-shadow: 0 0 15px rgba(255, 143, 171, 0.2);
}

body:not(.dark-mode) .ambient-music-card.active {
    background: rgba(255, 143, 171, 0.05);
}

.ambient-icon-box {
    font-size: 1.8rem;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.1));
    transition: transform 0.2s;
}

.ambient-music-card:hover .ambient-icon-box {
    transform: scale(1.15);
}

.ambient-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: inherit;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* YouTube controls */
.youtube-control-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(167, 139, 250, 0.03);
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(167, 139, 250, 0.15);
}

.youtube-input-row {
    display: flex;
    gap: 8px;
}

.youtube-hint {
    font-size: 0.76rem;
    color: #94a3b8;
}

.youtube-player-container {
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    height: 0;
    width: 0;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
}

.youtube-player-container.loaded {
    height: 120px;
    width: 200px;
    opacity: 1;
    pointer-events: all;
    border: 1.5px solid rgba(167, 139, 250, 0.3);
}

body.dark-mode .music-tab-btn {
    color: #cbd5e1;
}

body.dark-mode .music-tab-btn.active {
    background: rgba(255, 143, 171, 0.24);
    color: var(--primary-light);
}

body.dark-mode .ambient-music-card {
    background: rgba(17, 24, 39, 0.5);
    border-color: rgba(167, 139, 250, 0.16);
    color: #e5e7eb;
}

body.dark-mode .ambient-music-card:hover {
    border-color: rgba(255, 143, 171, 0.45);
}

body.dark-mode .ambient-music-card.active {
    background: rgba(255, 143, 171, 0.15);
    border-color: var(--primary-light);
}

body.dark-mode .youtube-control-box {
    background: rgba(17, 24, 39, 0.5);
    border-color: rgba(167, 139, 250, 0.16);
}

.tasks-list {
    display: grid;
    gap: 14px;
}

.task-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    border-radius: 18px;
    padding: 18px;
}

.task-row.done {
    background: rgba(38, 198, 218, 0.06);
}

.task-main {
    min-width: 0;
    display: grid;
    gap: 10px;
}

.task-topline {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.task-topline strong {
    color: #101828;
    font-size: 1.02rem;
}

.task-topline span,
.task-main p,
.task-meta {
    color: #5c6577;
}

.task-main p {
    line-height: 1.6;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
}

.done-badge {
    background: rgba(38, 198, 218, 0.16);
    color: #006f80;
}

.pending-badge {
    background: rgba(255, 143, 171, 0.12);
    color: var(--primary-dark);
}

.task-action {
    display: flex;
    align-items: center;
}

.task-toggle {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid rgba(255, 143, 171, 0.18);
    border-radius: 14px;
    background: #ffffff;
    color: var(--primary-dark);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(33, 37, 41, 0.06);
}

.task-row.done .task-toggle {
    background: #101828;
    border-color: #101828;
    color: #ffffff;
}

.reminder-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 220;
    width: min(380px, calc(100vw - 32px));
    padding: 16px 18px;
    border: 1px solid rgba(102, 126, 234, 0.18);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(245, 243, 255, 0.98) 0%, rgba(240, 254, 255, 0.98) 100%);
    box-shadow: 0 20px 50px rgba(33, 37, 41, 0.16);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #171b24;
    transform: translateY(16px);
    opacity: 0;
    transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reminder-toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.reminder-toast-icon {
    font-size: 1.7rem;
    line-height: 1;
    flex-shrink: 0;
    animation: reminderBell 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes reminderBell {
    0%   { transform: rotate(-18deg) scale(0.7); }
    40%  { transform: rotate(16deg) scale(1.1); }
    65%  { transform: rotate(-10deg); }
    85%  { transform: rotate(7deg); }
    100% { transform: rotate(0deg) scale(1); }
}

.reminder-toast-content {
    flex: 1;
    min-width: 0;
}

.reminder-toast-close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    color: #6046b0;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
}

.reminder-toast-close:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.12);
}

.reminder-toast strong {
    display: block;
    font-size: 0.96rem;
    color: #6046b0;
    margin-bottom: 3px;
}

.reminder-toast p {
    color: #4f5665;
    line-height: 1.5;
    font-size: 0.9rem;
    margin: 0;
}

body.dark-mode main.progression-page {
    color: #e5e7eb;
}

body.dark-mode .progress-hero-copy,
body.dark-mode .progress-panel,
body.dark-mode .progress-stat-card,
body.dark-mode .task-row,
body.dark-mode .timer-display,
body.dark-mode .timer-metrics div,
body.dark-mode .calendar-day,
body.dark-mode .reminder-toast,
body.dark-mode .timer-secondary,
body.dark-mode .timer-preset {
    background: rgba(17, 24, 39, 0.9);
    border-color: rgba(167, 139, 250, 0.16);
}

body.dark-mode .timer-display {
    background:
        linear-gradient(135deg, rgba(102, 126, 234, 0.16), rgba(38, 198, 218, 0.12)),
        rgba(17, 24, 39, 0.94);
}

body.dark-mode .timer-state-badge {
    background: rgba(167, 139, 250, 0.16);
    color: var(--purple-light);
}

body.dark-mode .progress-eyebrow,
body.dark-mode .panel-kicker,
body.dark-mode .progress-stat-card span,
body.dark-mode .snapshot-row span,
body.dark-mode .focus-card span,
body.dark-mode .empty-state p,
body.dark-mode .task-topline span,
body.dark-mode .task-main p,
body.dark-mode .task-meta,
body.dark-mode .progress-form small {
    color: #cbd5e1;
}

body.dark-mode .progress-hero h1,
body.dark-mode .panel-head h2,
body.dark-mode .progress-stat-card strong,
body.dark-mode .snapshot-row strong,
body.dark-mode .focus-card strong,
body.dark-mode .empty-state strong,
body.dark-mode .task-topline strong {
    color: #f8fafc;
}

body.dark-mode .progress-hero-copy p:last-child {
    color: #cbd5e1;
}

body.dark-mode .calendar-hint,
body.dark-mode .calendar-day-name,
body.dark-mode .calendar-day-meta,
body.dark-mode .reminder-toast p {
    color: #cbd5e1;
}

body.dark-mode .calendar-day-date,
body.dark-mode .calendar-day-session {
    color: #f8fafc;
}

body.dark-mode .calendar-day.done {
    background:
        linear-gradient(180deg, rgba(38, 198, 218, 0.12), rgba(17, 24, 39, 0.94)),
        rgba(17, 24, 39, 0.94);
}

body.dark-mode .calendar-day.today {
    border-color: rgba(167, 139, 250, 0.26);
}

body.dark-mode .reminder-toast strong {
    color: var(--purple-light);
}

body.dark-mode .progress-form input,
body.dark-mode .progress-form select,
body.dark-mode .progress-form textarea,
body.dark-mode .task-toggle {
    background: #111827;
    border-color: rgba(167, 139, 250, 0.18);
    color: #e5e7eb;
}

body.dark-mode .timer-clock,
body.dark-mode .timer-metrics strong,
body.dark-mode .timer-presets span {
    color: #f8fafc;
}

body.dark-mode .timer-metrics span {
    color: #cbd5e1;
}

body.dark-mode .snapshot-row,
body.dark-mode .focus-card,
body.dark-mode .empty-state {
    background: rgba(31, 41, 55, 0.95);
    border-color: rgba(167, 139, 250, 0.14);
}

body.dark-mode .progress-score {
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

body.dark-mode .progress-bar {
    background: rgba(167, 139, 250, 0.12);
}

body.dark-mode .pending-badge {
    background: rgba(167, 139, 250, 0.16);
    color: var(--purple-light);
}

body.dark-mode .done-badge {
    background: rgba(38, 198, 218, 0.16);
    color: #99f6e4;
}

@media (max-width: 768px) {
    .auth-container {
        flex-direction: column;
        width: 95%;
    }
    
    .auth-welcome {
        padding: 40px 20px;
    }
    
    .auth-form-section {
        padding: 40px 20px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    header,
    .site-header {
        padding: 10px 16px;
    }

    nav,
    .site-nav {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    nav ul,
    .nav-menu {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
    }

    .brand-lockup span,
    nav .logo {
        font-size: 1.55rem;
    }

    .nav-logo {
        height: 50px;
    }

    .bachub-chat {
        right: 16px;
        bottom: 16px;
    }

    html[dir="rtl"] .bachub-chat {
        right: auto;
        left: 16px;
    }

    .bachub-chat-toggle {
        min-height: 52px;
    }

    .chat-toggle-text {
        display: none;
    }

    .progress-hero,
    .progress-layout,
    .progress-stats,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .task-row {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .task-topline {
        flex-direction: column;
        align-items: flex-start;
    }

    .progress-hero h1 {
        font-size: 1.9rem;
    }

    .progress-score-value {
        font-size: 2.4rem;
    }

    .timer-layout,
    .timer-grid-config {
        grid-template-columns: 1fr;
    }

    .calendar-head {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .timer-metrics {
        grid-template-columns: 1fr;
    }

    .timer-controls {
        flex-direction: column;
    }

    .timer-controls .btn-primary,
    .timer-controls .timer-secondary {
        width: 100%;
    }

    .reminder-toast {
        right: 16px;
        bottom: 16px;
    }

    html[dir="rtl"] .reminder-toast {
        right: auto;
        left: 16px;
    }
}

/* Password Visibility Toggle */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 50px;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: opacity 0.2s;
}

.toggle-password:hover {
    opacity: 0.7;
}

/* ════════════════════════════════════════════════════════════════
   DISCUSSION EN LIVE — Lobby
════════════════════════════════════════════════════════════════ */

.discussion-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 28px 60px;
    display: grid;
    gap: 28px;
}

/* Flash */
.live-flash {
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 0.95rem;
}
.live-flash-error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.22);  color: #b91c1c; }
.live-flash-success { background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.22);  color: #15803d; }

/* Section générique */
.live-section {
    background: #fff;
    border: 1px solid rgba(102,126,234,0.12);
    border-radius: 22px;
    padding: 26px 28px;
    box-shadow: 0 8px 28px rgba(33,37,41,0.05);
}

.live-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}
.live-section-icon { font-size: 1.4rem; }
.live-section-head h2 {
    font-size: 1.18rem;
    font-weight: 800;
    color: #171b24;
    margin: 0;
    flex: 1;
}
.live-rooms-count {
    font-size: 0.82rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(38,198,218,0.12);
    color: #0891b2;
}

/* ════════════════════════════════════════════════════════════════
   PREDICTION MOYENNE BAC TUNISIEN
════════════════════════════════════════════════════════════════ */

.predict-page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 50px 40px;
    display: grid;
    gap: 22px;
}

.predict-hero {
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: 24px;
    padding: 28px 30px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 14px 34px rgba(33, 37, 41, 0.06);
}

.predict-hero-copy {
    display: grid;
    gap: 8px;
}

.predict-hero h1 {
    margin: 0;
    font-size: 2.2rem;
    line-height: 1.1;
    color: #171b24;
    font-weight: 800;
}

.predict-hero h1 span {
    color: var(--primary-dark);
}

.predict-hero-copy p:last-child {
    margin-top: 6px;
    max-width: 64ch;
    color: #5c6577;
    line-height: 1.7;
}

.predict-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
    gap: 18px;
    align-items: start;
}

.predict-panel {
    border: 1px solid rgba(102, 126, 234, 0.12);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 14px 34px rgba(33, 37, 41, 0.06);
    border-radius: 24px;
    padding: 24px;
}

.predict-form-panel {
    position: sticky;
    top: 96px;
}

/* --- Section selector --- */
.predict-section-select {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}

.predict-section-select label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #344054;
}

.predict-section-select select {
    padding: 13px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 14px;
    background: #fff;
    color: #101828;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.predict-section-select select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 143, 171, 0.1);
}

/* --- Subjects list --- */
.predict-subjects {
    display: grid;
    gap: 12px;
}

.predict-subjects-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 143, 171, 0.1), rgba(167, 139, 250, 0.06));
    border: 1px solid rgba(255, 143, 171, 0.12);
}

.predict-subjects-icon {
    font-size: 1.4rem;
}

.predict-subjects-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #171b24;
}

.predict-subjects-list {
    display: grid;
    gap: 8px;
}

.predict-subject-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 0.9);
    transition: background 0.25s, border-color 0.25s;
}

.predict-subject-row-even {
    background: rgba(247, 249, 255, 0.8);
}

.predict-subject-row-odd {
    background: rgba(255, 255, 255, 0.9);
}

.predict-subject-row.grade-low {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(254, 242, 242, 0.85);
}

.predict-subject-row.grade-mid {
    border-color: rgba(245, 158, 11, 0.28);
    background: rgba(255, 251, 235, 0.85);
}

.predict-subject-row.grade-high {
    border-color: rgba(34, 197, 94, 0.28);
    background: rgba(237, 254, 242, 0.85);
}

.predict-subject-info {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.predict-subject-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #101828;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.predict-subject-coef {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    background: rgba(255, 143, 171, 0.1);
    color: var(--primary-dark);
}

.predict-subject-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid #d0d5dd;
    border-radius: 14px;
    padding: 0 12px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.predict-subject-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 143, 171, 0.1);
}

.predict-grade-input {
    width: 72px;
    padding: 11px 0;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    color: #101828;
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.predict-grade-input::-webkit-outer-spin-button,
.predict-grade-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.predict-grade-unit {
    font-size: 0.82rem;
    font-weight: 700;
    color: #94a3b8;
}

/* --- Result panel --- */
.predict-results-column {
    position: sticky;
    top: 96px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-self: start;
}

.predict-result-panel {
    /* Flow naturally inside sticky column */
}

.predict-result-content {
    display: grid;
    gap: 16px;
}

.predict-result-placeholder {
    display: grid;
    gap: 14px;
    justify-items: center;
    text-align: center;
    padding: 40px 20px;
}

.predict-result-icon {
    font-size: 3.5rem;
    filter: drop-shadow(0 4px 12px rgba(168, 85, 247, 0.2));
}

.predict-result-placeholder p {
    color: #667085;
    line-height: 1.6;
    max-width: 28ch;
}

.predict-result-display {
    display: grid;
    gap: 18px;
    justify-items: center;
    text-align: center;
}

.predict-score-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: conic-gradient(rgba(168, 85, 247, 0.2) 0deg, rgba(168, 85, 247, 0.05) 360deg);
    border: 4px solid rgba(168, 85, 247, 0.2);
    transition: border-color 0.4s, background 0.4s;
}

.predict-score-circle.mention-ajourne,
.predict-score-circle.mention-passable,
.predict-score-circle.mention-assez-bien,
.predict-score-circle.mention-bien,
.predict-score-circle.mention-tres-bien,
.predict-score-circle.mention-felicitations {
    border-color: rgba(255, 143, 171, 0.55);
    background: conic-gradient(rgba(255, 143, 171, 0.18) 0deg, rgba(232, 93, 122, 0.06) 360deg);
    box-shadow: 0 0 0 6px rgba(255, 143, 171, 0.08);
}

.predict-score-number {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
    color: #171b24;
    font-variant-numeric: tabular-nums;
}

.predict-score-suffix {
    font-size: 0.85rem;
    font-weight: 700;
    color: #94a3b8;
}

.predict-mention {
    font-size: 1.25rem;
    font-weight: 800;
    padding: 8px 22px;
    border-radius: 999px;
    transition: background 0.3s, color 0.3s;
}

.predict-mention.mention-ajourne,
.predict-mention.mention-passable,
.predict-mention.mention-assez-bien,
.predict-mention.mention-bien,
.predict-mention.mention-tres-bien,
.predict-mention.mention-felicitations {
    background: linear-gradient(135deg, rgba(255, 143, 171, 0.15), rgba(232, 93, 122, 0.1));
    color: var(--primary-dark);
    border: 1px solid rgba(255, 143, 171, 0.25);
}

.predict-mention.mention-felicitations {
    background: rgba(232, 93, 122, 0.1);
    color: var(--primary-dark);
}

.predict-mention-desc {
    font-size: 0.92rem;
    color: #667085;
    line-height: 1.5;
}

.predict-details {
    display: grid;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}

.predict-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(168, 85, 247, 0.05);
}

.predict-detail-row span {
    color: #667085;
    font-size: 0.85rem;
    font-weight: 700;
}

.predict-detail-row strong {
    color: #101828;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

/* --- Mentions table --- */
.predict-mentions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.predict-mention-card {
    display: grid;
    gap: 6px;
    justify-items: center;
    text-align: center;
    padding: 18px 12px;
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 0.9);
    transition: transform 0.2s, box-shadow 0.2s;
}

.predict-mention-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(33, 37, 41, 0.08);
}

.predict-mention-card .mention-range {
    font-size: 0.82rem;
    font-weight: 800;
    color: #667085;
}

.predict-mention-card .mention-label {
    font-size: 0.92rem;
    font-weight: 800;
    color: #171b24;
}

.predict-mention-card .mention-emoji {
    font-size: 1.8rem;
}

.predict-mention-card.mention-ajourne {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(254, 242, 242, 0.6);
}
.predict-mention-card.mention-passable {
    border-color: rgba(34, 197, 94, 0.2);
    background: rgba(237, 254, 242, 0.6);
}
.predict-mention-card.mention-assez-bien {
    border-color: rgba(245, 158, 11, 0.2);
    background: rgba(255, 251, 235, 0.6);
}
.predict-mention-card.mention-bien {
    border-color: rgba(59, 130, 246, 0.2);
    background: rgba(239, 246, 255, 0.6);
}
.predict-mention-card.mention-tres-bien {
    border-color: rgba(255, 143, 171, 0.2);
    background: rgba(243, 232, 255, 0.6);
}

.predict-mention-card.mention-felicitations {
    border-color: rgba(232, 93, 122, 0.22);
    background: rgba(237, 233, 255, 0.6);
}

/* --- Dark mode for prediction page --- */
body.dark-mode .predict-hero,
body.dark-mode .predict-panel,
body.dark-mode .predict-subject-row,
body.dark-mode .predict-detail-row,
body.dark-mode .predict-mention-card {
    background: rgba(17, 24, 39, 0.9);
    border-color: rgba(167, 139, 250, 0.16);
}

body.dark-mode .predict-subjects-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.16), rgba(38, 198, 218, 0.08));
    border-color: rgba(167, 139, 250, 0.14);
}

body.dark-mode .predict-hero h1,
body.dark-mode .predict-subjects-title,
body.dark-mode .predict-subject-name,
body.dark-mode .predict-score-number,
body.dark-mode .predict-detail-row strong {
    color: #f8fafc;
}

body.dark-mode .predict-hero-copy p:last-child,
body.dark-mode .predict-result-placeholder p,
body.dark-mode .predict-mention-desc,
body.dark-mode .predict-detail-row span {
    color: #cbd5e1;
}

body.dark-mode .predict-subject-coef {
    background: rgba(167, 139, 250, 0.14);
    color: var(--purple-light);
}

body.dark-mode .predict-subject-input-wrap {
    background: #111827;
    border-color: rgba(167, 139, 250, 0.18);
}

body.dark-mode .predict-grade-input {
    color: #e5e7eb;
}

body.dark-mode .predict-section-select select {
    background: #111827;
    border-color: rgba(167, 139, 250, 0.18);
    color: #e5e7eb;
}

body.dark-mode .predict-subject-row.grade-low {
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(127, 29, 29, 0.25);
}

body.dark-mode .predict-subject-row.grade-mid {
    border-color: rgba(245, 158, 11, 0.26);
    background: rgba(120, 53, 15, 0.25);
}

body.dark-mode .predict-subject-row.grade-high {
    border-color: rgba(34, 197, 94, 0.26);
    background: rgba(20, 83, 45, 0.25);
}

body.dark-mode .predict-mention-card.mention-ajourne {
    background: rgba(127, 29, 29, 0.2);
    border-color: rgba(239, 68, 68, 0.2);
}
body.dark-mode .predict-mention-card.mention-passable {
    background: rgba(20, 83, 45, 0.2);
    border-color: rgba(34, 197, 94, 0.2);
}
body.dark-mode .predict-mention-card.mention-assez-bien {
    background: rgba(120, 53, 15, 0.2);
    border-color: rgba(245, 158, 11, 0.2);
}
body.dark-mode .predict-mention-card.mention-bien {
    background: rgba(30, 58, 138, 0.2);
    border-color: rgba(59, 130, 246, 0.2);
}
body.dark-mode .predict-mention-card.mention-tres-bien {
    background: rgba(49, 46, 129, 0.2);
    border-color: rgba(102, 126, 234, 0.2);
}
body.dark-mode .predict-mention-card.mention-felicitations {
    background: rgba(76, 29, 149, 0.2);
    border-color: rgba(168, 85, 247, 0.22);
}

body.dark-mode .predict-mention-card .mention-label {
    color: #f8fafc;
}

body.dark-mode .predict-mention-card .mention-range {
    color: #cbd5e1;
}

/* --- Responsive --- */
@media (max-width: 920px) {
    .predict-layout {
        grid-template-columns: 1fr;
    }
    .predict-form-panel,
    .predict-result-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .predict-page {
        padding: 36px 16px 50px;
    }
    .predict-hero h1 {
        font-size: 1.7rem;
    }
    .predict-hero {
        padding: 22px 18px;
    }
    .predict-panel {
        padding: 18px;
    }
    .predict-subject-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .predict-subject-input-wrap {
        width: 100%;
        justify-content: center;
    }
    .predict-grade-input {
        flex: 1;
        text-align: left;
        padding-left: 8px;
    }
    .predict-score-circle {
        width: 150px;
        height: 150px;
    }
    .predict-score-number {
        font-size: 2.4rem;
    }
}

/* ==========================================================================
   FORUM D'ENTRAIDE
   ========================================================================== */
.forum-page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 50px 40px;
    display: grid;
    gap: 22px;
}

.forum-hero {
    border: 1px solid rgba(255, 143, 171, 0.12);
    border-radius: 24px;
    padding: 28px 30px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 14px 34px rgba(255, 143, 171, 0.25);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.forum-hero-copy {
    display: grid;
    gap: 8px;
}

.forum-hero .progress-eyebrow {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.78rem;
    font-weight: 700;
    opacity: 0.85;
    margin: 0;
}

.forum-hero h1 {
    margin: 0;
    font-size: 2.2rem;
    line-height: 1.1;
    font-weight: 800;
}

.forum-hero h1 span {
    color: #ffe08a;
}

.forum-hero-copy p:last-child {
    margin-top: 4px;
    max-width: 60ch;
    line-height: 1.6;
    opacity: 0.95;
}

.forum-hero-stats {
    display: flex;
    gap: 16px;
}

.forum-stat {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 18px;
    padding: 16px 22px;
    text-align: center;
    min-width: 96px;
}

.forum-stat strong {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.forum-stat span {
    font-size: 0.82rem;
    opacity: 0.9;
}

.forum-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
    gap: 18px;
    align-items: start;
}

.forum-panel {
    border: 1px solid rgba(102, 126, 234, 0.12);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 14px 34px rgba(33, 37, 41, 0.06);
    border-radius: 24px;
    padding: 24px;
}

.forum-ask-panel {
    position: sticky;
    top: 96px;
}

.forum-panel .panel-head {
    margin-bottom: 18px;
}

.forum-panel .panel-kicker {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.74rem;
    font-weight: 700;
    color: #6950b8;
    margin: 0 0 4px;
}

.forum-panel .panel-head h2 {
    margin: 0;
    font-size: 1.35rem;
    color: #171b24;
    font-weight: 800;
}

/* --- Formulaire question / reponse --- */
.forum-ask-form,
.forum-reply-form {
    display: grid;
    gap: 14px;
}

.forum-field {
    display: grid;
    gap: 6px;
}

.forum-field label {
    font-size: 0.86rem;
    font-weight: 700;
    color: #344054;
}

.forum-field input,
.forum-field textarea,
.forum-reply-form textarea {
    padding: 12px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 14px;
    background: #fff;
    color: #101828;
    font: inherit;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.forum-field input:focus,
.forum-field textarea:focus,
.forum-reply-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 143, 171, 0.1);
}

.forum-btn-primary {
    justify-self: start;
    padding: 12px 24px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.forum-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(255, 143, 171, 0.35);
}

/* --- Liste des questions --- */
.forum-list-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.forum-search {
    display: flex;
    gap: 6px;
}

.forum-search input {
    padding: 9px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    font: inherit;
    min-width: 180px;
}

.forum-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 143, 171, 0.1);
}

.forum-search button {
    padding: 9px 14px;
    border: none;
    border-radius: 12px;
    background: #eef0fb;
    cursor: pointer;
    font-size: 1rem;
}

.forum-list {
    display: grid;
    gap: 12px;
}

.forum-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border: 1px solid #eceef5;
    border-radius: 18px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.forum-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 143, 171, 0.4);
    box-shadow: 0 12px 26px rgba(33, 37, 41, 0.08);
}

.forum-card-avatar {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.forum-avatar-lg {
    width: 54px;
    height: 54px;
    font-size: 1.1rem;
}

.forum-card-body {
    flex: 1;
    min-width: 0;
}

.forum-card-title {
    margin: 0 0 4px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #171b24;
}

.forum-card-excerpt {
    margin: 0 0 8px;
    color: #5c6577;
    font-size: 0.9rem;
    line-height: 1.5;
}

.forum-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #8a94a6;
    flex-wrap: wrap;
}

.forum-author {
    font-weight: 700;
    color: #475467;
}

.forum-badge-teacher {
    background: #f3e8ff;
    color: var(--primary-dark);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 700;
}

.forum-dot {
    opacity: 0.6;
}

.forum-card-answers {
    flex-shrink: 0;
    text-align: center;
    min-width: 66px;
    padding: 8px;
    border-radius: 14px;
    background: #f5f6fb;
}

.forum-card-answers strong {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1;
}

.forum-card-answers span {
    font-size: 0.72rem;
    color: #8a94a6;
}

/* --- Etat vide --- */
.forum-empty {
    text-align: center;
    padding: 40px 20px;
    color: #8a94a6;
}

.forum-empty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* --- Detail d'une question --- */
.forum-detail-page {
    max-width: 900px;
}

.forum-breadcrumb a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
}

.forum-breadcrumb a:hover {
    text-decoration: underline;
}

.forum-question-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.forum-question-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #8a94a6;
    flex-wrap: wrap;
}

.forum-question-title {
    margin: 0 0 12px;
    font-size: 1.7rem;
    font-weight: 800;
    color: #171b24;
    line-height: 1.2;
}

.forum-question-content {
    color: #3f4859;
    line-height: 1.7;
    font-size: 1rem;
}

.forum-answers-title {
    margin: 4px 0 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: #171b24;
}

.forum-answers-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.forum-answer-card {
    display: flex;
    gap: 14px;
    padding: 18px;
    border: 1px solid #eceef5;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 20px rgba(33, 37, 41, 0.04);
}

.forum-answer-body {
    flex: 1;
    min-width: 0;
}

.forum-answer-content {
    margin-top: 6px;
    color: #3f4859;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* --- Dark mode forum --- */
body.dark-mode .forum-panel,
body.dark-mode .forum-card,
body.dark-mode .forum-answer-card {
    background: #1e2230;
    border-color: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
}

body.dark-mode .forum-card-title,
body.dark-mode .forum-question-title,
body.dark-mode .forum-answers-title,
body.dark-mode .forum-panel .panel-head h2 {
    color: #f3f4f6;
}

body.dark-mode .forum-card-excerpt,
body.dark-mode .forum-question-content,
body.dark-mode .forum-answer-content {
    color: #c3c9d5;
}

body.dark-mode .forum-field input,
body.dark-mode .forum-field textarea,
body.dark-mode .forum-reply-form textarea,
body.dark-mode .forum-search input {
    background: #12151f;
    border-color: rgba(255, 255, 255, 0.12);
    color: #e5e7eb;
}

body.dark-mode .forum-card-answers,
body.dark-mode .forum-search button {
    background: #2a2f40;
}

/* --- Responsive forum --- */
@media (max-width: 920px) {
    .forum-layout {
        grid-template-columns: 1fr;
    }
    .forum-ask-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .forum-page {
        padding: 36px 16px 50px;
    }
    .forum-hero {
        flex-direction: column;
        align-items: flex-start;
    }
    .forum-hero h1 {
        font-size: 1.7rem;
    }
    .forum-card {
        flex-wrap: wrap;
    }
    .forum-card-answers {
        min-width: 100%;
        display: flex;
        justify-content: center;
        gap: 6px;
        align-items: baseline;
    }
}

/* ========== Forum Comment Actions & Reactions ========== */

.comment-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.comment-reactions {
    display: flex;
    gap: 8px;
}

.reaction-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #e9ecef;
    background: white;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #6c757d;
}

.reaction-btn:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.reaction-btn.active.like-btn {
    background: #e7f5ff;
    border-color: #339af0;
    color: #339af0;
}

.reaction-btn.active.dislike-btn {
    background: #ffe3e3;
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.reaction-count {
    font-weight: 600;
    font-size: 0.85rem;
}

.comment-menu-wrapper {
    position: relative;
}

.comment-menu-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.comment-menu-btn:hover {
    background: #f8f9fa;
}

.comment-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    z-index: 100;
    overflow: hidden;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f8f9fa;
}

.dropdown-item.btn-delete-comment {
    color: #dc3545;
}

.dropdown-item.btn-block-comment {
    color: #fd7e14;
}

.dropdown-form {
    margin: 0;
    padding: 0;
}

.comment-edit-form {
    margin-top: 12px;
}

.comment-edit-form textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 10px;
}

.comment-edit-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.edit-form-actions {
    display: flex;
    gap: 8px;
}

.btn-save-edit {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-save-edit:hover {
    transform: translateY(-1px);
}

.btn-cancel-edit {
    padding: 8px 16px;
    background: #e9ecef;
    color: #495057;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cancel-edit:hover {
    background: #dee2e6;
}

.comment-blocked {
    opacity: 0.7;
    border-left: 3px solid #fd7e14;
}

.comment-hidden {
    opacity: 0.6;
    border-left: 3px solid #6c757d;
}

.comment-blocked-content,
.comment-hidden-content {
    font-style: italic;
    color: #6c757d;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.btn-show-hidden {
    margin-top: 8px;
    padding: 6px 12px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-show-hidden:hover {
    background: #495057;
}

.comment-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

.comment-status-badge.blocked {
    background: #fff3cd;
    color: #856404;
}

.comment-status-badge.hidden {
    background: #e2e3e5;
    color: #383d41;
}

.comment-edited {
    font-size: 0.8rem;
    color: #6c757d;
    font-style: italic;
}

/* Dark mode */
body.dark-mode .comment-actions {
    border-top-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .reaction-btn {
    background: #2d3348;
    border-color: #3d4459;
    color: #c3c9d5;
}

body.dark-mode .reaction-btn:hover {
    background: #3d4459;
}

body.dark-mode .reaction-btn.active.like-btn {
    background: rgba(51, 154, 240, 0.2);
    border-color: #339af0;
}

body.dark-mode .reaction-btn.active.dislike-btn {
    background: rgba(255, 107, 107, 0.2);
    border-color: #ff6b6b;
}

body.dark-mode .comment-dropdown-menu {
    background: #2d3348;
    border-color: #3d4459;
}

body.dark-mode .dropdown-item {
    color: #c3c9d5;
}

body.dark-mode .dropdown-item:hover {
    background: #3d4459;
}

body.dark-mode .comment-edit-form textarea {
    background: #2d3348;
    border-color: #3d4459;
    color: #f3f4f6;
}

body.dark-mode .comment-blocked-content,
body.dark-mode .comment-hidden-content {
    background: #2d3348;
    color: #c3c9d5;
}

/* ========== AI Assistant Pages ========== */

.ai-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
}

.ai-hero {
    text-align: center;
    margin-bottom: 40px;
}

.ai-hero-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.ai-hero-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 8px;
}

.ai-hero-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
}

.ai-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.ai-stat-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ai-stat-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.ai-stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.ai-stat-label {
    font-size: 0.9rem;
    color: #6c757d;
}

.ai-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.ai-feature-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
}

.ai-feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(255, 143, 171, 0.15);
}

.ai-feature-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.ai-feature-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 8px;
}

.ai-feature-desc {
    font-size: 0.95rem;
    color: #6c757d;
    margin-bottom: 16px;
    line-height: 1.5;
}

.ai-feature-btn {
    display: inline-block;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.ai-recent {
    margin-top: 40px;
}

.ai-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.ai-recent-list {
    display: grid;
    gap: 12px;
}

.ai-recent-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
}

.ai-recent-question {
    font-size: 0.95rem;
    color: #212529;
    margin-bottom: 8px;
}

.ai-recent-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: #6c757d;
}

.ai-recent-subject {
    background: #f3e8ff;
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* AI Chat Page */
.ai-chat-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.ai-chat-header {
    margin-bottom: 24px;
}

.ai-back-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 12px;
    font-weight: 500;
}

.ai-chat-container {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    overflow: hidden;
}

.ai-chat-messages {
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    padding: 24px;
}

.ai-chat-welcome {
    text-align: center;
    padding: 60px 20px;
}

.ai-welcome-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.ai-chat-welcome h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.ai-chat-welcome p {
    color: #6c757d;
    margin-bottom: 24px;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.ai-suggestion-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-suggestion-btn:hover {
    background: #f3e8ff;
    border-color: var(--primary);
}

.ai-message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.ai-message-avatar {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.ai-message-content {
    flex: 1;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 12px 16px;
}

.ai-message-ai .ai-message-content {
    background: #e7f5ff;
}

.ai-message-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #212529;
}

.ai-message-subject {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #6c757d;
}

.ai-chat-input-area {
    border-top: 1px solid #e9ecef;
    padding: 16px;
    background: #f8f9fa;
}

.ai-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.ai-subject-select {
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
}

.ai-chat-form textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.95rem;
    resize: none;
    font-family: inherit;
}

.ai-send-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.ai-send-btn:hover {
    transform: scale(1.05);
}

.ai-send-icon {
    color: white;
    font-size: 1.2rem;
}

.ai-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.ai-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* AI Generate Pages */
.ai-generate-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.ai-generate-header {
    margin-bottom: 24px;
}

.ai-generate-header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.ai-generate-header p {
    color: #6c757d;
}

.ai-generate-form-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
}

.ai-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.ai-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #495057;
}

.ai-form-group select,
.ai-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.95rem;
}

.ai-generate-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    transition: transform 0.2s;
}

.ai-generate-btn:hover {
    transform: translateY(-2px);
}

.ai-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-loading {
    text-align: center;
    padding: 40px;
}

.ai-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.ai-history {
    margin-top: 40px;
}

.ai-history-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.ai-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.ai-history-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.ai-history-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ai-history-subject {
    font-size: 0.8rem;
    color: var(--primary);
    background: #f3e8ff;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 8px;
}

.ai-history-topic {
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 8px;
}

.ai-history-date {
    font-size: 0.8rem;
    color: #6c757d;
}

/* QCM Result */
.ai-qcm-result,
.ai-exercises-result,
.ai-flashcards-result {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 32px;
}

.ai-qcm-question {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.ai-qcm-question-text {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.ai-qcm-options {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.ai-qcm-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-qcm-option:hover {
    border-color: var(--primary);
}

.ai-qcm-option.correct {
    background: #d3f9d8;
    border-color: #51cf66;
}

.ai-qcm-option.incorrect {
    background: #ffe3e3;
    border-color: #ff6b6b;
}

.ai-qcm-explanation {
    margin-top: 12px;
    padding: 12px;
    background: #e7f5ff;
    border-radius: 8px;
    font-size: 0.9rem;
}

.ai-qcm-check-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.ai-qcm-check-btn:hover {
    background: var(--primary-dark);
}

/* Exercises */
.ai-exercise-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.ai-exercise-card h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.ai-exercise-statement {
    margin-bottom: 12px;
    line-height: 1.6;
}

.ai-exercise-questions {
    margin-bottom: 12px;
}

.ai-exercise-questions ol {
    margin-left: 20px;
    margin-top: 8px;
}

.ai-toggle-solution-btn {
    background: #f3e8ff;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.ai-toggle-solution-btn:hover {
    background: var(--primary);
    color: white;
}

.ai-exercise-solution {
    margin-top: 12px;
    padding: 16px;
    background: #d3f9d8;
    border-radius: 8px;
    border-left: 3px solid #51cf66;
}

/* Flashcards */
.ai-flashcards-instructions {
    text-align: center;
    color: #6c757d;
    margin-bottom: 24px;
}

.ai-flashcards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.ai-flashcard {
    perspective: 1000px;
    height: 200px;
    cursor: pointer;
}

.ai-flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.ai-flashcard.flipped .ai-flashcard-inner {
    transform: rotateY(180deg);
}

.ai-flashcard-front,
.ai-flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.ai-flashcard-front {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.ai-flashcard-back {
    background: white;
    border: 2px solid var(--primary);
    transform: rotateY(180deg);
}

.ai-flashcard-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.ai-flashcard-recto,
.ai-flashcard-verso {
    font-size: 1rem;
    line-height: 1.5;
}

.ai-flashcard-hint {
    position: absolute;
    bottom: 12px;
    font-size: 0.75rem;
    opacity: 0.6;
}

/* Single Flashcard Viewer (AI Modal) */
#flashcard-viewer {
    text-align: center;
}
.flashcard {
    perspective: 1000px;
    height: 280px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 16px;
    cursor: pointer;
}
.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}
.flashcard .flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 1.15rem;
    line-height: 1.6;
}
.flashcard .flashcard-front {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.flashcard .flashcard-back {
    background: white;
    border: 3px solid var(--primary);
    color: #1e2230;
    transform: rotateY(180deg);
}
.flashcard-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}
.flashcard-nav button {
    background: rgba(255, 143, 171,.1);
    color: var(--primary);
    border: 2px solid rgba(255, 143, 171,.3);
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.flashcard-nav button:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-dark);
}
#card-counter {
    font-weight: 800;
    color: #64748b;
    font-size: 1rem;
}
.ai-error {
    background: #ffe3e3;
    color: #c92a2a;
    padding: 16px;
    border-radius: 8px;
    border-left: 3px solid #ff6b6b;
}

/* Dark mode */
body.dark-mode .ai-stat-card,
body.dark-mode .ai-feature-card,
body.dark-mode .ai-generate-form-card,
body.dark-mode .ai-chat-container,
body.dark-mode .ai-qcm-result,
body.dark-mode .ai-exercises-result,
body.dark-mode .ai-flashcards-result {
    background: #1e2230;
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .ai-hero-title,
body.dark-mode .ai-feature-title,
body.dark-mode .ai-history-topic {
    color: #f3f4f6;
}

body.dark-mode .ai-message-content {
    background: #2d3348;
}

body.dark-mode .ai-message-ai .ai-message-content {
    background: rgba(102, 126, 234, 0.2);
}

body.dark-mode .ai-form-group select,
body.dark-mode .ai-form-group input {
    background: #2d3348;
    border-color: #3d4459;
    color: #f3f4f6;
}

body.dark-mode .ai-qcm-option {
    background: #2d3348;
    border-color: #3d4459;
    color: #f3f4f6;
}

body.dark-mode .ai-flashcard-back {
    background: #1e2230;
}

/* Feature link */
.feature-link {
    display: inline-block;
    margin-top: 12px;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.feature-link:hover {
    color: var(--primary-dark);
}

/* --- Notification System --- */
.nav-notification-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #ffffff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    animation: pulseNotif 2s infinite;
}

@keyframes pulseNotif {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.notification-menu {
    position: absolute;
    top: 50px;
    right: 0;
    width: 320px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 143, 171, 0.18);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    max-height: 400px;
    animation: slideDownNotif 0.25s ease-out;
}

@keyframes slideDownNotif {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 10px 16px;
    border-bottom: 1px solid rgba(255, 143, 171, 0.08);
}

.notification-header span {
    font-weight: 800;
    font-size: 0.95rem;
    color: #1e1e24;
}

.notification-header button {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.2s;
}

.notification-header button:hover {
    background: rgba(255, 143, 171, 0.08);
}

.notification-list {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow-y: auto !important;
    max-height: 330px !important;
}

.notification-item {
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    color: inherit;
}

.notification-item:hover {
    background-color: rgba(255, 143, 171, 0.04);
}

.notification-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--primary-dark);
    flex-shrink: 0;
    border: 2px solid var(--primary);
}

.notification-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.notification-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notification-text {
    font-size: 0.88rem;
    color: #374151;
    line-height: 1.3;
}

.notification-time {
    font-size: 0.72rem;
    color: #9ca3af;
}

.notification-empty {
    padding: 24px 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 0.88rem;
}

/* Dark Mode support for notifications */
body.dark-mode .notification-menu {
    background: rgba(30, 34, 48, 0.95);
    border-color: rgba(255, 143, 171, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

body.dark-mode .notification-header span {
    color: #f3f4f6;
}

body.dark-mode .notification-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .notification-item {
    border-bottom-color: rgba(255, 255, 255, 0.04);
}

body.dark-mode .notification-item:hover {
    background-color: rgba(255, 143, 171, 0.1);
}

.notification-avatar img.notification-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

@media (max-width: 768px) {
    .notification-menu {
        position: fixed;
        top: 60px;
        left: 12px;
        right: 12px;
        width: calc(100% - 24px);
        max-width: none;
        z-index: 10000;
    }
}

body.dark-mode .notification-text {
    color: #d1d5db;
}

body.dark-mode .notification-badge {
    border-color: #1e2230;
}

/* ═══════════════════════════════════════════════════════════════
   BACHUB CONFIRM MODAL — Système de confirmation unifié
   ═══════════════════════════════════════════════════════════════ */

/* Overlay */
#bachub-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(7, 11, 22, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.22s ease;
    pointer-events: none;
}
#bachub-confirm-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* Modal box */
#bachub-confirm-box {
    background: #ffffff;
    border: 1px solid rgba(102, 126, 234, 0.18);
    border-radius: 22px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.22);
    transform: scale(0.93) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
    opacity: 0;
    overflow: hidden;
}
#bachub-confirm-overlay.visible #bachub-confirm-box {
    transform: scale(1) translateY(0);
    opacity: 1;
}
body.dark-mode #bachub-confirm-box {
    background: #1e2535;
    border-color: rgba(167, 139, 250, 0.22);
}

/* Accent bar top */
#bachub-confirm-box::before {
    content: '';
    display: block;
    height: 4px;
    background: var(--confirm-accent, linear-gradient(90deg, #ef4444, #f97316));
}
#bachub-confirm-box.type-delete::before {
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
}
#bachub-confirm-box.type-edit::before {
    background: linear-gradient(90deg, #667eea, #764ba2);
}
#bachub-confirm-box.type-block::before {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}
#bachub-confirm-box.type-info::before {
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
}

/* Body */
.bachub-confirm-body {
    padding: 28px 28px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
}

/* Icon circle */
.bachub-confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}
.type-delete .bachub-confirm-icon { background: rgba(255, 143, 171, 0.1); }
.type-edit   .bachub-confirm-icon { background: rgba(102, 126, 234, 0.1); }
.type-block  .bachub-confirm-icon { background: rgba(245, 158, 11, 0.1); }
.type-info   .bachub-confirm-icon { background: rgba(59, 130, 246, 0.1); }

/* Texts */
.bachub-confirm-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #171b24;
    margin: 0;
    line-height: 1.3;
}
body.dark-mode .bachub-confirm-title { color: #f8fafc; }

.bachub-confirm-message {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
    max-width: 320px;
}
body.dark-mode .bachub-confirm-message { color: #94a3b8; }

/* Footer buttons */
.bachub-confirm-footer {
    display: flex;
    gap: 10px;
    padding: 0 28px 24px;
}
.bachub-confirm-footer button {
    flex: 1;
    min-height: 44px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    border: none;
    transition: transform 0.12s, opacity 0.15s, box-shadow 0.15s;
}
.bachub-confirm-footer button:hover { transform: translateY(-1px); opacity: 0.92; }
.bachub-confirm-footer button:active { transform: translateY(0); }

/* Cancel button */
#bachub-confirm-cancel {
    background: transparent;
    border: 1.5px solid rgba(102, 126, 234, 0.25) !important;
    color: #667eea;
}
body.dark-mode #bachub-confirm-cancel {
    border-color: rgba(167, 139, 250, 0.3) !important;
    color: var(--primary-light);
}
#bachub-confirm-cancel:hover { background: rgba(102, 126, 234, 0.07); }

/* Confirm button — adapts to type */
#bachub-confirm-ok {
    color: #fff;
}
.type-delete #bachub-confirm-ok { background: linear-gradient(135deg, var(--primary-light), var(--primary)); box-shadow: 0 8px 20px rgba(255, 143, 171, 0.28); }
.type-edit   #bachub-confirm-ok { background: linear-gradient(135deg, #667eea, #764ba2); box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3); }
.type-block  #bachub-confirm-ok { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3); }
.type-info   #bachub-confirm-ok { background: linear-gradient(135deg, #3b82f6, #06b6d4); box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3); }

/* ═══════════════════════════════════════════════════════════════
   BACHUB TOAST — Notifications professionnelles
   ═══════════════════════════════════════════════════════════════ */

#bachub-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 400px;
}
@media (max-width: 480px) {
    #bachub-toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        max-width: 100%;
    }
}

.bachub-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid rgba(255, 143, 171, 0.15);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(255, 143, 171, 0.08);
    font-size: 0.92rem;
    font-weight: 600;
    color: #1e293b;
    pointer-events: all;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
    cursor: pointer;
}
.bachub-toast.show {
    transform: translateX(0);
    opacity: 1;
}
.bachub-toast.hiding {
    transform: translateX(120%);
    opacity: 0;
}
body.dark-mode .bachub-toast {
    background: #1e2535;
    border-color: rgba(167, 139, 250, 0.2);
    color: #f1f5f9;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.bachub-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.bachub-toast.toast-success .bachub-toast-icon { background: rgba(16, 185, 129, 0.12); }
.bachub-toast.toast-success { border-left: 4px solid #10b981; }

.bachub-toast.toast-error .bachub-toast-icon { background: rgba(239, 68, 68, 0.12); }
.bachub-toast.toast-error { border-left: 4px solid #ef4444; }

.bachub-toast.toast-warning .bachub-toast-icon { background: rgba(245, 158, 11, 0.12); }
.bachub-toast.toast-warning { border-left: 4px solid #f59e0b; }

.bachub-toast.toast-info .bachub-toast-icon { background: rgba(255, 143, 171, 0.12); }
.bachub-toast.toast-info { border-left: 4px solid var(--primary); }

/* ═══════════════════════════════════════════════════════════════
   BOUTONS UNIFIÉS MAUVE — Style global
   ═══════════════════════════════════════════════════════════════ */

/* Bouton mauve standard */
.bachub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(255, 143, 171, 0.25);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    text-decoration: none;
    line-height: 1.4;
}
.bachub-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(255, 143, 171, 0.35);
    filter: brightness(1.08);
}
.bachub-btn:active {
    transform: translateY(0);
}

/* Bouton mauve clair (secondaire) */
.bachub-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 20px;
    background: transparent;
    color: var(--primary-dark);
    border: 1.5px solid rgba(255, 143, 171, 0.35);
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, border-color 0.2s;
}
.bachub-btn-outline:hover {
    background: rgba(255, 143, 171, 0.08);
    border-color: var(--primary);
    transform: translateY(-1px);
}
body.dark-mode .bachub-btn-outline {
    color: var(--primary-light);
    border-color: rgba(167, 139, 250, 0.35);
}
body.dark-mode .bachub-btn-outline:hover {
    background: rgba(167, 139, 250, 0.1);
}

/* Bouton danger (suppression) */
.bachub-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.bachub-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(239, 68, 68, 0.35);
    filter: brightness(1.08);
}
.bachub-btn-danger:active { transform: translateY(0); }

/* ==========================================================================
   UNIFIED DESIGN SYSTEM FOR ALL MESSAGES ACROSS ALL SECTIONS & ENTITIES
   (Live Study, BacHub Chat, AI Assistant, Private Messages, Forum & Comments)
   ========================================================================== */

.chat-msg,
.f-chat-msg,
.live-chat-msg,
.room-msg,
.friend-msg,
.private-msg,
.msg-bubble,
.direct-msg,
.ai-chat-msg,
.ai-bubble,
.forum-comment,
.comment-bubble,
.post-comment {
    max-width: 85%;
    padding: 12px 18px;
    font-size: 0.92rem;
    line-height: 1.55;
    word-break: break-word;
    letter-spacing: -0.01em;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

/* User Sent Messages (Violet Gradient Premium) */
.chat-msg.user,
.chat-msg.mine,
.f-chat-msg.user,
.f-chat-msg.mine,
.live-chat-msg.user,
.live-chat-msg.mine,
.room-msg.user,
.room-msg.mine,
.friend-msg.user,
.friend-msg.mine,
.private-msg.user,
.private-msg.mine,
.msg-bubble.user,
.msg-bubble.mine,
.direct-msg.user,
.ai-chat-msg.user,
.ai-user-bubble,
.forum-comment.user {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    color: #ffffff !important;
    border-radius: 18px 18px 4px 18px !important;
    align-self: flex-end !important;
    margin-left: auto !important;
    border: none !important;
    box-shadow: 0 6px 18px rgba(232, 93, 122, 0.3) !important;
}

/* Received / Assistant Messages (Sleek Clean Card) */
.chat-msg.assistant,
.chat-msg.other,
.f-chat-msg.assistant,
.f-chat-msg.other,
.live-chat-msg.other,
.room-msg.other,
.friend-msg.other,
.private-msg.other,
.msg-bubble.other,
.direct-msg.other,
.ai-chat-msg.assistant,
.ai-bubble.assistant,
.forum-comment.other {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid rgba(255, 143, 171, 0.18) !important;
    border-radius: 18px 18px 18px 4px !important;
    align-self: flex-start !important;
    margin-right: auto !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
}

/* Dark Mode Support for Received / Assistant Messages */
body.dark-mode .chat-msg.assistant,
body.dark-mode .chat-msg.other,
body.dark-mode .f-chat-msg.assistant,
body.dark-mode .f-chat-msg.other,
body.dark-mode .live-chat-msg.other,
body.dark-mode .room-msg.other,
body.dark-mode .friend-msg.other,
body.dark-mode .private-msg.other,
body.dark-mode .msg-bubble.other,
body.dark-mode .direct-msg.other,
body.dark-mode .ai-chat-msg.assistant,
body.dark-mode .ai-bubble.assistant,
body.dark-mode .forum-comment.other {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: rgba(167, 139, 250, 0.22) !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25) !important;
}

/* System Messages & Notices */
.chat-msg.system,
.f-chat-msg.system,
.room-msg.system {
    background: rgba(255, 143, 171, 0.08) !important;
    color: var(--primary-dark) !important;
    border: 1px dashed rgba(255, 143, 171, 0.3) !important;
    border-radius: 14px !important;
    text-align: center !important;
    margin: 8px auto !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    padding: 8px 16px !important;
}
body.dark-mode .chat-msg.system,
body.dark-mode .f-chat-msg.system,
body.dark-mode .room-msg.system {
    background: rgba(167, 139, 250, 0.1) !important;
    color: #c4b5fd !important;
    border-color: rgba(167, 139, 250, 0.35) !important;
}

/* ============================================================
   RESPONSIVE DESIGN SYSTEM (MOBILE OVERRIDES)
   ============================================================ */
@media (max-width: 768px) {
    /* Global Body and Spacing */
    body {
        padding: 12px !important;
    }
    body.main-page {
        padding: 0 !important;
    }
    
    /* Auth Container Responsive */
    .auth-container {
        flex-direction: column !important;
        max-height: none !important;
        height: auto !important;
        min-height: auto !important;
        border-radius: 16px !important;
    }
    .auth-welcome {
        flex: 1 !important;
        padding: 30px 20px !important;
    }
    .auth-welcome .illustration {
        font-size: 3.5rem !important;
        margin-bottom: 10px !important;
    }
    .auth-form-section {
        flex: 1 !important;
        padding: 30px 20px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Layout Containers & Headers */
    .dashboard-container, .admin-page, .main-page {
        padding: 16px 12px !important;
    }
    .dashboard-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }
    .dashboard-header h1 {
        font-size: 1.7rem !important;
    }
    
    /* Grids & Cards fallback to single column */
    .dash-grid, .dashboard-grid, .widgets-grid, .objectives-grid {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }
    
    .platform-manifest-box {
        display: flex !important;
        flex-direction: column !important;
        padding: 20px !important;
        text-align: center !important;
        align-items: center !important;
    }
    
    /* Quick Stats banner for Admin */
    .admin-quick-stats-banner {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: center !important;
        padding: 20px !important;
        border-radius: 20px !important;
    }
    .admin-quick-stats-banner a {
        text-align: center !important;
    }
    
    /* General cards paddings */
    .dash-card, .widget-card, .stat-card, .obj-card {
        padding: 20px !important;
    }
    
    /* Form fields and buttons */
    input, select, textarea, button {
        font-size: 16px !important; /* Prevents auto-zoom on iOS */
    }
    
    /* Admin details table */
    .admin-table th, .admin-table td {
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
    }
}

/* Chat Themes */
.chat-workspace[data-theme="blue"] .chat-message-bubble-wrapper.outgoing .chat-bubble {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    box-shadow: 0 6px 18px rgba(29, 78, 216, 0.3) !important;
}

.chat-workspace[data-theme="red"] .chat-message-bubble-wrapper.outgoing .chat-bubble {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
    box-shadow: 0 6px 18px rgba(185, 28, 28, 0.3) !important;
}

.chat-workspace[data-theme="green"] .chat-message-bubble-wrapper.outgoing .chat-bubble {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%) !important;
    box-shadow: 0 6px 18px rgba(4, 120, 87, 0.3) !important;
}

.chat-workspace[data-theme="pink"] .chat-message-bubble-wrapper.outgoing .chat-bubble {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%) !important;
    box-shadow: 0 6px 18px rgba(190, 24, 93, 0.3) !important;
}

.chat-workspace[data-theme="dark"] .chat-message-bubble-wrapper.outgoing .chat-bubble {
    background: linear-gradient(135deg, #334155 0%, #0f172a 100%) !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.3) !important;
}

/* Thèmes Cartoon */
.chat-workspace[data-theme="cartoon-yellow"] .chat-message-bubble-wrapper.outgoing .chat-bubble {
    background: #fcd34d !important;
    color: #78350f !important;
    border: 2px solid #d97706 !important;
    border-radius: 20px 20px 0 20px !important;
    box-shadow: 4px 4px 0px #b45309 !important;
    font-weight: 700 !important;
}

.chat-workspace[data-theme="cartoon-cyan"] .chat-message-bubble-wrapper.outgoing .chat-bubble {
    background: #67e8f9 !important;
    color: #164e63 !important;
    border: 2px solid #0891b2 !important;
    border-radius: 20px 20px 0 20px !important;
    box-shadow: 4px 4px 0px #0e7490 !important;
    font-weight: 700 !important;
}

.chat-workspace[data-theme="cartoon-comic"] .chat-message-bubble-wrapper.outgoing .chat-bubble {
    background: #f87171 !important;
    color: #fff !important;
    border: 3px solid #000 !important;
    border-radius: 10px !important;
    box-shadow: 4px 4px 0px #000 !important;
    font-family: 'Comic Sans MS', cursive, sans-serif !important;
    letter-spacing: 0.5px !important;
}


/* ==========================================
   CUTE KOREAN PASTEL & MODERN EDUCATION THEME
   ========================================== */

/* Typography & Base Override */
body, button, input, select, textarea, div, span, p, a, h1, h2, h3, h4, h5, h6 {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Global inputs, buttons, cards adjustments */
.btn, 
.btn-primary, 
.btn-secondary, 
button, 
input[type="submit"], 
input[type="button"], 
.tab-btn,
.nav-dropdown-trigger {
    border-radius: 16px !important;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.btn:hover, 
.btn-primary:hover, 
.btn-secondary:hover, 
button:hover, 
.tab-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.25) !important;
}

.btn:active, 
.btn-primary:active, 
.btn-secondary:active, 
button:active {
    transform: scale(0.97) translateY(0) !important;
}

/* Specific inputs focus styling */
input[type="text"], 
input[type="email"], 
input[type="password"], 
textarea, 
select {
    border-radius: 16px !important;
    border: 1.5px solid rgba(155, 126, 189, 0.25) !important;
    background-color: var(--bg-card, #ffffff) !important;
    color: var(--text-dark, #1e293b) !important;
    transition: all 0.25s ease !important;
    padding: 10px 14px !important;
}

body.dark-mode input[type="text"], 
body.dark-mode input[type="email"], 
body.dark-mode input[type="password"], 
body.dark-mode textarea, 
body.dark-mode select {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: rgba(167, 139, 250, 0.25) !important;
}

body.dark-mode select option {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

input[type="text"]:focus, 
input[type="email"]:focus, 
input[type="password"]:focus, 
textarea:focus, 
select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2) !important;
    outline: none !important;
}

/* Cards & containers rounding & shadows */
.auth-container, 
.zen-panel, 
.zen-circle-panel, 
.card, 
.dashboard-card, 
.forum-card, 
.forum-item, 
.classement-card, 
.stat-card, 
.tool-card,
.cours-card,
.examen-card,
.revision-card {
    border-radius: 24px !important;
    border: 1px solid rgba(155, 126, 189, 0.12) !important;
    box-shadow: 0 8px 25px rgba(74, 62, 61, 0.05) !important;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease !important;
}

.auth-container:hover, 
.zen-panel:hover, 
.zen-circle-panel:hover, 
.card:hover, 
.dashboard-card:hover, 
.forum-card:hover, 
.tool-card:hover,
.cours-card:hover,
.examen-card:hover,
.revision-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 30px rgba(74, 62, 61, 0.08) !important;
}

/* Emojis Badges and Styles */
.nav-dd-icon, 
.zen-method-icon, 
.badge-icon, 
.emoji-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    background: var(--bg-soft-pink) !important;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.15) !important;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.nav-dd-icon:hover, 
.zen-method-icon:hover, 
.emoji-badge:hover {
    transform: scale(1.15) rotate(5deg) !important;
}

/* Navigation items active state */
.site-nav a.active, 
.nav-dd-item.dd-active {
    background-color: var(--bg-soft-pink) !important;
    color: var(--primary-dark) !important;
    border-radius: 12px !important;
}

/* Ornaments & Background decoration (subtle clouds & stars) */
body.main-page {
    background-image: radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.03) 0%, transparent 20%),
                      radial-gradient(circle at 90% 80%, rgba(189, 224, 254, 0.04) 0%, transparent 25%) !important;
}

/* Cute Fluent Emojis styles */
.cute-fluent-emoji {
    width: 28px !important;
    height: 28px !important;
    object-fit: contain !important;
    vertical-align: middle !important;
    display: inline-block !important;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.cute-fluent-emoji-nav-trigger {
    width: 20px !important;
    height: 20px !important;
    object-fit: contain !important;
    vertical-align: middle !important;
    display: inline-block !important;
    margin-right: 6px !important;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.cute-fluent-emoji:hover, .cute-fluent-emoji-nav-trigger:hover {
    transform: scale(1.3) rotate(8deg) !important;
}

.nav-dd-icon {
    padding: 0 !important;
    background: var(--bg-soft-pink) !important;
    border-radius: 50% !important;
    overflow: hidden !important;
}

/* ═══════════════════════════════════════════════════════════════
   🌸 CUTE KOREAN AESTHETIC OVERRIDE 🌸
   Style cute façon coréenne - palette mauve conservée
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Bagel+Fat+One&display=swap');

* {
    font-family: 'Quicksand', 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

h1, h2, h3, h4, h5, h6,
.brand-lockup span,
nav .logo,
.hd-stat-number,
.hd-section-title,
.btn-primary,
.btn-connect,
.nav-link,
.nav-dropdown-trigger {
    font-family: 'Quicksand', 'Nunito', sans-serif !important;
    letter-spacing: -0.01em !important;
}

/* ── Background Blanc ── */
body.main-page {
    background-color: #ffffff !important;
    background: #ffffff !important;
    background-image: none !important;
}

.main-wrapper,
.dashboard-container {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
}

body.dark-mode.main-page {
    background-color: #0f172a !important;
    background: #0f172a !important;
    background-image: none !important;
}

body.dark-mode .main-wrapper,
body.dark-mode .dashboard-container {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
}

/* ── Ultra rounded corners partout 🫧 ── */
.auth-container,
.auth-form-section h2,
.feature-card,
.hd-stat-card,
.hd-card,
.nav-dd-menu,
.nav-dropdown-menu,
.bachub-chat-toggle,
.bachub-chat-panel,
.chat-panel-header,
.chat-close,
.chat-message,
#bachub-confirm-box,
.notification-menu,
.mb-sheet-content,
.mb-grid-item,
.floating-stat-card,
.visitor-hero,
.btn-primary-visitor,
.btn-secondary-visitor,
.update-card-hover {
    border-radius: 26px !important;
}

header,
.site-header,
nav,
.site-nav,
.nav-menu,
.brand-lockup,
.nav-logo,
.nav-tool-btn,
.btn-connect,
.btn-primary,
.tab-btn,
.tab-btn.active,
.role-option,
.form-group input,
.form-group select,
.hd-hero-badge,
.hd-tool-chip,
.hd-motivation-card,
.hd-motivation-icon,
.hd-card-icon,
.hd-stat-icon,
.hd-hero-orb,
.mb-sheet-close,
.nav-dd-icon,
.visitor-badge,
.auth-tabs,
.success, .error {
    border-radius: 18px !important;
}

.nav-link,
.nav-dropdown-trigger {
    border-radius: 14px !important;
}

/* ── Ombres douces façon "nuage" avec teinte mauve/rose ── */
.auth-container,
.feature-card,
.hd-stat-card,
.hd-card,
.nav-dropdown-menu,
.bachub-chat-panel,
#bachub-confirm-box,
.notification-menu,
.floating-stat-card,
.visitor-hero,
.update-card-hover {
    box-shadow:
        0 10px 30px rgba(139, 92, 246, 0.08),
        0 4px 14px rgba(255, 143, 171, 0.08),
        0 2px 4px rgba(139, 92, 246, 0.04) !important;
}

header,
.site-header,
nav,
.site-nav,
.nav-menu,
.brand-lockup,
.nav-logo {
    box-shadow:
        0 8px 28px rgba(139, 92, 246, 0.06),
        0 2px 10px rgba(255, 143, 171, 0.05) !important;
}

.btn-primary,
.btn-connect,
.bachub-chat-toggle,
.btn-primary-visitor {
    box-shadow:
        0 8px 22px rgba(139, 92, 246, 0.28),
        0 4px 10px rgba(255, 143, 171, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
}

.btn-primary:hover,
.btn-connect:hover,
.bachub-chat-toggle:hover,
.btn-primary-visitor:hover {
    box-shadow:
        0 14px 30px rgba(139, 92, 246, 0.36),
        0 6px 14px rgba(255, 143, 171, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

/* ── Cards "puff" avec bordure pointillée subtile au survol ── */
.feature-card,
.hd-stat-card,
.hd-card,
.mb-grid-item,
.nav-dd-item,
.role-option {
    position: relative;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.feature-card:hover,
.hd-stat-card:hover,
.hd-card:hover,
.mb-grid-item:hover {
    transform: translateY(-5px) scale(1.015) !important;
    box-shadow:
        0 20px 40px rgba(139, 92, 246, 0.14),
        0 10px 20px rgba(255, 143, 171, 0.10) !important;
}

/* ── Effets hover sur les liens nav : petit "squish" bounce ── */
.nav-link,
.nav-dropdown-trigger,
.nav-tool-btn {
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.nav-link:hover,
.nav-dropdown-trigger:hover,
.nav-tool-btn:hover {
    transform: translateY(-2px) scale(1.03) !important;
}

.nav-link:active,
.nav-dropdown-trigger:active,
.nav-tool-btn:active {
    transform: translateY(0) scale(0.98) !important;
}

/* ── Buttons : effet "cushion" avec wobble au survol ── */
.btn-primary,
.btn-connect,
.bachub-chat-toggle,
.btn-primary-visitor,
.btn-secondary-visitor {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover,
.btn-connect:hover,
.bachub-chat-toggle:hover,
.btn-primary-visitor:hover {
    transform: translateY(-3px) scale(1.02) !important;
    animation: kf-pulse-wobble 0.8s ease-in-out;
}

@keyframes kf-pulse-wobble {
    0%, 100% { transform: translateY(-3px) scale(1.02) rotate(0); }
    25% { transform: translateY(-3px) scale(1.02) rotate(-0.8deg); }
    75% { transform: translateY(-3px) scale(1.02) rotate(0.8deg); }
}

/* ── Inputs : style pill + focus brillant façon k-pop ── */
.form-group input,
.form-group select,
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    border: 1.5px solid rgba(139, 92, 246, 0.2) !important;
    background: var(--bg-card, #ffffff) !important;
    color: var(--text-dark, #1e293b) !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    box-shadow: inset 0 2px 6px rgba(139, 92, 246, 0.03) !important;
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode select,
body.dark-mode textarea {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: rgba(167, 139, 250, 0.25) !important;
}

body.dark-mode select option {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

.form-group input:focus,
.form-group select:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: rgba(139, 92, 246, 0.6) !important;
    box-shadow:
        0 0 0 5px rgba(139, 92, 246, 0.18),
        0 0 20px rgba(255, 143, 171, 0.12),
        inset 0 2px 6px rgba(139, 92, 246, 0.04) !important;
    transform: scale(1.01);
}

/* ── Badges et chips : forme nuage + déco cœur ── */
.hd-hero-badge,
.visitor-badge,
.hd-tool-chip {
    position: relative !important;
    border: 1.5px solid rgba(139, 92, 246, 0.18) !important;
    background: linear-gradient(135deg, rgba(255, 240, 245, 0.9) 0%, rgba(240, 230, 255, 0.9) 100%) !important;
}

.hd-hero-badge::after,
.visitor-badge::after {
    content: none !important;
}

/* ── Titres de sections élégants et épurés ── */
.hd-section-title {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.hd-section-title::before,
.hd-section-title::after {
    content: none !important;
}

@keyframes kf-twinkle {
    0%, 100% { opacity: 0.7; transform: scale(1) rotate(0); }
    50% { opacity: 1; transform: scale(1.2) rotate(12deg); }
}

/* ── Hero orb : fait "squish" comme du mochi 🍡 ── */
.hd-hero-orb {
    animation: kf-mochi-float 5s ease-in-out infinite !important;
    border: 2px dashed rgba(139, 92, 246, 0.15) !important;
}

@keyframes kf-mochi-float {
    0%, 100% { transform: translateY(0) scaleX(1) scaleY(1); }
    25% { transform: translateY(-12px) scaleX(1.04) scaleY(0.96); }
    50% { transform: translateY(0) scaleX(0.98) scaleY(1.02); }
    75% { transform: translateY(6px) scaleX(1.02) scaleY(0.98); }
}

/* ── Icones/emojis dans les cards : animation bounce gentille ── */
.feature-icon,
.hd-card-icon,
.hd-stat-icon,
.nav-dd-icon,
.brand-lockup .nav-logo,
.chat-toggle-icon {
    animation: kf-soft-bounce 4s ease-in-out infinite;
}

@keyframes kf-soft-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.feature-card:hover .feature-icon,
.hd-card:hover .hd-card-icon,
.hd-stat-card:hover .hd-stat-icon {
    animation: kf-happy-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes kf-happy-pop {
    0% { transform: scale(1) rotate(0); }
    40% { transform: scale(1.25) rotate(-12deg); }
    70% { transform: scale(0.95) rotate(6deg); }
    100% { transform: scale(1) rotate(0); }
}

/* ── Notification badge : petit cœur battant 💗 ── */
.notification-badge {
    border-radius: 12px !important;
    min-width: 20px !important;
    padding: 0 6px !important;
    font-weight: 800 !important;
    font-size: 0.65rem !important;
    animation: kf-heartbeat 1.6s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3) !important;
}

@keyframes kf-heartbeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.18); }
    30% { transform: scale(1); }
    45% { transform: scale(1.12); }
}

/* ── Chat panel bulle : façon messager coréenne ── */
.chat-message.bot {
    border-radius: 6px 18px 18px 18px !important;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.08);
}

.chat-message.user {
    border-radius: 18px 6px 18px 18px !important;
    box-shadow: 0 4px 14px rgba(255, 143, 171, 0.15);
}

/* ── Motivation card : ajouter petits nuages décoratifs ── */
.hd-motivation-card {
    position: relative;
    overflow: hidden;
}

.hd-motivation-card::before {
    content: '☁️';
    position: absolute;
    top: 8px;
    right: 16px;
    font-size: 1.4rem;
    opacity: 0.35;
    animation: kf-cloud-drift 12s linear infinite;
}

.hd-motivation-card::after {
    content: '☁️';
    position: absolute;
    bottom: 10px;
    right: 60px;
    font-size: 0.9rem;
    opacity: 0.25;
    animation: kf-cloud-drift 18s linear infinite reverse;
}

@keyframes kf-cloud-drift {
    0% { transform: translateX(-20px); }
    100% { transform: translateX(20px); }
}

/* ── Auth page : ajouter fleurs 🌷 décoratives ── */
.auth-container {
    position: relative;
    overflow: hidden;
}

.auth-welcome::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, transparent 70%);
    border-radius: 50%;
}

.auth-welcome::after {
    content: '🌷🌸🌼';
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4rem;
    letter-spacing: 8px;
    opacity: 0.9;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

.auth-welcome .illustration {
    animation: kf-mascot-bounce 3.5s ease-in-out infinite;
    filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.2));
}

@keyframes kf-mascot-bounce {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-14px) rotate(3deg); }
}

/* ── Auth tabs : façon sticker ── */
.auth-tabs {
    background: linear-gradient(135deg, rgba(255, 240, 245, 0.6) 0%, rgba(240, 230, 255, 0.6) 100%) !important;
    border: 1.5px solid rgba(139, 92, 246, 0.12) !important;
    padding: 6px !important;
    gap: 6px !important;
}

.tab-btn.active {
    box-shadow:
        0 4px 14px rgba(139, 92, 246, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

/* ── Role selector cards : "polaroid" mignon ── */
.role-option {
    border: 2px dashed rgba(139, 92, 246, 0.18) !important;
    background: linear-gradient(180deg, #ffffff 0%, rgba(255, 248, 250, 0.6) 100%) !important;
}

.role-option:hover {
    border-style: solid !important;
    border-color: rgba(139, 92, 246, 0.35) !important;
    transform: translateY(-4px) rotate(-1deg) !important;
}

.role-option.selected {
    border: 2.5px solid rgba(139, 92, 246, 0.5) !important;
    background: linear-gradient(135deg, rgba(255, 240, 245, 0.9) 0%, rgba(240, 230, 255, 0.9) 100%) !important;
    transform: translateY(-2px) scale(1.02) !important;
}

.role-option.selected .role-icon {
    animation: kf-happy-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Brand lockup : logo avec halo brillant ── */
.brand-lockup {
    position: relative;
}

.brand-lockup::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.0), rgba(139, 92, 246, 0.18), rgba(255, 182, 193, 0.0));
    border-radius: 22px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.brand-lockup:hover::before {
    opacity: 1;
    animation: kf-shimmer-rotate 3s linear infinite;
}

@keyframes kf-shimmer-rotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(30deg); }
}

/* ── Success/Error messages : bulle avec sticker ── */
.success, .error {
    position: relative;
    border: 1.5px dashed rgba(139, 92, 246, 0.25) !important;
    background: linear-gradient(135deg, rgba(255, 248, 250, 0.95) 0%, rgba(248, 243, 255, 0.95) 100%) !important;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.08) !important;
}

.success::before {
    content: '💜' !important;
    filter: drop-shadow(0 2px 4px rgba(139, 92, 246, 0.2));
}

.error::before {
    content: '🫧' !important;
    filter: drop-shadow(0 2px 4px rgba(255, 143, 171, 0.2));
}

/* ── Visitor hero floating cards : encore plus cute ── */
.floating-stat-card {
    animation: kf-float-card 6s ease-in-out infinite;
}

.floating-stat-card:nth-child(2) {
    animation-delay: -2s;
}

.floating-stat-card:nth-child(3) {
    animation-delay: -4s;
}

@keyframes kf-float-card {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-10px) rotate(1.5deg); }
}

.center-mascot {
    animation: kf-mascot-idle 4s ease-in-out infinite !important;
}

@keyframes kf-mascot-idle {
    0%, 100% { transform: translateY(0) scale(1); }
    25% { transform: translateY(-8px) scale(1.04) rotate(-4deg); }
    75% { transform: translateY(4px) scale(0.98) rotate(4deg); }
}

/* ── Mobile bottom sheet : arrondi extrême + grip bar ── */
.mb-sheet-content::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 5px;
    background: rgba(139, 92, 246, 0.2);
    border-radius: 10px;
}

.mb-sheet-header {
    padding-top: 20px !important;
    border-bottom: 2px dashed rgba(139, 92, 246, 0.12) !important;
}

/* ── Hover sur les grid items mobile : tilt léger ── */
.mb-grid-item {
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.mb-grid-item:hover {
    transform: translateY(-4px) rotate(-1deg) scale(1.03) !important;
    background: linear-gradient(135deg, rgba(255, 240, 245, 0.85) 0%, rgba(240, 230, 255, 0.85) 100%) !important;
}

.mb-grid-icon {
    transition: transform 0.3s ease !important;
}

.mb-grid-item:hover .mb-grid-icon {
    transform: scale(1.2) rotate(-8deg);
}

/* ── Bachub confirm modal : professional clean dialog ── */
#bachub-confirm-box {
    position: relative;
    overflow: hidden;
}

#bachub-confirm-box::after {
    display: none !important;
    content: none !important;
}

@keyframes kf-sticker-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0) rotate(-5deg); }
    50% { transform: translateX(-50%) translateY(-6px) rotate(5deg); }
}

.bachub-confirm-body {
    padding-top: 34px !important;
}

/* ── Notification menu : bulle avec petit triangle "stick" ── */
.notification-menu {
    position: relative;
}

.notification-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 22px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-top: 1px solid rgba(139, 92, 246, 0.14);
    border-left: 1px solid rgba(139, 92, 246, 0.14);
    transform: rotate(45deg);
    border-radius: 3px;
}

.notification-header {
    border-bottom: 2px dashed rgba(139, 92, 246, 0.12) !important;
}

.notification-item {
    border-radius: 14px !important;
    margin: 6px 8px !important;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.notification-item:hover {
    transform: translateX(4px) scale(1.01);
    background: linear-gradient(135deg, rgba(255, 240, 245, 0.6) 0%, rgba(240, 230, 255, 0.6) 100%) !important;
}

/* ── Nav dropdown items : sticker look avec ombre interne ── */
.nav-dd-item {
    position: relative;
}

.nav-dd-item::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    opacity: 0;
    transition: all 0.25s ease;
    font-size: 0.7rem;
}

.nav-dd-item:hover::after {
    content: ' ›';
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    color: var(--primary);
    font-weight: 900;
}

/* ── Scrollbar : style mignon pastel ── */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(139, 92, 246, 0.04);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(192, 132, 252, 0.5) 0%, rgba(139, 92, 246, 0.5) 100%);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(192, 132, 252, 0.7) 0%, rgba(139, 92, 246, 0.7) 100%);
    background-clip: padding-box;
    border: 2px solid transparent;
}

/* ── Selection de texte : couleur mauve cute ── */
::selection {
    background: rgba(192, 132, 252, 0.35);
    color: var(--primary-dark);
}

::-moz-selection {
    background: rgba(192, 132, 252, 0.35);
    color: var(--primary-dark);
}

/* ── Effet de "peluche" sur les cards au toucher (mobile) ── */
@media (hover: none) {
    .feature-card:active,
    .hd-card:active,
    .hd-stat-card:active,
    .mb-grid-item:active {
        transform: scale(0.97) !important;
    }
}

/* ── Responsive tweaks : réduire les animations sur écrans petits ── */
@media (max-width: 768px) {
    .hd-hero-text h1::before,
    .hd-hero-text h1::after {
        display: none;
    }

    body.main-page {
        background-size: auto, auto, auto, 22px 22px, 36px 36px;
}

/* ── Réduire animation si utilisateur préfère ── */
/* ── Message Notification Popup Toast & Real-Time Badges ── */
#bachub-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.incoming-message-popup-card {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(139, 92, 246, 0.25);
    border-radius: 20px;
    padding: 12px 18px;
    box-shadow: 0 14px 35px rgba(124, 58, 237, 0.18), 0 4px 12px rgba(0, 0, 0, 0.06);
    max-width: 380px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: slideInMsgToast 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.dark-mode .incoming-message-popup-card {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(168, 85, 247, 0.35);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(139, 92, 246, 0.2);
}

.incoming-message-popup-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 18px 42px rgba(124, 58, 237, 0.28);
    border-color: #8b5cf6;
}

.incoming-message-popup-card.fade-out {
    opacity: 0;
    transform: translateY(-15px) scale(0.95);
    transition: all 0.35s ease;
}

.incoming-msg-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.incoming-msg-avatar-img,
.incoming-msg-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: #ffffff;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.3);
}

.incoming-msg-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
}
body.dark-mode .incoming-msg-online-dot {
    border-color: #0f172a;
}

.incoming-msg-content-wrap {
    flex: 1;
    min-width: 0;
}

.incoming-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.incoming-msg-sender {
    font-size: 0.9rem;
    font-weight: 800;
    color: #1e1b4b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.dark-mode .incoming-msg-sender {
    color: #f8fafc;
}

.incoming-msg-time {
    font-size: 0.72rem;
    color: #8b5cf6;
    font-weight: 700;
    flex-shrink: 0;
}

.incoming-msg-snippet {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
body.dark-mode .incoming-msg-snippet {
    color: #cbd5e1;
}

.incoming-msg-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f3e8ff;
    color: #7c3aed;
    font-size: 0.85rem;
    font-weight: 900;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
}
body.dark-mode .incoming-msg-action {
    background: rgba(139, 92, 246, 0.2);
    color: #c084fc;
}
.incoming-message-popup-card:hover .incoming-msg-action {
    background: #7c3aed;
    color: #ffffff;
    transform: translateX(2px);
}

@keyframes slideInMsgToast {
    from {
        opacity: 0;
        transform: translateY(-25px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.clay-badge-dot {
    animation: badgePulseEffect 2s infinite ease-in-out;
}

@keyframes badgePulseEffect {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7);
    }
    50% {
        transform: scale(1.18);
        box-shadow: 0 0 0 6px rgba(244, 63, 94, 0);
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   GLOBAL MOBILE & PHONE FRIENDLY ERGONOMICS (< 768px & < 480px)
   ══════════════════════════════════════════════════════════════════════════ */
html, body {
    overflow-x: hidden !important;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    .main-page {
        overflow-x: hidden;
    }

    /* Container Spacing */
    .container,
    .page-container,
    .main-wrapper,
    main {
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Interactive Tap Targets */
    button, 
    .btn, 
    .nav-link, 
    .nav-tool-btn,
    .custom-select-styled,
    .search-input-styled {
        min-height: 42px;
    }

    /* Global Headings on Mobile */
    h1 {
        font-size: 1.6rem !important;
        line-height: 1.25 !important;
        letter-spacing: -0.3px;
    }
    h2 {
        font-size: 1.3rem !important;
        line-height: 1.3 !important;
    }

    /* Universal Modal Scaling on Small Screens */
    .modal-card,
    .msg-modal-card,
    .changelog-modal-card {
        width: 94% !important;
        max-height: 88vh !important;
        padding: 18px 16px !important;
        border-radius: 20px !important;
    }

    /* Tables & Wide Containers Horizontal Scroll */
    .table-responsive,
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    /* Extra spacing reduction for small phones (e.g., iPhone SE / Galaxy S) */
    .hero-section,
    .home-hero,
    .series-hero {
        padding: 22px 14px !important;
        border-radius: 16px !important;
    }

    .grid-2col,
    .grid-3col,
    .grid-4col {
        grid-template-columns: 1fr !important;
    }
}

