/**
 * 寒江孤影增强系统样式
 * 包含：分支选择、NPC关系、结局系统、快进模式
 */

/* ==================== 工具栏样式 ==================== */
.quest-toolbar {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #2c3e50;
    border: 1px solid #34495e;
    border-radius: 6px;
    color: #ecf0f1;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: #34495e;
    transform: translateY(-1px);
}

.toolbar-btn.active {
    background: #27ae60;
    border-color: #2ecc71;
}

.toolbar-btn .btn-icon {
    font-size: 16px;
}

.toolbar-btn .btn-text {
    font-size: 12px;
}

/* ==================== 玩家属性条 ==================== */
.player-attributes-bar {
    display: flex;
    gap: 16px;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    margin: 10px 0;
}

.attr-item {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.attr-icon {
    font-size: 18px;
}

.attr-name {
    font-size: 12px;
    color: #95a5a6;
    min-width: 30px;
}

.attr-bar {
    flex: 1;
    height: 8px;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
}

.attr-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

.karma-fill {
    background: linear-gradient(to right, #e74c3c, #f39c12, #27ae60);
}

.humanity-fill {
    background: linear-gradient(to right, #3498db, #9b59b6);
}

.ambition-fill {
    background: linear-gradient(to right, #e74c3c, #c0392b);
}

/* ==================== 分支选择对话框 ==================== */
.branch-choice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s;
}

.branch-choice-dialog {
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #0f3460;
    border-radius: 16px;
    overflow: hidden;
    animation: slideUp 0.3s;
}

.branch-choice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(15, 52, 96, 0.5);
    border-bottom: 1px solid #0f3460;
}

.branch-choice-header h3 {
    margin: 0;
    color: #e94560;
    font-size: 20px;
}

.branch-choice-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(233, 69, 96, 0.2);
    color: #e94560;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

.branch-choice-close:hover {
    background: #e94560;
    color: white;
}

.branch-choice-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 140px);
}

.branch-context {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(15, 52, 96, 0.3);
    border-radius: 8px;
}

.branch-question {
    color: #ecf0f1;
    font-size: 16px;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.branch-location {
    color: #95a5a6;
    font-size: 13px;
}

/* NPC状态面板 */
.npc-status-panel {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.npc-status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 20px;
    font-size: 12px;
}

.npc-avatar {
    font-size: 16px;
}

.npc-name {
    color: #ecf0f1;
    font-weight: 500;
}

.npc-status {
    margin-left: 4px;
}

.npc-affection {
    color: #e74c3c;
}

/* 分支选项 */
.branch-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.branch-option {
    padding: 14px 16px;
    background: rgba(15, 52, 96, 0.4);
    border: 2px solid #0f3460;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.branch-option:hover:not(.disabled) {
    background: rgba(15, 52, 96, 0.6);
    border-color: #e94560;
    transform: translateX(4px);
}

.branch-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.option-text {
    color: #ecf0f1;
    font-size: 15px;
    font-weight: 500;
}

.option-lock {
    font-size: 16px;
}

.option-description {
    color: #95a5a6;
    font-size: 13px;
    line-height: 1.4;
}

.option-hint {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 6px;
}

.branch-choice-footer {
    padding: 12px 20px;
    background: rgba(15, 52, 96, 0.3);
    border-top: 1px solid #0f3460;
    display: flex;
    justify-content: center;
}

/* ==================== NPC关系面板 ==================== */
.npc-relation-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.npc-relation-panel-dialog {
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #0f3460;
    border-radius: 16px;
    overflow: hidden;
}

.npc-relation-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(15, 52, 96, 0.5);
}

.npc-relation-panel-header h3 {
    margin: 0;
    color: #e94560;
}

.npc-relation-panel-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(233, 69, 96, 0.2);
    color: #e94560;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
}

.npc-relation-panel-body {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.npc-relation-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    margin-bottom: 12px;
}

.npc-relation-avatar {
    font-size: 32px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.npc-relation-info {
    flex: 1;
}

.npc-relation-name {
    color: #ecf0f1;
    font-size: 15px;
    font-weight: 500;
}

.npc-relation-title {
    color: #95a5a6;
    font-size: 12px;
}

.npc-relation-status {
    font-size: 13px;
    font-weight: 500;
}

.npc-relation-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.relation-bar {
    display: flex;
    align-items: center;
    gap: 6px;
}

.relation-bar .bar-label {
    font-size: 10px;
    color: #95a5a6;
    min-width: 24px;
}

.relation-bar .bar-track {
    width: 60px;
    height: 6px;
    background: #1a1a1a;
    border-radius: 3px;
    overflow: hidden;
}

.relation-bar .bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.relation-bar .bar-value {
    font-size: 10px;
    color: #ecf0f1;
    min-width: 28px;
    text-align: right;
}

/* ==================== 结局选择面板 ==================== */
.ending-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
}

.ending-selection-dialog {
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    border: 2px solid #e94560;
    border-radius: 16px;
    overflow: hidden;
    animation: endingFadeIn 0.5s;
}

.ending-selection-header {
    padding: 20px;
    text-align: center;
    background: linear-gradient(to right, rgba(233, 69, 96, 0.2), rgba(233, 69, 96, 0.1));
}

.ending-selection-header h3 {
    margin: 0;
    color: #e94560;
    font-size: 24px;
}

