/* ============================================================
   صفحة التمارين - Exercises Page Styles
   ============================================================ */

/* رأس الصفحة */
.exercises-page-header {
    background: linear-gradient(135deg, #0a4a33 0%, #0F6244 50%, #1a8a64 100%);
    color: var(--color-white);
    padding: 64px 0 56px;
    position: relative;
    overflow: hidden;
}

.exercises-page-header .page-header-bg {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 50% 50%, rgba(200, 160, 78, .15), transparent 50%),
        radial-gradient(circle at 10% 90%, rgba(232, 201, 125, .10), transparent 40%),
        radial-gradient(circle at 90% 10%, rgba(232, 201, 125, .10), transparent 40%);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    margin-bottom: 22px;
    opacity: .85;
    position: relative;
}

.breadcrumb a { color: var(--color-gold-light); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb i { font-size: 10px; }
.breadcrumb span { font-weight: 600; }

.page-header-content { position: relative; }

.page-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: rgba(200, 160, 78, .15);
    border: 1px solid rgba(200, 160, 78, .4);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gold-light);
    margin-bottom: 18px;
}

.page-title {
    font-family: 'Cairo', sans-serif;
    font-size: 42px;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 16px;
}

.page-subtitle {
    font-size: 17px;
    line-height: 1.8;
    opacity: .92;
    max-width: 720px;
}

/* أنواع التمارين */
.exercise-types {
    padding: 64px 0 32px;
    background: var(--color-bg);
}

.exercise-types-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.exercise-type-card {
    background: var(--color-white);
    padding: 24px 18px;
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--color-border);
}

.exercise-type-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.exercise-type-card.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--color-white);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.exercise-type-card.active .et-icon {
    background: rgba(200, 160, 78, .2);
    color: var(--color-gold-light);
}

.exercise-type-card.active h3,
.exercise-type-card.active p {
    color: var(--color-white);
}

.et-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(15, 98, 68, .1), rgba(200, 160, 78, .1));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: var(--color-primary);
    font-size: 24px;
    transition: var(--transition);
}

.exercise-type-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: 6px;
}

.exercise-type-card p {
    font-size: 13px;
    color: var(--color-text-soft);
    line-height: 1.5;
}

/* اختيار المستوى */
.level-selector {
    padding: 32px 0;
    background: var(--color-bg);
}

.level-selector-card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.level-selector-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.level-selector-card h3 i {
    color: var(--color-gold);
}

.level-chips {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.level-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--color-bg-alt);
    border: 2px solid transparent;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-soft);
    transition: var(--transition-fast);
}

.level-chip:hover {
    background: var(--color-bg);
    transform: translateY(-2px);
}

.level-chip.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--color-white);
    border-color: var(--color-primary);
    box-shadow: var(--shadow);
}

.lc-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--color-white);
    border-radius: 50%;
    color: var(--color-primary);
    font-weight: 800;
    font-size: 14px;
}

.level-chip.active .lc-num {
    background: var(--color-gold);
    color: var(--color-primary-dark);
}

/* منطقة التمرين */
.exercise-area {
    padding: 56px 0;
    background: var(--color-white);
}

.exercise-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.ex-stat {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
}

.ex-stat:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.ex-stat > i {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--color-white);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-sm);
}

.ex-stat-value {
    font-family: 'Cairo', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--color-primary-dark);
    line-height: 1;
    margin-bottom: 2px;
}

.ex-stat-label {
    font-size: 12px;
    color: var(--color-text-muted);
}

.exercise-progress-bar {
    height: 8px;
    background: var(--color-bg-alt);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 32px;
}

.ep-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-gold));
    border-radius: 999px;
    width: 20%;
    transition: width .4s ease;
}

/* صندوق التمرين */
.exercise-box {
    background: linear-gradient(135deg, rgba(200, 160, 78, .04), rgba(15, 98, 68, .04));
    border: 2px solid var(--color-gold);
    border-radius: var(--radius-xl);
    padding: 36px;
    min-height: 360px;
}

.exercise-question {
    display: none;
}

.exercise-question.active {
    display: block;
    animation: questionFade .5s ease-out;
}

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

.eq-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--color-border);
}

.eq-type-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--color-primary);
    color: var(--color-white);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.eq-points {
    font-size: 14px;
    color: var(--color-gold);
    font-weight: 700;
    background: rgba(200, 160, 78, .15);
    padding: 4px 12px;
    border-radius: 999px;
}

.eq-points::before {
    content: '★ ';
    margin-left: 4px;
}

.eq-question {
    font-family: 'Cairo', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--color-primary-dark);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* خيارات اختيار من متعدد */
.eq-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.eq-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--color-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    transition: var(--transition);
    text-align: right;
}

.eq-option:hover:not(.locked) {
    border-color: var(--color-primary);
    transform: translateX(-4px);
    background: var(--color-bg-alt);
    box-shadow: var(--shadow);
}

