/* Quest Modal - RTL (Arabic) */

.qm-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    direction: rtl;
}
.qm-modal {
    position: relative; width: 450px; max-width: 95vw; max-height: 80vh;
    background: linear-gradient(160deg, #fdf6e3 0%, #ede0c4 100%);
    border: 1px solid #c5a55a; border-top: 3px solid #c5a55a;
    border-radius: 10px; box-shadow: 0 8px 32px rgba(101,67,10,0.3);
    display: flex; flex-direction: column;
    animation: qm-fadeIn 0.25s ease;
}
@keyframes qm-fadeIn { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:translateY(0); } }
.qm-header {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid #c5a55a;
}
.qm-header-icon {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #c5a55a, #8b6120);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,.2); flex-shrink: 0; overflow: hidden;
}
.qm-header-icon img { width: 28px; height: 28px; object-fit: contain; }
.qm-title {
    flex: 1; font-size: 15px; color: #7a5c2a; font-weight: bold;
    text-transform: uppercase; letter-spacing: .4px;
}
.qm-close {
    color: #8b6120; font-size: 24px; cursor: pointer; line-height: 1;
    padding: 0 4px; transition: color 0.2s; font-weight: bold;
}
.qm-close:hover { color: #c0392b; }
.qm-body {
    padding: 12px 16px; overflow-y: auto; max-height: 65vh;
}
.qm-loading { text-align: center; padding: 30px; color: #7a5c2a; font-weight: bold; }

/* ========== Summary Bar ========== */
.qm-summary {
    display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap;
}
.qm-summary-item {
    flex: 1; min-width: 80px;
    text-align: center; padding: 6px 8px;
    border-radius: 6px; font-size: 11px; font-weight: bold;
}
.qm-summary-reward {
    background: linear-gradient(135deg, #f7d94c, #e8a020);
    color: #3d2600; border: 1px solid #d4960a;
    cursor: pointer;
}
.qm-summary-reward:hover { box-shadow: 0 0 8px rgba(232,160,32,0.6); }
.qm-summary-active {
    background: linear-gradient(135deg, #c5a55a, #a88930);
    color: #fff; border: 1px solid #8b6120;
}
.qm-summary-completed {
    background: linear-gradient(135deg, #6db340, #4a8f2f);
    color: #fff; border: 1px solid #3a7520;
}
.qm-summary-num {
    font-size: 16px; display: block; line-height: 1.2;
}

/* ========== Accordion Sections ========== */
.qm-section { margin-bottom: 8px; }
.qm-section-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #c5a55a, #8b6120);
    border-radius: 6px; color: #fff; font-weight: bold; font-size: 12px;
    text-transform: uppercase; letter-spacing: .4px;
    cursor: pointer; user-select: none;
    transition: border-radius 0.2s;
}
.qm-section-header:hover { opacity: 0.9; }
.qm-section.qm-open .qm-section-header {
    border-radius: 6px 6px 0 0;
}
.qm-section-arrow {
    font-size: 10px; transition: transform 0.3s;
    display: inline-block;
}
.qm-section.qm-open .qm-section-arrow {
    transform: rotate(90deg);
}
.qm-section-count {
    margin-right: auto;
    font-size: 11px; opacity: 0.9;
}
.qm-quest-list {
    display: none; flex-direction: column; gap: 3px;
    padding: 6px;
    background: rgba(197,165,90,0.08);
    border: 1px solid rgba(197,165,90,0.2);
    border-top: none;
    border-radius: 0 0 6px 6px;
}
.qm-section.qm-open .qm-quest-list {
    display: flex;
}

/* ========== Quest Items ========== */
.qm-quest-item {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 10px; border-radius: 6px;
    background: linear-gradient(160deg, #faf0d8 0%, #f0e4c6 100%);
    border: 1px solid #dfd3ad;
    transition: background .15s, transform .15s;
    cursor: pointer; font-size: 14px;
}
.qm-quest-item:hover:not(.qm-locked) {
    background: linear-gradient(160deg, #f5e8c2 0%, #e8d8aa 100%);
    transform: scale(1.01);
}
.qm-quest-item.qm-locked {
    opacity: 0.5; cursor: default;
}

/* Status icons */
.qm-quest-status-icon {
    width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
    border: 2px solid #c8bca0;
    box-sizing: border-box;
}
.qm-completed .qm-quest-status-icon {
    background: linear-gradient(160deg, #6db340, #4a8f2f);
    border-color: #4a8f2f;
    position: relative;
}
.qm-completed .qm-quest-status-icon::after {
    content: '\2713'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px; color: #fff; font-weight: bold; line-height: 1;
}
.qm-active .qm-quest-status-icon {
    border-color: #c5a55a;
    animation: qm-pulse 2s ease-in-out infinite;
    background: #f0dc7c;
}
@keyframes qm-pulse { 0%,100% { box-shadow: 0 0 4px rgba(197,165,90,0.4); } 50% { box-shadow: 0 0 10px rgba(197,165,90,0.9); } }
.qm-reward .qm-quest-status-icon {
    border-color: #e8a020;
    background: linear-gradient(160deg, #f7d94c, #e8a020);
    animation: qm-pulse 1.5s ease-in-out infinite;
}
.qm-locked .qm-quest-status-icon {
    background: #ccc; border-color: #aaa;
}

/* Quest name */
.qm-quest-name { flex: 1; color: #3d2600; font-weight: bold; }
.qm-completed .qm-quest-name { color: #777; text-decoration: line-through; }
.qm-locked .qm-quest-name { color: #999; }

/* Badges */
.qm-quest-badge {
    font-size: 9px; font-weight: bold; padding: 2px 6px;
    border-radius: 4px; white-space: nowrap;
}
.qm-badge-completed { background: #6db340; color: #fff; }
.qm-badge-active { background: #c5a55a; color: #fff; }
.qm-badge-reward {
    background: linear-gradient(135deg, #f7d94c, #e8a020);
    color: #3d2600; box-shadow: 0 0 6px rgba(232,160,32,0.5);
}
.qm-badge-locked { background: #ccc; color: #888; }

/* ========== Dropdown Panel ========== */
.qm-dropdown-panel {
    background: linear-gradient(160deg, #fdf6e3, #ede0c4);
    border: 1px solid #c5a55a;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 10px;
    animation: qm-fadeIn 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.qm-dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 6px;
    background: linear-gradient(160deg, #faf0d8 0%, #f0e4c6 100%);
    border: 1px solid #dfd3ad;
    cursor: pointer; font-size: 13px;
    transition: background .15s;
}
.qm-dropdown-item:hover {
    background: linear-gradient(160deg, #f5e8c2 0%, #e8d8aa 100%);
}
.qm-panel-reward .qm-dropdown-item .qm-quest-status-icon {
    border-color: #4a8f2f;
    background: linear-gradient(160deg, #6db340, #4a8f2f);
    animation: qm-pulse 1.5s ease-in-out infinite;
    position: relative;
}
.qm-panel-reward .qm-dropdown-item .qm-quest-status-icon::after {
    content: '\2713'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px; color: #fff; font-weight: bold; line-height: 1;
}
.qm-panel-active .qm-dropdown-item .qm-quest-status-icon {
    border-color: #c5a55a;
    background: #f0dc7c;
    animation: qm-pulse 2s ease-in-out infinite;
}
.qm-dropdown-name {
    flex: 1; font-weight: bold; color: #3d2600;
}
.qm-dropdown-collect {
    font-size: 10px; font-weight: bold;
    padding: 3px 8px; border-radius: 4px;
    background: linear-gradient(135deg, #f7d94c, #e8a020);
    color: #3d2600; cursor: pointer;
    border: 1px solid #d4960a;
    white-space: nowrap;
    transition: box-shadow .2s;
}
.qm-dropdown-collect:hover {
    box-shadow: 0 0 8px rgba(232,160,32,0.6);
}
.qm-collect-all-wrap {
    text-align: center;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #c5a55a;
}
.qm-collect-all-btn {
    display: inline-block;
    cursor: pointer;
}

/* Questmaster speech balloon */
.qm-balloon-wrap {
    position: absolute; right: 23px; top: 36px; z-index: 10;
    pointer-events: none;
}
.qm-balloon-img {
    width: 55px; height: 44px;
}
.qm-balloon-num {
    position: absolute; top: 13px; left: 10px; right: 0;
    text-align: center; font-size: 15px; font-weight: bold;
    color: #000; line-height: 1;
}

/* Reward text under quest name */
.qm-reward-text {
    display: block; font-size: 11px; font-weight: normal;
    color: #8b6120; margin-top: 2px;
    line-height: 18px;
}
.qm-reward-text i, .qm-reward-text img {
    vertical-align: middle;
}

/* Scrollbar */
.qm-body::-webkit-scrollbar { width: 6px; }
.qm-body::-webkit-scrollbar-track { background: rgba(197,165,90,0.1); border-radius: 3px; }
.qm-body::-webkit-scrollbar-thumb { background: #c5a55a; border-radius: 3px; }
