﻿
:root {
    --primary-color: #0d6efd;
    --primary-hover: #0a58ca;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --bg-light: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #2c3e50;
    --border-color: #dee2e6;
    /* ألوان واتساب */
    --wa-green: #075e54;
    --wa-chat-bg: #e5ddd5;
    --wa-bubble-left: #ffffff;
    --wa-bubble-right: #dcf8c6;
}

/* الوضع الليلي */
.dark-mode {
    --bg-light: #121212;
    --card-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --border-color: #333;
    --wa-chat-bg: #0b141a;
    --wa-bubble-left: #202c33;
    --wa-bubble-right: #005c4b;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    background-color: var(--bg-light);
    color: var(--text-main);
    transition: background-color 0.3s;
}

/* ============================================================
   2. نظام الترجمة الموحد
   ============================================================ */
.full-translation-text, .table-translation, .question-translation,
.option-translation, .sub-translation, .chat-translation {
    display: none !important;
    font-size: 0.85rem;
    margin-top: 6px;
    direction: rtl;
    text-align: right;
    color: #6c757d;
    font-style: italic;
    font-weight: 500;
}

.show-all-translations .full-translation-text,
.show-all-translations .table-translation,
.show-all-translations .question-translation,
.show-all-translations .option-translation,
.show-all-translations .sub-translation,
.show-all-translations .chat-translation {
    display: block !important;
}

/* ============================================================
   3. العناصر التفاعلية (Buttons & Options)
   ============================================================ */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

    .btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

/* أزرار الخيارات */
.option-btn, .multiple-choice-btn {
    cursor: pointer;
    border: 2px solid var(--border-color) !important;
    background-color: var(--card-bg);
    color: var(--text-main);
    margin-bottom: 8px;
    padding: 12px 15px;
    text-align: left;
    transition: 0.2s;
}

    .option-btn.selected, .multiple-choice-btn.selected {
        border-color: var(--primary-color) !important;
        background-color: #cfe2ff !important;
        color: #084298 !important;
        font-weight: bold;
    }

    .option-btn.correct {
        background-color: var(--success-color) !important;
        color: #fff !important;
        border-color: #157347 !important;
    }

    .option-btn.wrong {
        background-color: var(--danger-color) !important;
        color: #fff !important;
        border-color: #bb2d3b !important;
        animation: shake 0.4s;
    }

/* ============================================================
   4. المحادثات (WhatsApp Style)
   ============================================================ */

.lesson-conversation {
    max-width: 750px;
    margin: auto;
    padding: 20px;
    background-color: #f7f9fc;
    background-image: radial-gradient(circle at 20px 20px, rgba(0,0,0,0.03) 2px, transparent 2px), radial-gradient(circle at 60px 60px, rgba(0,0,0,0.03) 2px, transparent 2px);
    background-size: 80px 80px;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}



/* صف الرسالة */

.chat-row {
    display: flex;
    align-items: flex-end;
    margin-bottom: 14px;
}

    /* اليسار */

    .chat-row.left {
        justify-content: flex-start;
    }

    /* اليمين */

    .chat-row.right {
        justify-content: flex-end;
    }

/* اسم المتحدث */

.chat-speaker {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
    opacity: .7;
}

.chat-row.left .chat-speaker {
    color: #555;
}

.chat-row.right .chat-speaker {
    color: #1b5fa7;
}

/* الفقاعة */

.chat-bubble {
    position: relative;
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
}

/* فقاعة اليسار */

.chat-row.left .chat-bubble {
    background: #f1f1f1;
    border-bottom-left-radius: 5px;
}

/* فقاعة اليمين */

.chat-row.right .chat-bubble {
    background: #d9efff;
    border-bottom-right-radius: 5px;
}

/* سهم الفقاعة */

.chat-row.left .chat-bubble:after {
    content: "";
    position: absolute;
    left: -8px;
    bottom: 6px;
    border-width: 8px;
    border-style: solid;
    border-color: transparent #f1f1f1 transparent transparent;
}