.ending-selection-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(85vh - 100px);
}

.ending-intro {
    text-align: center;
    color: #95a5a6;
    margin-bottom: 20px;
}

.ending-options {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.ending-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(15, 52, 96, 0.4);
    border: 2px solid #0f3460;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.ending-option:hover {
    background: rgba(15, 52, 96, 0.6);
    border-color: #e94560;
    transform: scale(1.02);
}

.ending-icon {
    font-size: 36px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(233, 69, 96, 0.2);
    border-radius: 50%;
}

.ending-info {
    flex: 1;
}

.ending-name {
    color: #ecf0f1;
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 4px;
}

.ending-desc {
    color: #95a5a6;
    font-size: 13px;
    line-height: 1.4;
}

/* 玩家状态 */
.player-stats {
    padding: 16px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
}

.player-stats h4 {
    margin: 0 0 12px 0;
    color: #e94560;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.stat-label {
    width: 40px;
    color: #95a5a6;
    font-size: 12px;
}

.stat-progress {
    flex: 1;
    height: 10px;
    background: #1a1a1a;
    border-radius: 5px;
    overflow: hidden;
}

.stat-progress .stat-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s;
}

.stat-value {
    width: 30px;
    text-align: right;
    color: #ecf0f1;
    font-size: 12px;
}

/* ==================== 结局详情 ==================== */
.ending-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2200;
    animation: fadeIn 0.5s;
}

.ending-detail-dialog {
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 100%);
    border: 3px solid #e94560;
    border-radius: 20px;
    overflow: hidden;
    text-align: center;
}

.ending-header {
    padding: 30px 20px;
    background: linear-gradient(to bottom, rgba(233, 69, 96, 0.3), transparent);
}

.ending-icon-large {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
    animation: pulse 2s infinite;
}

.ending-title {
    margin: 0;
    color: #e94560;
    font-size: 28px;
}

.ending-body {
    padding: 20px 30px;
}

.ending-story {
    color: #ecf0f1;
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 24px;
    text-align: left;
}

.ending-rewards {
    padding: 16px;
    background: rgba(233, 69, 96, 0.1);
    border-radius: 12px;
    text-align: left;
}

.ending-rewards h4 {
    margin: 0 0 12px 0;
    color: #e94560;
}

.ending-rewards p {
    margin: 4px 0;
    color: #ecf0f1;
    font-size: 14px;
}

.ending-actions {
    padding: 20px;
}

/* ==================== 章节筛选 ==================== */
.chapters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chapter-filter {
    display: flex;
    gap: 6px;
}

.filter-btn {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid #34495e;
    border-radius: 4px;
    color: #95a5a6;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

.filter-btn.active {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

/* ==================== 结局收藏 ==================== */
.endings-collection {
    margin-top: 16px;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
}

.endings-collection h4 {
    margin: 0 0 12px 0;
    color: #f39c12;
}

.endings-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.ending-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border: 2px solid #34495e;
    border-radius: 10px;
    text-align: center;
}

.ending-badge.unlocked {
    border-color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.ending-badge.locked {
    opacity: 0.5;
}

.ending-badge-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.ending-badge-name {
    color: #ecf0f1;
    font-size: 12px;
    font-weight: 500;
}

/* ==================== 动画 ==================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes endingFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==================== RPG对话增强 ==================== */
.rpg-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1500;
    animation: fadeIn 0.2s;
}

.rpg-dialog-container {
    width: 100%;
    max-width: 800px;
    background: linear-gradient(to top, #1a1a2e, rgba(26, 26, 46, 0.95));
    border: 2px solid #0f3460;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    animation: slideUp 0.3s;
}

.rpg-scene-bg {
    padding: 12px 16px;
    background: rgba(15, 52, 96, 0.5);
    border-bottom: 1px solid #0f3460;
}

.rpg-scene-location {
    color: #95a5a6;
    font-size: 13px;
}

.rpg-dialog-main {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    min-height: 120px;
}

.rpg-dialog-left,
.rpg-dialog-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rpg-dialog-left {
    justify-content: flex-start;
}

.rpg-dialog-right {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.rpg-dialog-box {
    max-width: 60%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
}

.rpg-dialog-left {
    background: rgba(52, 152, 219, 0.2);
    border: 1px solid #3498db;
}

.rpg-dialog-right {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid #e74c3c;
}

.rpg-dialog-text {
    color: #ecf0f1;
    font-size: 15px;
}

.rpg-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.rpg-avatar-image {
    font-size: 40px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.rpg-avatar-name {
    color: #95a5a6;
    font-size: 11px;
}

.rpg-dialog-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(0,0,0,0.3);
}

.rpg-dialog-hint {
    color: #95a5a6;
    font-size: 12px;
}

.rpg-next-btn {
    padding: 8px 16px;
    background: #e94560;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.rpg-next-btn:hover {
    background: #ff6b81;
}

/* ==================== 响应式调整 ==================== */
@media (max-width: 600px) {
    .quest-toolbar {
        flex-wrap: wrap;
    }

    .toolbar-btn {
        flex: 1;
        min-width: 80px;
        justify-content: center;
    }

    .player-attributes-bar {
        flex-direction: column;
        gap: 8px;
    }

    .ending-option {
        flex-direction: column;
        text-align: center;
    }

    .npc-status-panel {
        flex-direction: column;
    }
}
