/* 新增样式 - 适配重构版UI */

/* AP进度条 */
.ap-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 12px;
    border-radius: 20px;
}

.ap-label {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--accent-secondary);
}

.ap-bar {
    width: 100px;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.ap-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--success));
    transition: width 0.3s ease;
}

.ap-value {
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 40px;
}

/* 顶部信息栏优化 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.day-info {
    font-size: 1.2rem;
    font-weight: bold;
}

.phase-info {
    font-size: 0.8rem;
    color: var(--accent-secondary);
    background: rgba(0, 173, 181, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
}

.cash-info {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--success);
}

/* 公司等级标签 */
.company-level {
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    margin-left: 10px;
}

/* 业务操作区域 */
.action-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    max-height: 300px;
    overflow-y: auto;
}

.action-group {
    background: var(--bg-card);
    padding: 12px;
    border-radius: var(--border-radius);
}

.action-group h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-action {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    transform: translateY(-1px);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.fate-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    padding: 0;
}

.btn-end-day {
    background: linear-gradient(135deg, var(--accent-primary), #ff6b6b);
    color: white;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
}

.btn-end-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.4);
}

/* 核心指标样式 */
.metric.large {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.metric.large .metric-name {
    font-size: 0.9rem;
}

.metric.large .metric-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.metric-value.highlight {
    color: var(--accent-secondary);
}

/* 行业卡片增强 */
.industry-card .industry-desc {
    font-size: 0.8rem;
    color: var(--accent-secondary);
    margin-top: 10px;
    font-style: italic;
}

/* 结算弹窗 */
.settlement-modal {
    max-width: 400px;
}

.settlement-stats {
    margin: 20px 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row.positive span:last-child {
    color: var(--success);
}

.stat-row.negative span:last-child {
    color: var(--danger);
}

.stat-row.net {
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
}

/* 浮动文字动画 */
@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -60px) scale(1.2);
    }
}

.floating-text {
    position: absolute;
    font-size: 1.2rem;
    font-weight: bold;
    pointer-events: none;
    z-index: 100;
    animation: floatUp 1.5s ease-out forwards;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.floating-text.positive {
    color: var(--success);
}

.floating-text.negative {
    color: var(--danger);
}

/* 游戏总结等级 */
.summary-level {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 20px;
    padding: 10px 30px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.1);
    display: inline-block;
}

/* 仪表盘折叠 */
.category-content.collapsed {
    display: none;
}

.category-header.collapsed .category-toggle {
    transform: rotate(-90deg);
}

/* 响应式优化 */
@media (max-width: 1200px) {
    .action-area {
        max-height: 250px;
    }
    
    .action-buttons {
        gap: 6px;
    }
    
    .btn-action {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .ap-bar-container {
        order: -1;
    }
    
    .fate-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-end-day {
        width: 100%;
    }
}

/* 事件卡片样式 - 更小、居中 */
.event-card {
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--accent-secondary);
    max-width: 500px;
    margin: 0 auto 15px auto;
    text-align: center;
}

.event-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--accent-secondary);
}

.event-content {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
    font-size: 0.9rem;
}

.event-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