.chat-row.right .chat-bubble:after {
    content: "";
    position: absolute;
    right: -8px;
    bottom: 6px;
    border-width: 8px;
    border-style: solid;
    border-color: transparent transparent transparent #d9efff;
}

/* النص */

.chat-text {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 17px; /* ⬅️ توحيد الحجم */
    font-weight: 500; /* ⬅️ أوضح */
    color: #1f2937; /* ⬅️ لون أغمق */
}
}

/* الترجمة */

.translation-line {
    background: #f1f3f5; /* خلفية فاتحة */
    border-left: 4px solid var(--bs-success); /* خط جانبي أخضر */
    padding: 8px 12px;
    margin-top: 6px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-style: italic;
    color: #495057;
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

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

/* ============================================================
   5. الجداول والكلمات التفاعلية
   ============================================================ */
.table-responsive {
    margin: 25px 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.table thead {
    background-color: var(--wa-green);
    color: white;
}

.lesson-line {
    cursor: help;
    border-bottom: 1.5px dashed #999;
    display: inline;
    transition: 0.2s;
}

    .lesson-line:hover {
        background-color: rgba(0,0,0,0.1);
    }

/* ============================================================
   6. الحركات (Animations)
   ============================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

/* ============================================================
   7. أدوات المساعدة (Utilities)
   ============================================================ */
.review-fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1050;
    border-radius: 50px;
    display: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.section-hidden {
    display: none !important;
}


.word-hint {
    position: relative;
    cursor: help;
    border-bottom: 2px dotted #4a9eff;
    background-color: transparent;
    transition: all 0.2s ease;
    display: inline-block;
}

    .word-hint:hover {
        background-color: rgba(13, 110, 253, 0.08);
        border-bottom-color: #ff6b4a;
    }

    /* فقاعة ترجمة واحدة فقط - نظيفة وأنيقة */
    .word-hint::after {
        content: attr(data-translation);
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(-8px);
        background: var(--card-bg, #1e293b);
        color: var(--text-main, #f1f5f9);
        padding: 8px 14px;
        border-radius: 12px;
        font-size: 13px;
        font-weight: 500;
        white-space: nowrap;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
        border: 1px solid var(--border-color, #334155);
        opacity: 0;
        visibility: hidden;
        transition: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
        z-index: 10000;
        font-family: inherit;
        pointer-events: none;
        backdrop-filter: blur(4px);
    }

    /* سهم صغير أسفل الفقاعة */
    .word-hint::before {
        content: '';
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(2px);
        border: 6px solid transparent;
        border-top-color: var(--card-bg, #1e293b);
        opacity: 0;
        visibility: hidden;
        transition: all 0.2s ease;
        z-index: 10000;
        pointer-events: none;
    }

    /* إظهار الترجمة عند التمرير */
    .word-hint:hover::after,
    .word-hint:hover::before {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }

    .word-hint:hover::after {
        transform: translateX(-50%) translateY(-4px);
    }

    /* دعم عرض نوع الكلمة (part of speech) */
    .word-hint[data-pos]::after {
        content: attr(data-translation) " — " attr(data-pos);
    }

/* للشاشات الصغيرة */
@media (max-width: 640px) {
    .word-hint::after {
        font-size: 11px;
        padding: 6px 12px;
        white-space: normal;
        min-width: 120px;
        max-width: 220px;
        text-align: center;
        word-break: keep-all;
    }
}

/* وضع النهار - ألوان أفتح */
:root .word-hint::after {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #475569;
}

:root .word-hint::before {
    border-top-color: #1e293b;
}

/* وضع الليل - يتبع الثيم تلقائياً */
.dark-mode .word-hint::after {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #334155;
}

.dark-mode .word-hint::before {
    border-top-color: #0f172a;
}

/* ============================================================
   تنسيق Tippy.js (إذا كان مستخدماً)
   ============================================================ */
.tippy-box[data-theme~='learning'] {
    background-color: var(--primary-color, #0d6efd) !important;
    color: white !important;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

    .tippy-box[data-theme~='learning'] .tippy-arrow {
        color: var(--primary-color, #0d6efd) !important;
    }



