/* 响应式布局优化 */
/* 聊天系统布局优化 */

/* 基础设置 */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* 固定顶部导航栏 */
.navbar {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 3.25rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 主体内容区域 */
body {
    padding-top: 3.25rem;
}

main {
    height: calc(100vh - 3.25rem);
    overflow: hidden;
}

/* 聊天界面响应式 */
/* 聊天界面响应式 */
.chat-container {
    display: flex;
    height: calc(100vh - 6.5rem); /* 减去导航栏和padding */
    overflow: hidden;
    margin-top: 0;
}

.chat-sidebar {
    width: 300px;
    min-width: 250px;
    border-right: 1px solid #dbdbdb;
    overflow-y: auto;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid #dbdbdb;
    background: #fafafa;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f5f5f5;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid #dbdbdb;
    background: white;
}

/* 消息气泡样式 */
.message-bubble {
    max-width: 70%;
    margin-bottom: 1rem;
    word-wrap: break-word;
}

.message-bubble.own {
    margin-left: auto;
    margin-right: 0;
}

.message-bubble.other {
    margin-left: 0;
    margin-right: auto;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    position: relative;
}

.message-bubble.own .message-content {
    background: #3273dc;
    color: white;
}

.message-bubble.other .message-content {
    background: white;
    border: 1px solid #dbdbdb;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

/* 文件上传区域 */
.file-upload-area {
    border: 2px dashed #dbdbdb;
    border-radius: 6px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: #3273dc;
    background-color: #f0f8ff;
}

.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.file-preview-item {
    position: relative;
    border: 1px solid #dbdbdb;
    border-radius: 6px;
    padding: 0.5rem;
    background: white;
    max-width: 200px;
}

.file-preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff3860;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
}

/* 平板设备 (768px - 1023px) */
@media screen and (max-width: 1023px) {
    .chat-sidebar {
        width: 250px;
        min-width: 200px;
    }
    
    .message-bubble {
        max-width: 80%;
    }
    
    .container {
        padding: 0 0.75rem;
    }
    
    .box {
        margin-bottom: 1rem;
    }
    
    .level {
        flex-direction: column;
        align-items: stretch;
    }
    
    .level-left,
    .level-right {
        margin-bottom: 0.75rem;
    }
}

/* 手机设备 (最大 767px) */
@media screen and (max-width: 767px) {
    .chat-container {
        flex-direction: column;
        height: calc(100vh - 3.25rem);
    }
    
    .chat-sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #dbdbdb;
    }
    
    .chat-main {
        height: calc(100vh - 200px - 3.25rem);
    }
    
    .message-bubble {
        max-width: 90%;
    }
    
    .container {
        padding: 0 0.5rem;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .box {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .media {
        flex-direction: column;
        text-align: center;
    }
    
    .media-left,
    .media-right {
        margin-bottom: 0.5rem;
    }
    
    .media-content {
        margin-left: 0;
        margin-right: 0;
    }
    
    .button {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .field.has-addons {
        flex-direction: column;
    }
    
    .field.has-addons .control {
        margin-bottom: 0.5rem;
    }
    
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination-list {
        order: 1;
        margin-bottom: 0.5rem;
    }
    
    .pagination-previous,
    .pagination-next {
        order: 2;
        margin: 0 0.25rem;
    }
    
    /* 聊天输入框优化 */
    .chat-input .field.has-addons {
        flex-direction: row;
    }
    
    .chat-input .control.is-expanded {
        flex: 1;
    }
    
    .chat-input .button {
        width: auto;
        margin-bottom: 0;
        margin-left: 0.5rem;
    }
    
    /* 文件上传优化 */
    .file-upload-area {
        padding: 1rem;
    }
    
    .file-preview {
        justify-content: center;
    }
    
    .file-preview-item {
        max-width: 150px;
    }
}

/* 超小屏幕设备 (最大 480px) */
@media screen and (max-width: 480px) {
    .container {
        padding: 0 0.25rem;
    }
    
    .title {
        font-size: 1.25rem;
    }
    
    .box {
        padding: 0.75rem;
    }
    
    .chat-sidebar {
        height: 150px;
    }
    
    .chat-main {
        height: calc(100vh - 150px - 3.25rem);
    }
    
    .message-bubble {
        max-width: 95%;
    }
    
    .message-content {
        padding: 0.5rem 0.75rem;
    }
    
    .file-preview-item {
        max-width: 120px;
    }
    
    .image.is-64x64 {
        width: 48px;
        height: 48px;
    }
    
    .image.is-48x48 {
        width: 40px;
        height: 40px;
    }
}

/* 打印样式 */
@media print {
    .chat-sidebar,
    .chat-input,
    .button,
    .pagination {
        display: none !important;
    }
    
    .chat-main {
        width: 100% !important;
    }
    
    .message-bubble {
        max-width: 100%;
        break-inside: avoid;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .message-content {
        border-width: 2px;
    }
    
    .file-upload-area {
        border-width: 3px;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .chat-messages {
        background: #2b2b2b;
    }
    
    .message-bubble.other .message-content {
        background: #404040;
        color: #ffffff;
        border-color: #555555;
    }
    
    .file-upload-area {
        background: #404040;
        border-color: #555555;
        color: #ffffff;
    }
    
    .box {
        background: #404040;
        color: #ffffff;
    }
}