/* 自动运行按钮 */
.btn-auto-run {
    background: linear-gradient(135deg, var(--success), #2e7d32);
    color: white;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-auto-run:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-auto-run.active {
    background: linear-gradient(135deg, var(--danger), #c62828);
}

.btn-auto-run.active:hover {
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

/* 顶部常驻通知 */
.top-notification {
    background: linear-gradient(135deg, rgba(0, 173, 181, 0.2), rgba(0, 173, 181, 0.1));
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 16px;
    margin-bottom: 15px;
    animation: slideDown 0.5s ease;
}

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

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.notification-content strong {
    color: var(--accent-secondary);
    white-space: nowrap;
}

.notification-content span {
    flex: 1;
    color: var(--text-secondary);
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 1.2rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.notification-close:hover {
    opacity: 1;
}

/* 事件卡片默认状态 */
#current-event .event-title {
    color: var(--text-secondary);
    font-weight: normal;
}

#current-event:has(.btn-option) .event-title {
    color: var(--accent-secondary);
    font-weight: bold;
}

/* UI优化：提高主动交互选项栏 */
.action-area {
    margin-top: 10px;
    max-height: 280px;
    overflow-y: auto;
}

/* 右侧仪表盘紧凑设计 */
.right-panel {
    padding: 10px 12px;
}

.dashboard h3 {
    margin-bottom: 10px;
    font-size: 1rem;
}

.dashboard-category {
    margin-bottom: 8px;
}

.category-header {
    padding: 8px 10px;
}

.category-content {
    padding: 8px 10px;
}

.metric {
    margin-bottom: 6px;
    gap: 6px;
}

.metric-name {
    font-size: 0.75rem;
}

.metric-value {
    font-size: 0.8rem;
    flex: 0 0 70px;
}

.metric-bar {
    height: 6px;
}

.metric.large {
    padding: 6px 0;
}

.metric.large .metric-value {
    font-size: 1.1rem;
}

/* 左侧通知栏缩小 */
.top-notification {
    padding: 8px 12px;
    margin-bottom: 10px;
}

.notification-content {
    font-size: 0.85rem;
    gap: 8px;
}

.notification-close {
    font-size: 1rem;
    padding: 2px 6px;
}

/* 事件卡片更紧凑 */
.event-card {
    padding: 12px 16px;
    margin-bottom: 10px;
}

.event-title {
    font-size: 1rem;
    margin-bottom: 6px;
}

.event-content {
    font-size: 0.85rem;
    margin-bottom: 10px;
}

/* 历史记录区域 */
.history-log {
    padding: 12px;
    margin-bottom: 10px;
}

.log-item {
    padding: 6px 8px;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

/* ========== UI重新布局 ========== */

/* 1. 顶部驾驶仪表盘样式 - 更紧凑 */
.game-header {
    background: linear-gradient(135deg, #1a237e 0%, #0d47a1 50%, #01579b 100%);
    border: none;
    border-radius: 12px;
    padding: 6px 12px;
    margin-bottom: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.game-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00e5ff, transparent);
}

/* 驾驶仪表盘样式 */
.header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.day-info {
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.phase-info {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: rgba(0, 188, 212, 0.2);
    border: none;
    border-radius: 12px;
    margin-top: 2px;
}

.ap-bar-container {
    background: rgba(0, 0, 0, 0.4);
    border: none;
    padding: 4px 12px;
}

.ap-label {
    font-size: 0.7rem;
    color: #00e5ff;
}

.cash-info {
    font-size: 1.2rem;
    color: #4caf50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

/* 2. 历史记录区域向上收缩 */
.history-log {
    flex: 0 0 auto;
    max-height: 110px;
    min-height: 50px;
    margin-bottom: 6px;
    padding: 6px;
}

/* 3. 操作区域向上延伸，变得更大 */
.action-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    max-height: none;
    overflow-y: auto;
}

.action-group {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
}

.action-group h4 {
    font-size: 0.85rem;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.action-buttons {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}

.btn-action {
    flex: 1 1 calc(50% - 6px);
    min-width: 100px;
    padding: 10px 12px;
    font-size: 0.85rem;
}

.fate-group {
    margin-top: auto;
    flex-direction: row;
    gap: 10px;
}

.btn-fate,
.btn-auto-run {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
}

/* 左侧面板三栏布局 */
.left-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 三个部分空间分配 - 第二部分更小 */
.left-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 第一部分：顶部区域（标题+历史记录） */
.left-section.top-section {
    flex: 1.2;
    justify-content: flex-start;
}

/* 第二部分：中间区域（事件卡片）- 更小 */
.left-section.middle-section {
    flex: 0.4;
    justify-content: flex-start;
    margin-top: -5px;
    padding-top: 5px;
    position: relative;
    z-index: 1;
    min-height: 60px;
}

/* 第三部分：底部区域（操作区） */
.left-section.bottom-section {
    flex: 1.4;
    justify-content: flex-end;
}

/* 历史记录自适应 */
.history-log {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    margin-bottom: 0;
    max-height: none;
    min-height: auto;
}

/* 事件卡片填充 */
.left-section.middle-section .event-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0;
}

/* 操作区填充 */
.left-section.bottom-section .action-area {
    flex: 1;
    max-height: none;
}

/* 通知栏更紧凑 */
.top-notification {
    padding: 6px 10px;
    margin-bottom: 6px;
}

.notification-content {
    font-size: 0.8rem;
}

/* 事件卡片调整 */
.event-card {
    margin-bottom: 6px;
    padding: 8px 12px;
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
    /* 整体布局改为单列 */
    .game-container {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
    }
    
    /* 隐藏桌面端的左右面板 */
    .left-panel,
    .right-panel {
        display: none;
    }
    
    /* 显示移动端面板 */
    .mobile-panel {
        display: flex;
        flex-direction: column;
        width: 100%;
        padding: 10px;
        gap: 10px;
    }
    
    /* 1. 顶部：仪表盘 */
    .mobile-dashboard {
        order: 1;
        background: var(--bg-card);
        border-radius: var(--border-radius);
        padding: 12px;
        border: 1px solid var(--accent-secondary);
    }
    
    .mobile-dashboard .dashboard-category {
        margin-bottom: 6px;
    }
    
    .mobile-dashboard .category-header {
        padding: 6px 8px;
        font-size: 0.85rem;
    }
    
    .mobile-dashboard .metric {
        margin-bottom: 4px;
        font-size: 0.8rem;
    }
    
    /* 2. 历史记录区 */
    .mobile-history {
        order: 2;
        max-height: 110px;
        min-height: 110px;
        overflow-y: auto;
        background: var(--bg-primary);
        border-radius: var(--border-radius);
        padding: 8px;
    }
    
    .mobile-history .log-item {
        padding: 4px 6px;
        font-size: 0.75rem;
        margin-bottom: 4px;
    }
    
    /* 3. 事件交互区 */
    .mobile-events {
        order: 3;
        background: var(--bg-card);
        border-radius: var(--border-radius);
        padding: 10px;
        border: 1px solid var(--accent-secondary);
        min-height: 80px;
    }
    
    .mobile-events .event-title {
        font-size: 0.95rem;
        margin-bottom: 6px;
    }
    
    .mobile-events .event-content {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }
    
    /* 4. 主动按钮区 */
    .mobile-actions {
        order: 4;
        background: var(--bg-primary);
        border-radius: var(--border-radius);
        padding: 10px;
    }
    
    .mobile-actions .action-group {
        margin-bottom: 8px;
        padding: 8px;
    }
    
    .mobile-actions .action-group h4 {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    
    .mobile-actions .btn-action {
        padding: 8px 10px;
        font-size: 0.75rem;
        flex: 1 1 calc(50% - 4px);
    }
    
    /* 5. 命运和自动运行按钮 */
    .mobile-controls {
        order: 5;
        display: flex;
        gap: 10px;
        padding: 10px 0;
    }
    
    .mobile-controls .btn-fate,
    .mobile-controls .btn-auto-run {
        flex: 1;
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    /* 顶部通知栏移动端适配 */
    .top-notification {
        padding: 6px 10px;
        margin-bottom: 8px;
    }
    
    .notification-content {
        font-size: 0.75rem;
        flex-wrap: wrap;
    }
    
    /* 游戏头部移动端 */
    .game-header {
        padding: 8px 12px;
        margin-bottom: 8px;
    }
    
    .day-info {
        font-size: 1.1rem;
    }
    
    .cash-info {
        font-size: 1rem;
    }
}

/* 桌面端隐藏移动端面板 */
.mobile-panel {
    display: none;
}

/* 移动端顶部状态栏 */
.mobile-header {
    display: none;
}

@media (max-width: 768px) {
    .mobile-panel {
        display: flex;
    }
    
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: linear-gradient(135deg, #1a237e 0%, #0d47a1 50%, #01579b 100%);
        padding: 10px 12px;
        margin-bottom: 10px;
        border-radius: 8px;
        gap: 10px;
    }
    
    .mobile-day-info {
        color: #fff;
        font-weight: bold;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .mobile-ap-bar {
        display: flex;
        align-items: center;
        gap: 6px;
        flex: 1;
        background: rgba(0, 0, 0, 0.3);
        padding: 4px 8px;
        border-radius: 12px;
    }
    
    .mobile-ap-label {
        color: #00e5ff;
        font-size: 0.7rem;
    }
    
    .mobile-ap-progress {
        flex: 1;
        height: 6px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 3px;
        overflow: hidden;
    }
    
    .mobile-ap-fill {
        height: 100%;
        background: linear-gradient(90deg, #00bcd4, #00e5ff);
        transition: width 0.3s ease;
    }
    
    .mobile-ap-value {
        color: #fff;
        font-size: 0.7rem;
        white-space: nowrap;
    }
    
    .mobile-cash {
        color: #4caf50;
        font-weight: bold;
        font-size: 0.85rem;
        white-space: nowrap;
    }
}

/* 机会弹窗样式 */
.opportunity-modal {
    max-width: 500px;
    text-align: left;
}

.opportunity-modal h3 {
    color: #ff9800;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.4rem;
}

.opportunity-content {
    background: rgba(255, 152, 0, 0.1);
    border-left: 4px solid #ff9800;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 0 8px 8px 0;
}

.opportunity-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ff9800;
    margin-bottom: 10px;
}

.opportunity-desc {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 15px;
}

.opportunity-effect {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #aaa;
}

.opportunity-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.opportunity-options .btn {
    width: 100%;
    padding: 12px;
    text-align: left;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.opportunity-options .btn:hover {
    background: rgba(255, 152, 0, 0.2);
    border-color: #ff9800;
}

.opportunity-options .btn .option-title {
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}

.opportunity-options .btn .option-desc {
    font-size: 0.85rem;
    color: #aaa;
}
