/**
 * 文件路径: /home/ubuntu/talktalk_backend/public/css/responsive.css
 * 功能用途: 响应式设计样式，包括移动端和小屏幕适配
 * 版本: v3.0
 * 最后修改: 2025-11-27 - 切换到可爱卡通主题
 */

/* ==================== 响应式调整 ==================== */
/* Sidebar close button for mobile */
.sidebar-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: none; /* Hidden by default on desktop */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1002;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0; /* 防止变形 */
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
        --header-height: 60px;
    }

    /* Show sidebar close button on mobile */
    .sidebar-close-btn {
        display: flex; /* Use flex to center icon */
    }

    /* 小屏幕显示遮罩层 */
    .sidebar:not(.collapsed) ~ .sidebar-overlay,
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
    
    /* 侧边栏移动端全屏覆盖或大部分覆盖 */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 80%;
        max-width: 300px;
        transform: translateX(-100%);
        border-right: none;
        box-shadow: 5px 0 20px rgba(0,0,0,0.1);
        z-index: 1000;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background-color: var(--bg-sidebar);
    }
    
    /* 侧边栏展开状态 (注意：逻辑反转，collapsed为默认，移除collapsed即为展开) */
    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }
    
    /* 侧边栏折叠状态 */
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    /* 移动端主内容区：始终占满剩余空间 */
    .main-content {
        padding: 10px;
    }
    
    .app-header {
        padding: 0 15px;
        position: relative;
        z-index: 80;
        flex-shrink: 0;
        /* Ensure minimum height for header on mobile */
        min-height: var(--header-height);
    }
    
    /* Ensure panel header is visible and not cut off */
    .panel-card {
        display: flex;
        flex-direction: column;
    }
    
    .panel-card h2 {
        margin-top: 5px;
        flex-shrink: 0;
    }
    
    .header-center h2 {
        font-size: 1.2em;
    }
    
    .user-info {
        display: none; /* 移动端隐藏用户信息，节省空间 */
    }
    
    /* 表单组件适配 */
    .checkbox-group,
    .radio-group,
    .voice-options {
        flex-direction: column;
        gap: 8px;
    }

    .checkbox-label, .radio-label {
        width: 100%;
        text-align: center;
    }
    
    /* 聊天界面适配 */
    .chat-container {
        border-radius: var(--border-radius-md);
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-input-area {
        padding: 10px;
    }
    
    .input-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .cartoon-input-chat {
        min-width: 100%;
        order: 1; /* 输入框换行 */
        margin-bottom: 8px;
    }
    
    /* 调整按钮顺序 */
    .input-controls button {
        order: 2;
    }
    
    .btn-send {
        margin-left: auto; /* 推到右边 */
    }
    
    /* PTT 按钮移动端调整 */
    .cartoon-btn-ptt {
        width: 44px;
        height: 44px;
        font-size: 18px;
        margin-left: 0;
        order: 2; /* 与其他按钮同一行 */
    }
    
    /* Anime Pet 移动端调整 */
    .anime-pet-container {
        right: 5px;
        bottom: -100px; /* 默认隐藏，完全移出视野 */
        width: 80px;
        height: 80px;
        transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        /* z-index: 20; 保持默认层级，位于输入框(z-index: 30)之后，实现"探头"效果 */
    }

    .anime-pet-container.visible {
        /* 使用JS动态计算的底部位置，默认为80px作为兜底 */
        bottom: var(--mobile-pet-bottom, 80px);
    }

    .pet-wrapper {
        width: 70px;
        height: 60px;
    }
    
    .ear { width: 20px; height: 25px; }
    .ear::after { width: 12px; height: 15px; }
    
    .pet-face { top: 20px; height: 30px; }
    .pet-eyes { gap: 18px; }
    .eye { width: 8px; height: 8px; }
    .pet-cheeks { gap: 30px; margin-top: 3px; }
    .cheek { width: 8px; height: 6px; }
    .pet-mouth { width: 8px; height: 4px; }
    .paw { width: 14px; height: 10px; }
}

@media (max-width: 480px) {
    .header-right {
        gap: 5px;
    }
    
    .cartoon-btn-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    /* PTT 按钮超小屏幕调整 */
    .cartoon-btn-ptt {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .modal-content {
        width: 95%;
        padding: 0;
    }
    
    .modal-header, .modal-body {
        padding: 15px;
    }
}
