/* 状态栏样式 - 苹果风格设计（内容区顶部集成版） */

.status-bar-container {
    width: 80vw;
    /* 使用视口宽度 */
    max-width: 1800px;
    /* 增加最大宽度 */
    box-sizing: border-box;
}

.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #e0e0e0;
    height: 36px;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'San Francisco', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    letter-spacing: -0.01em;
}

.status-bar.integrated {
    background-color: rgba(50, 50, 54, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.status-bar-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-item.session-timer {
    display: none;
    /* 默认隐藏，由JS控制显示 */
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.status-item:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.status-item .icon {
    width: 14px;
    height: 14px;
    stroke-width: 2;
    color: currentColor;
    /* Inherit color from parent */
    opacity: 0.7;
}

.status-item .label {
    color: #a0a0a5;
    font-weight: 500;
    font-size: 11px;
}

.status-item .value {
    color: #f5f5f7;
    font-weight: 500;
}

/* 工作区路径显示优化 - 右对齐显示，优先显示后面部分 */
#workspace-directory-value {
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 悬停时显示完整路径 */
#workspace-directory-value:hover {
    overflow: visible;
    white-space: normal;
    word-break: break-all;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    position: relative;
    z-index: 1000;
    max-width: none;
    min-width: 200px;
}

.status-item.connection {
    transition: color 0.3s ease;
}

.status-item.connection.connected {
    color: #34c759;
}

.status-item.connection.disconnected {
    color: #ff3b30;
}

.status-item.connection.high-latency {
    color: #ff9500;
}

.status-item.connection.reconnecting {
    color: #ff9500;
}

.status-item.connection {
    font-weight: 500;
    padding-left: 6px;
}

.status-pulse {
    position: relative;
    z-index: 2;
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
    box-shadow: 0 0 0 rgba(52, 199, 89, 0.4);
}

.status-pulse.connected {
    background-color: #34c759;
}

.status-pulse.disconnected {
    background-color: #ff3b30;
    animation: none;
}

.status-pulse.high-latency {
    background-color: #ff9500;
}

.status-pulse.reconnecting {
    background-color: #ff9500;
    /* Use orange for reconnecting */
    animation: pulse 1s infinite;
    /* Faster pulse for reconnecting */
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(52, 199, 89, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0);
    }
}

.latency-value {
    font-weight: 600;
    transition: color 0.3s ease;
    font-variant-numeric: tabular-nums;
}

.latency-value.normal {
    color: #34c759;
}

.latency-value.medium {
    color: #ff9500;
}

.latency-value.high {
    color: #ff3b30;
}

.status-item.message-status {
    transition: all 0.3s ease;
}

.theme-switcher {
    cursor: pointer;
    border-radius: 6px;
    padding: 4px;
    margin: -4px;
    /* Offset padding to maintain alignment */
    transition: background-color 0.2s ease;
}

.theme-switcher:hover {
    background-color: rgba(120, 120, 128, 0.16);
}

.language-switcher {
    cursor: pointer;
    border-radius: 6px;
    padding: 4px 6px;
    margin: -4px;
    /* Offset padding to maintain alignment */
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.language-switcher:hover {
    background-color: rgba(120, 120, 128, 0.16);
    border-color: rgba(255, 255, 255, 0.1);
}

.language-text {
    font-size: 10px;
    font-weight: 600;
    color: #f5f5f7;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.language-icon {
    width: 12px !important;
    height: 12px !important;
    opacity: 0.8;
}

#message-status-value {
    transition: all 0.4s ease;
    padding: 3px 8px;
    border-radius: 7px;
    font-weight: 500;
}

#message-status-value.idle {
    background-color: transparent;
    color: #86868b;
}

#message-status-value.sending {
    background-color: rgba(0, 122, 255, 0.2);
    color: #007aff;
    animation: sending-pulse 1.5s infinite;
}

#message-status-value.received {
    background-color: rgba(52, 199, 89, 0.25);
    color: #34c759;
    animation: received-highlight 2s ease-out;
}

#message-status-value.waiting {
    background-color: rgba(255, 149, 0, 0.2);
    color: #ff9500;
}

@keyframes sending-pulse {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.7;
    }
}

@keyframes received-highlight {
    0% {
        transform: scale(1.1);
        box-shadow: 0 0 12px rgba(52, 199, 89, 0.5);
    }

    100% {
        transform: scale(1);
        box-shadow: none;
    }
}

/* 会话倒计时居中区域 */
.status-bar-section.center-section {
    flex: 1;
    justify-content: center;
}

/* 响应式调整 */
@media screen and (max-width: 768px) {
    .status-bar.integrated {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 12px;
    }

    .status-bar-section {
        flex-wrap: wrap;
        gap: 12px;
        width: 100%;
        justify-content: flex-start;
        margin-bottom: 4px;
    }

    .status-item {
        max-width: none;
    }

    /* 平板设备上的工作区路径显示优化 */
    #workspace-directory-value {
        max-width: 200px;
    }

    #workspace-directory-value:hover {
        max-width: 90vw;
        position: absolute;
        right: 0;
        top: 100%;
        margin-top: 4px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

@media screen and (max-width: 480px) {
    .status-bar {
        font-size: 11px;
        padding: 6px 10px;
    }

    .status-bar-section {
        gap: 10px;
    }

    .status-item .label {
        display: none;
    }

    .status-pulse {
        width: 6px;
        height: 6px;
        margin-right: 4px;
    }

    .latency-value {
        font-size: 10px;
    }

    /* 手机设备上的工作区路径显示优化 */
    #workspace-directory-value {
        max-width: 120px;
        font-size: 10px;
    }

    #workspace-directory-value:hover {
        max-width: 95vw;
        position: fixed;
        right: 8px;
        top: 50px;
        margin-top: 0;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
        font-size: 11px;
        line-height: 1.4;
    }
}

/* 暗黑模式已内置于默认设计（面向深色主题） */
@media (prefers-color-scheme: light) {
    .status-bar.integrated {
        background-color: rgba(240, 240, 245, 0.85);
        border: 1px solid rgba(0, 0, 0, 0.1);
        color: #1d1d1f;
    }

    .status-item .value {
        color: #1d1d1f;
    }

    .status-item .label {
        color: #86868b;
    }

    .language-text {
        color: #1d1d1f;
    }
}