/* Web8.1 移动端页面设计优化 */

/* 移动端全局优化 */
@media (max-width: 768px) {
    /* 页面整体布局 */
    body {
        font-size: 14px;
        line-height: 1.5;
        -webkit-text-size-adjust: 100%;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* 主内容区域优化 */
    .main-content {
        padding: 0.75rem;
        padding-bottom: 5rem; /* 为底部导航留出空间 */
        min-height: calc(100vh - 120px);
    }
    
    /* 页面标题优化 */
    .page-header {
        margin-bottom: 1rem;
        text-align: center;
    }
    
    .hero-title {
        font-size: 1.4rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        line-height: 1.4;
        color: #9CA3AF;
    }
}

/* 移动端提示词专区设计 */
@media (max-width: 768px) {
    /* 提示词区整体设计 */
    .templates-sidebar {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(16, 185, 129, 0.25);
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(10px);
        max-height: 500px; /* 增加高度以显示更多内容 */
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    /* 提示词区标题 */
    .templates-sidebar .pt-title {
        font-size: 1.1rem;
        font-weight: 700;
        color: #10B981;
        text-align: center;
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid rgba(16, 185, 129, 0.2);
    }
    
    /* 搜索框设计 */
    .templates-sidebar .pt-search {
        width: 100%;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(16, 185, 129, 0.3);
        border-radius: 8px;
        padding: 0.6rem 0.8rem;
        color: #e5e7eb;
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
        transition: all 0.3s ease;
    }
    
    .templates-sidebar .pt-search:focus {
        outline: none;
        border-color: #10B981;
        background: rgba(255, 255, 255, 0.15);
        box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    }
    
    /* 搜索提示标签 */
    .templates-sidebar .pt-search-hints {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        margin-bottom: 0.75rem;
    }
    
    .templates-sidebar .hint-tag {
        background: rgba(16, 185, 129, 0.12);
        border: 1px solid rgba(16, 185, 129, 0.25);
        color: #10B981;
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.2s ease;
        user-select: none;
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
    }
    
    .templates-sidebar .hint-tag:hover {
        background: rgba(16, 185, 129, 0.2);
        border-color: rgba(16, 185, 129, 0.4);
        color: #ffffff;
        transform: translateY(-1px);
        box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    }
    
    /* 推荐标签特殊样式 */
    .templates-sidebar .hint-tag.recommended {
        background: rgba(255, 165, 0, 0.15);
        border-color: rgba(255, 165, 0, 0.3);
        color: #ffa500;
        font-weight: 600;
    }
    
    .templates-sidebar .hint-tag.recommended:hover {
        background: rgba(255, 165, 0, 0.25);
        border-color: rgba(255, 165, 0, 0.5);
        color: #ffffff;
        box-shadow: 0 2px 6px rgba(255, 165, 0, 0.3);
    }
    
    /* 标签页设计 */
    .templates-sidebar .pt-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        margin-bottom: 0.75rem;
        justify-content: center;
    }
    
    .templates-sidebar .pt-tab {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: #ccc;
        border-radius: 20px;
        padding: 0.4rem 0.8rem;
        cursor: pointer;
        font-size: 0.8rem;
        transition: all 0.3s ease;
        user-select: none;
    }
    
    .templates-sidebar .pt-tab:hover {
        background: rgba(16, 185, 129, 0.15);
        border-color: rgba(16, 185, 129, 0.3);
        color: #10B981;
    }
    
    .templates-sidebar .pt-tab.active {
        color: #10B981;
        border-color: rgba(16, 185, 129, 0.4);
        background: rgba(16, 185, 129, 0.15);
        box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
    }
    
    /* 提示词列表设计 */
    .templates-sidebar .pt-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        max-height: 400px; /* 增加列表高度以显示更多内容 */
        overflow-y: auto;
        padding-right: 6px;
        margin-right: -6px;
        flex: 1;
        min-height: 0;
        scrollbar-width: thin;
        scrollbar-color: rgba(16, 185, 129, 0.4) rgba(255, 255, 255, 0.1);
    }
    
    /* 滚动条样式 */
    .templates-sidebar .pt-list::-webkit-scrollbar {
        width: 6px;
    }
    
    .templates-sidebar .pt-list::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 3px;
    }
    
    .templates-sidebar .pt-list::-webkit-scrollbar-thumb {
        background: rgba(16, 185, 129, 0.5);
        border-radius: 3px;
        transition: background 0.2s ease;
    }
    
    .templates-sidebar .pt-list::-webkit-scrollbar-thumb:hover {
        background: rgba(16, 185, 129, 0.7);
    }
    
    /* 提示词项设计 */
    .templates-sidebar .pt-item {
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 8px;
        padding: 0.75rem;
        transition: all 0.3s ease;
        cursor: pointer;
    }
    
    .templates-sidebar .pt-item:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(16, 185, 129, 0.3);
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    }
    
    .templates-sidebar .pt-item .pt-title {
        font-weight: 700;
        color: #10B981;
        margin-bottom: 0.4rem;
        font-size: 0.95rem;
        line-height: 1.3;
    }
    
    .templates-sidebar .pt-item .pt-prev {
        color: #bfc3c7;
        font-size: 0.8rem;
        margin-bottom: 0.6rem;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    /* 操作按钮设计 */
    .templates-sidebar .pt-actions {
        display: flex;
        gap: 0.4rem;
    }
    
    .templates-sidebar .pt-actions .pt-insert {
        background: rgba(16, 185, 129, 0.15);
        border: 1px solid rgba(16, 185, 129, 0.3);
        color: #10B981;
        border-radius: 6px;
        padding: 0.4rem 0.8rem;
        cursor: pointer;
        font-weight: 600;
        font-size: 0.75rem;
        flex: 1;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
    }
    
    .templates-sidebar .pt-actions .pt-insert:hover {
        background: rgba(16, 185, 129, 0.25);
        border-color: rgba(16, 185, 129, 0.5);
        color: #ffffff;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
    }
    
    .templates-sidebar .pt-actions .pt-append {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: #e5e7eb;
        border-radius: 6px;
        padding: 0.4rem 0.8rem;
        cursor: pointer;
        font-size: 0.75rem;
        font-weight: 500;
        flex: 1;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
    }
    
    .templates-sidebar .pt-actions .pt-append:hover {
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.25);
        color: #ffffff;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
}

