/* --- Quests Layout --- */
.quests-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.quest-list-panel {
    width: 420px;
    min-width: 320px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dark);
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-panel);
}

.panel-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.quest-count {
    background-color: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.quest-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* --- Quest Item in List --- */
.quest-item {
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    border-left: 3px solid transparent;
    border-top: 1px solid transparent;
    border-right: 1px solid transparent;
    border-bottom: 1px solid transparent;
    transition: all 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.quest-item:hover {
    background-color: var(--bg-card);
    border-top-color: var(--border);
    border-right-color: var(--border);
    border-bottom-color: var(--border);
}

.quest-item.selected {
    background-color: rgba(155, 81, 224, 0.08);
    border-top-color: var(--primary);
    border-right-color: var(--primary);
    border-bottom-color: var(--primary);
}

.quest-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.quest-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quest-item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.quest-item-level {
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.cat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.guide-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    background-color: #10b981;
    color: #fff;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.dungeon-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    background-color: #ef4444;
    color: #fff;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.btn-add-cart {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.btn-add-cart:hover {
    border-color: var(--primary);
    color: var(--primary-hover);
    background-color: rgba(155, 81, 224, 0.1);
}

.btn-add-cart.in-cart {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* --- Detail Panel --- */
.quest-detail-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-dark);
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-panel);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary-hover);
    border-bottom-color: var(--primary);
}

#cart-badge {
    background-color: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

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

.detail-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
    font-size: 0.9rem;
}

/* --- Detail View --- */
.detail-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.detail-cat-bar {
    width: 4px;
    min-height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
    align-self: stretch;
}

.detail-header-info {
    flex: 1;
}

.detail-quest-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.detail-quest-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.detail-tag-cat {
    color: #fff;
}

.detail-tag-level {
    background-color: rgba(255,255,255,0.08);
    color: var(--text-main);
}

.detail-tag-guide {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    cursor: pointer;
}

.detail-tag-guide:hover {
    background-color: rgba(16, 185, 129, 0.25);
}

.detail-tag-dungeon {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.btn-open-guide {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 6px 14px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 10px;
    display: inline-block;
}

.btn-open-guide:hover {
    background-color: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-hover);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.prereq-list, .item-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.prereq-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--bg-card);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.prereq-item:hover {
    background-color: var(--bg-panel);
}

.prereq-name {
    flex: 1;
}

.prereq-level {
    color: var(--primary-hover);
    font-weight: 600;
    font-size: 0.7rem;
    white-space: nowrap;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: var(--bg-card);
    border-radius: 6px;
    font-size: 0.8rem;
}

.item-name {
    flex: 1;
}

.item-qty {
    color: var(--primary-hover);
    font-weight: 700;
    font-size: 0.85rem;
}

.step-item {
    padding: 12px 14px;
    background-color: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 6px;
    border-left: 3px solid var(--border);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    margin-right: 8px;
    flex-shrink: 0;
}

.step-name {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
}

.step-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-left: 30px;
}

/* --- Guide Tracker Tab --- */
.guide-content {
    line-height: 1.6;
}

.guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.guide-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.guide-source-link {
    font-size: 0.75rem;
    color: var(--primary-hover);
    text-decoration: none;
}

.guide-source-link:hover {
    text-decoration: underline;
}

.guide-block {
    margin-bottom: 20px;
    padding: 14px 16px;
    background-color: var(--bg-card);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.guide-block-text {
    font-size: 0.82rem;
    color: var(--text-main);
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.guide-block-text strong {
    color: var(--primary-hover);
}

.guide-block-text a {
    color: #3b82f6;
    text-decoration: none;
}

.guide-block-text a:hover {
    text-decoration: underline;
}

.guide-block-text ul, .guide-block-text ol {
    margin: 8px 0;
    padding-left: 20px;
}

.guide-block-text li {
    margin-bottom: 4px;
}

.guide-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.guide-img {
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s;
}

.guide-img:hover {
    transform: scale(1.02);
}

.guide-img-thumb {
    max-height: 200px;
    object-fit: contain;
}

.guide-coords {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.coord-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    background-color: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.coord-inline {
    display: inline;
    background-color: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}

/* --- Cart Panel --- */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cart-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.btn-clear {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

.btn-clear:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.cart-separator {
    height: 1px;
    background-color: var(--border);
    margin: 16px 0;
}

.cart-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-hover);
    margin-bottom: 8px;
}

.cart-quest-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    font-size: 0.75rem;
    margin: 2px 4px 2px 0;
}

.cart-quest-tag .remove-tag {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.cart-quest-tag .remove-tag:hover {
    color: #ef4444;
}

.cart-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.cart-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px;
    background-color: var(--bg-card);
    border-radius: 6px;
    min-width: 80px;
}

.cart-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-hover);
}

.cart-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Cross-reference section --- */
.cross-ref-section {
    margin-top: 16px;
}

.cross-ref-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #f59e0b;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.cross-ref-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: rgba(245, 158, 11, 0.06);
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
    font-size: 0.78rem;
    margin-bottom: 4px;
    cursor: pointer;
}

.cross-ref-item:hover {
    background-color: rgba(245, 158, 11, 0.12);
}

/* --- Quest Status Controls --- */
.quest-status-btns {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.btn-status {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: none;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    color: var(--text-muted);
    padding: 0;
}

.btn-status:hover {
    border-color: var(--primary);
}

.btn-status.status-completed {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #10b981;
}

.btn-status.status-objective {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #3b82f6;
}

.quest-item.quest-completed {
    opacity: 0.55;
}

.quest-item.quest-completed .quest-item-name {
    text-decoration: line-through;
}

.quest-item.quest-objective {
    background-color: rgba(59, 130, 246, 0.05);
}

.completed-badge {
    font-size: 0.58rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    background-color: #10b981;
    color: #fff;
    flex-shrink: 0;
}

.objective-badge {
    font-size: 0.58rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    background-color: #3b82f6;
    color: #fff;
    flex-shrink: 0;
}

.tab-badge {
    background-color: var(--primary);
    color: white;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 3px;
}

/* --- Route Planner --- */
.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.route-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

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

.btn-route {
    background-color: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 6px 14px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-route:hover {
    background-color: rgba(59, 130, 246, 0.25);
    border-color: #3b82f6;
}

.route-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.route-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px;
    background-color: var(--bg-card);
    border-radius: 6px;
    min-width: 80px;
}

.route-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-hover);
}

.route-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.route-section {
    margin-bottom: 20px;
}

.route-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-hover);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.route-quest-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 4px;
    border-left: 3px solid var(--primary);
    cursor: pointer;
    transition: all 0.15s;
}

.route-quest-item:hover {
    background-color: var(--bg-panel);
}

.route-quest-item .remove-btn {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 2px 4px;
}

.route-quest-item .remove-btn:hover {
    color: #ef4444;
}

.route-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    background-color: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 4px;
    border-left: 3px solid var(--border);
}

.route-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.route-step-info {
    flex: 1;
}

.route-step-quest {
    font-size: 0.82rem;
    font-weight: 600;
}

.route-step-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.route-step-coords {
    font-size: 0.72rem;
    color: #3b82f6;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.route-step.step-done {
    opacity: 0.5;
    border-left-color: #10b981;
}

.route-step.step-done .route-step-number {
    background-color: #10b981;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .quests-layout {
        flex-direction: column;
    }

    .quest-list-panel {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .quest-detail-panel {
        flex: 1;
    }

    .detail-quest-title {
        font-size: 1rem;
    }

    .guide-block {
        padding: 10px 12px;
    }
}