.eq-option.locked {
    cursor: not-allowed;
}

.eq-option.selected {
    border-color: var(--color-primary);
    background: rgba(15, 98, 68, .08);
}

.eq-option.correct {
    border-color: #10B981;
    background: rgba(16, 185, 129, .12);
}

.eq-option.incorrect {
    border-color: #EF4444;
    background: rgba(239, 68, 68, .12);
}

.eq-opt-letter {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--color-bg-alt);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}

.eq-option.correct .eq-opt-letter {
    background: #10B981;
    color: white;
}

.eq-option.incorrect .eq-opt-letter {
    background: #EF4444;
    color: white;
}

.eq-opt-text {
    font-size: 15px;
    color: var(--color-text);
    font-weight: 600;
}

/* شرح الإجابة */
.eq-explanation {
    display: none;
    padding: 16px 20px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(200, 160, 78, .15), rgba(15, 98, 68, .08));
    border-right: 4px solid var(--color-gold);
}

.eq-explanation.show {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    animation: fadeInUp .4s ease-out;
}

.eq-explanation i {
    color: var(--color-gold);
    font-size: 20px;
    margin-top: 2px;
}

.eq-explanation p {
    font-size: 15px;
    color: var(--color-text);
    line-height: 1.7;
}

/* املأ الفراغ */
.fill-blank {
    background: var(--color-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    text-align: center;
}

.fill-input {
    padding: 8px 16px;
    background: var(--color-bg-alt);
    border: 2px dashed var(--color-gold);
    border-radius: var(--radius);
    font-family: 'Amiri', serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary-dark);
    min-width: 200px;
    text-align: center;
}

.fill-input:focus {
    outline: none;
    border-style: solid;
    border-color: var(--color-primary);
    background: var(--color-white);
}

.fill-input.correct { border-color: #10B981; border-style: solid; background: rgba(16, 185, 129, .1); }
.fill-input.incorrect { border-color: #EF4444; border-style: solid; background: rgba(239, 68, 68, .1); }

.fill-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    justify-content: center;
}

.fill-word-btn {
    padding: 10px 20px;
    background: var(--color-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-family: 'Amiri', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary-dark);
    transition: var(--transition-fast);
}

.fill-word-btn:hover {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.fill-actions {
    text-align: center;
    margin-bottom: 12px;
}

/* صح أم خطأ */
.truefalse-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.tf-option {
    padding: 40px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 800;
    border: 3px solid;
    transition: var(--transition);
}

.tf-option.correct {
    background: rgba(16, 185, 129, .1);
    border-color: #10B981;
    color: #047857;
}

.tf-option.correct i { color: #10B981; }

.tf-option.wrong {
    background: rgba(239, 68, 68, .1);
    border-color: #EF4444;
    color: #B91C1C;
}

.tf-option.wrong i { color: #EF4444; }

.tf-option i { font-size: 48px; }

.tf-option:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.tf-option.selected-tf.correct {
    background: #10B981;
    color: white;
    border-color: #047857;
}

.tf-option.selected-tf.wrong {
    background: #EF4444;
    color: white;
    border-color: #B91C1C;
}

/* التوصيل */
.matching-area {
    background: var(--color-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
}

.match-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    position: relative;
}

.match-column h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-gold);
    text-align: center;
}

.match-item, .match-meaning {
    display: block;
    width: 100%;
    padding: 14px 18px;
    background: var(--color-bg-alt);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: right;
}

.match-meaning {
    background: var(--color-bg);
    text-align: right;
}

.match-item:hover, .match-meaning:hover {
    border-color: var(--color-primary);
    background: var(--color-white);
}

.match-item.selected, .match-meaning.selected {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.match-item.matched, .match-meaning.matched {
    background: rgba(16, 185, 129, .15);
    border-color: #10B981;
    color: #047857;
    cursor: not-allowed;
}

/* السحب والإفلات */
.drag-area {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 18px;
}

.drag-source {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px dashed var(--color-border);
}

.drag-hint {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 14px;
    text-align: center;
}

.drag-hint i {
    color: var(--color-primary);
    margin-left: 6px;
}

.drag-words {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.drag-word {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--color-white);
    border-radius: var(--radius);
    font-family: 'Amiri', serif;
    font-size: 20px;
    font-weight: 700;
    cursor: grab;
    transition: var(--transition);
    user-select: none;
    box-shadow: var(--shadow);
}

.drag-word:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-md);
}

.drag-word:active {
    cursor: grabbing;
    transform: scale(.95);
}

.drag-word.dragging {
    opacity: .4;
}

.drag-target {
    min-height: 80px;
    padding: 16px;
    background: var(--color-bg-alt);
    border: 2px dashed var(--color-gold);
    border-radius: var(--radius);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.drag-target.drag-over {
    background: rgba(200, 160, 78, .1);
    border-color: var(--color-primary);
    border-style: solid;
}

.drag-placeholder {
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: 600;
}

.drag-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* أزرار التنقل */
.exercise-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    gap: 12px;
}

.exercise-nav .btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* شاشة النتائج */
.exercise-result {
    text-align: center;
    padding: 40px 20px;
}

.result-medal {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-size: 56px;
    box-shadow: var(--shadow-gold);
    animation: bounceIn .6s ease, pulse 2s infinite 1s;
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
}

.exercise-result h2 {
    font-family: 'Cairo', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--color-primary-dark);
    margin-bottom: 8px;
}