/* 移动端任务处理区设计 */
@media (max-width: 768px) {
    .main-operations {
        width: 100%;
        flex: 1;
        min-height: 0;
    }
    
    /* 输入卡片设计 */
    .input-card {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(16, 185, 129, 0.25);
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(10px);
    }
    
    /* 功能切换标签 */
    .tab-container {
        display: flex;
        gap: 1rem;
        margin-bottom: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: 0.5rem;
    }
    
    .tab {
        position: relative;
        padding: 0.75rem 0;
        cursor: pointer;
        color: #cccccc;
        transition: color 0.3s ease;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.9rem;
        font-weight: 500;
    }
    
    .tab.active {
        color: #10B981;
    }
    
    .tab-indicator {
        position: absolute;
        bottom: -0.5rem;
        left: 0;
        right: 0;
        height: 2px;
        background: #10B981;
        border-radius: 1px;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .tab.active .tab-indicator {
        opacity: 1;
    }
    
    /* 上传区域设计 */
    .upload-section {
        margin-bottom: 1.5rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(16, 185, 129, 0.15);
        border-radius: 10px;
        padding: 1rem;
    }
    
    .upload-section h3 {
        margin-bottom: 1rem;
        color: #10B981;
        font-weight: 700;
        font-size: 1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .title-desc {
        color: #8AA3A1;
        font-size: 0.8rem;
        font-weight: 400;
        width: 100%;
        order: 2;
        margin-top: 0.25rem;
    }
    
    .image-count {
        color: #10B981;
        font-weight: 600;
        background: rgba(16, 185, 129, 0.1);
        padding: 0.2rem 0.5rem;
        border-radius: 6px;
        font-size: 0.75rem;
        flex-shrink: 0;
        order: 1;
    }
    
    /* 移动端上传区域 */
    .mobile-upload-section {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .mobile-upload-area {
        width: 100%;
        min-height: 60px; /* 减小高度，添加框变小 */
        padding: 0.8rem;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: row; /* 改回水平布局，节省空间 */
        gap: 0.6rem;
        border: 2px dashed rgba(16, 185, 129, 0.4);
        border-radius: 8px; /* 减小圆角 */
        background: rgba(16, 185, 129, 0.03);
        cursor: pointer;
        transition: all 0.3s ease;
        flex: 1; /* 占据1倍空间 */
    }
    
    .mobile-upload-area:hover {
        border-color: #10B981;
        background: rgba(16, 185, 129, 0.08);
        transform: translateY(-1px);
    }
    
    .mobile-upload-area i {
        font-size: 1.2rem;
        color: #10B981;
    }
    
    .mobile-upload-area p {
        font-size: 0.85rem;
        color: #e5e7eb;
        font-weight: 500;
        margin: 0;
    }
    
    .mobile-upload-hint {
        font-size: 0.65rem;
        color: #9ca3af;
        margin-top: 0.2rem;
    }
    
    /* 占位框设计 */
    .mobile-slots-row {
        display: flex;
        gap: 0.4rem;
        width: 100%;
        justify-content: space-between;
        padding: 0 1rem;
    }
    
    .mobile-upload-slot {
        flex: 1;
        aspect-ratio: 1; /* 确保正方形 */
        border: 2px dashed rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.02);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        position: relative;
        min-width: 0;
        box-sizing: border-box;
        max-width: calc(25% - 0.15rem); /* 确保四个框能放下 */
    }
    
    .mobile-upload-slot.occupied {
        border-color: rgba(16, 185, 129, 0.3);
        background: rgba(16, 185, 129, 0.03);
        border-style: solid;
    }
    
    .mobile-upload-slot img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 6px;
    }
    
    .mobile-upload-slot .remove-image {
        position: absolute;
        top: 4px;
        right: 4px;
        background: rgba(239, 68, 68, 0.9);
        color: white;
        border: none;
        border-radius: 50%;
        width: 20px;
        height: 20px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.7rem;
        opacity: 0;
        transition: all 0.2s ease;
        z-index: 10;
    }
    
    .mobile-upload-slot:hover .remove-image {
        opacity: 1;
        transform: scale(1.05);
    }
    
    /* 提示词输入框设计 */
    .prompt-input {
        margin-bottom: 1.25rem;
    }
    
    .prompt-label-row {
        display: flex;
        align-items: baseline;
        gap: 0.75rem;
        margin-bottom: 0.5rem;
        flex-wrap: wrap;
    }
    
    .prompt-label-row label {
        margin: 0;
        font-weight: 700;
        color: #10B981;
        font-size: 0.9rem;
    }
    
    .prompt-hint-inline {
        color: #8AA3A1;
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .prompt-textarea {
        width: 100%;
        min-height: 100px;
        background: rgba(13, 17, 23, 0.8);
        border: 1px solid rgba(16, 185, 129, 0.2);
        border-radius: 10px;
        padding: 0.8rem;
        color: #E5E7EB;
        font-size: 0.9rem;
        line-height: 1.5;
        font-family: inherit;
        resize: vertical;
        transition: all 0.3s ease;
    }
    
    .prompt-textarea:focus {
        outline: none;
        border-color: #10B981;
        box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
        background: rgba(17, 24, 39, 0.85);
    }
    
    .prompt-textarea::placeholder {
        color: #9CA3AF;
    }
    
    /* 生成按钮设计 */
    .generate-btn {
        width: 100%;
        background: linear-gradient(45deg, #10B981, #34D399);
        border: none;
        border-radius: 12px;
        padding: 1rem 1.5rem;
        color: #000000;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    }
    
    .generate-btn:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
    }
    
    .generate-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
}

/* 普通移动端优化 */
@media (max-width: 640px) {
    .templates-sidebar {
        max-height: 450px; /* 普通移动端：450px */
    }
    
    .templates-sidebar .pt-list {
        max-height: 350px; /* 普通移动端列表高度 */
    }
}

/* 小屏幕设备进一步优化 */
@media (max-width: 480px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .templates-sidebar {
        padding: 0.75rem;
        max-height: 400px; /* 小屏移动端：400px */
    }
    
    .templates-sidebar .pt-list {
        max-height: 300px; /* 小屏移动端列表高度 */
    }
    
    .templates-sidebar .pt-item {
        padding: 0.6rem;
    }
    
    .templates-sidebar .pt-item .pt-title {
        font-size: 0.9rem;
    }
    
    .templates-sidebar .pt-item .pt-prev {
        font-size: 0.75rem;
    }
    
    .templates-sidebar .pt-actions .pt-insert,
    .templates-sidebar .pt-actions .pt-append {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .input-card {
        padding: 0.75rem;
    }
    
    .mobile-upload-area {
        min-height: 70px;
        padding: 0.8rem;
    }
    
    .mobile-upload-slot {
        width: 70px;
        height: 70px;
    }
    
    .prompt-textarea {
        min-height: 90px;
        padding: 0.7rem;
        font-size: 0.85rem;
    }
    
    .generate-btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* 超小屏设备优化 */
@media (max-width: 360px) {
    .templates-sidebar {
        padding: 0.6rem;
        max-height: 350px; /* 超小屏设备：350px */
    }
    
    .templates-sidebar .pt-list {
        max-height: 250px; /* 超小屏设备列表高度 */
    }
    
    .templates-sidebar .pt-item {
        padding: 0.5rem;
    }
    
    .templates-sidebar .pt-item .pt-title {
        font-size: 0.85rem;
    }
    
    .templates-sidebar .pt-item .pt-prev {
        font-size: 0.7rem;
    }
    
    .templates-sidebar .pt-actions .pt-insert,
    .templates-sidebar .pt-actions .pt-append {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }
}