.exercise-result > p {
    font-size: 17px;
    color: var(--color-text-soft);
    margin-bottom: 28px;
}

.result-circle-wrap {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 28px;
}

.result-circle {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.circle-bg {
    fill: none;
    stroke: var(--color-bg-alt);
    stroke-width: 14;
}

.circle-fg {
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 14;
    stroke-dasharray: 502;
    stroke-dashoffset: 502;
    transition: stroke-dashoffset 1.5s ease;
    stroke-linecap: round;
}

.result-percent {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    font-size: 48px;
    font-weight: 800;
    color: var(--color-primary-dark);
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 600px;
    margin: 0 auto 24px;
}

.rs-item {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.rs-item.success i { color: #10B981; }
.rs-item.error i { color: #EF4444; }
.rs-item.points i { color: var(--color-gold); }

.rs-item i {
    font-size: 32px;
}

.rs-num {
    font-family: 'Cairo', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--color-primary-dark);
    line-height: 1;
}

.rs-label {
    font-size: 13px;
    color: var(--color-text-soft);
    margin-top: 2px;
}

.result-feedback-msg {
    background: linear-gradient(135deg, rgba(200, 160, 78, .15), rgba(15, 98, 68, .1));
    border: 1px solid var(--color-gold);
    border-radius: var(--radius);
    padding: 20px;
    max-width: 600px;
    margin: 0 auto 28px;
    font-size: 16px;
    color: var(--color-text);
    line-height: 1.7;
    font-weight: 600;
}

.result-feedback-msg i {
    color: var(--color-primary);
    margin-left: 8px;
}

.result-actions-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* تمارين مقترحة */
.suggested-exercises {
    padding: 96px 0;
    background: var(--color-bg);
}

.suggested-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.suggested-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: var(--transition);
}

.suggested-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.sc-header {
    padding: 24px;
    color: var(--color-white);
    position: relative;
    text-align: center;
}

.sc-header i {
    font-size: 36px;
    margin-bottom: 10px;
    display: block;
}

.sc-level {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255,255,255,.2);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.sc-body {
    padding: 24px;
}

.sc-body h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: 10px;
    line-height: 1.4;
}

.sc-body p {
    font-size: 14px;
    color: var(--color-text-soft);
    line-height: 1.6;
    margin-bottom: 16px;
    min-height: 60px;
}

.sc-meta {
    display: flex;
    gap: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.sc-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sc-meta i {
    color: var(--color-primary);
}

.sc-body .btn {
    width: 100%;
    justify-content: center;
}

/* التجاوب */
@media (max-width: 1024px) {
    .exercise-types-grid { grid-template-columns: repeat(3, 1fr); }
    .suggested-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .page-title { font-size: 30px; }
    .page-subtitle { font-size: 15px; }

    .exercise-types-grid { grid-template-columns: repeat(2, 1fr); }
    .exercise-type-card { padding: 18px 12px; }

    .exercise-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    .exercise-box { padding: 20px; }
    .eq-question { font-size: 18px; }

    .eq-options, .truefalse-options { grid-template-columns: 1fr; }

    .tf-option { padding: 24px; }
    .tf-option i { font-size: 36px; }

    .match-columns { grid-template-columns: 1fr; gap: 14px; }

    .drag-word { padding: 10px 16px; font-size: 18px; }
    .drag-actions { flex-direction: column; }
    .drag-actions .btn { width: 100%; justify-content: center; }

    .result-summary { grid-template-columns: 1fr; }
    .result-circle-wrap { width: 160px; height: 160px; }
    .result-percent { font-size: 36px; }

    .result-actions-row { flex-direction: column; }
    .result-actions-row .btn { width: 100%; justify-content: center; }

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

    .exercise-nav { flex-direction: column; }
    .exercise-nav .btn { width: 100%; justify-content: center; }

    .suggested-exercises { padding: 56px 0; }
}

@media (max-width: 480px) {
    .exercise-types-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .level-chips { flex-direction: column; }
    .level-chip { width: 100%; justify-content: center; }
    .fill-input { font-size: 18px; min-width: 150px; }
}
