/* ===== 图库选择弹窗样式 ===== */
.gallery-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 6px;
}

.gallery-image-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid #dee2e6;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    min-height: 120px;
}

.gallery-image-item img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    min-height: 120px;
}

/* 弹窗更大 */
.modal-xxl {
    max-width: 95vw;
}

/* 弹窗边框更明显 */
#galleryModal .modal-content,
#myFavoritesModal .modal-content {
    border: 2px solid #adb5bd;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    border-radius: 12px;
}

#galleryModal .modal-header,
#myFavoritesModal .modal-header {
    border-bottom: 2px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 10px 10px 0 0;
}

#galleryModal .modal-footer,
#myFavoritesModal .modal-footer {
    border-top: 2px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 0 0 10px 10px;
}

#galleryModal .modal-body,
#myFavoritesModal .modal-body {
    max-height: calc(100vh - 140px);
    min-height: 400px;
    overflow-y: auto;
    padding: 16px;
}

.gallery-image-item:hover {
    border-color: #0d6efd;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
    transform: translateY(-1px);
}

.gallery-image-item.selected {
    border-color: #198754;
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3);
    transform: translateY(-1px);
}

.gallery-image-item .check-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    background: #198754;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.gallery-image-item.selected .check-icon {
    opacity: 1;
}

#galleryCategoryList .list-group-item {
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 3px;
    border: 1px solid #dee2e6;
    font-size: 0.8rem;
    padding: 8px 12px;
}

#galleryCategoryList .list-group-item:hover {
    background: #e7f1ff;
}

#galleryCategoryList .list-group-item.active {
    background: #0d6efd;
    border-color: #0d6efd;
}

/* ===== 响应式：中等屏幕 ===== */
@media (max-width: 1200px) {
    .gallery-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }
    .gallery-image-item {
        min-height: 100px;
    }
    .gallery-image-item img {
        min-height: 100px;
    }
}

/* ===== 响应式：小屏幕 ===== */
@media (max-width: 768px) {
    .modal-xxl {
        max-width: 100vw;
        margin: 0;
    }
    #galleryModal .modal-content,
    #myFavoritesModal .modal-content {
        border-radius: 0;
        border: none;
        min-height: 100vh;
    }
    #galleryModal .modal-body,
    #myFavoritesModal .modal-body {
        max-height: calc(100vh - 110px);
        min-height: auto;
        padding: 10px;
    }
    #galleryModal .modal-header,
    #myFavoritesModal .modal-header {
        border-radius: 0;
    }
    #galleryModal .modal-footer,
    #myFavoritesModal .modal-footer {
        border-radius: 0;
    }
    .gallery-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 6px;
        max-height: 50vh;
    }
    .gallery-image-item {
        min-height: 80px;
        border-radius: 6px;
        border-width: 1px;
    }
    .gallery-image-item img {
        min-height: 80px;
    }
    .gallery-image-item .check-icon {
        width: 18px;
        height: 18px;
        font-size: 9px;
        top: 4px;
        right: 4px;
    }
    /* 小屏幕分类栏水平滚动 */
    #galleryCategoryList {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 6px;
        padding-bottom: 8px;
        flex-wrap: nowrap;
    }
    #galleryCategoryList .list-group-item {
        flex-shrink: 0;
        margin-bottom: 0;
        white-space: nowrap;
        font-size: 0.7rem;
        padding: 6px 10px;
    }
    /* 搜索框缩小 */
    #galleryModal .input-group {
        flex-wrap: nowrap;
    }
    #galleryModal .input-group .form-control {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    #galleryModal .input-group .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* ===== 响应式：极小屏幕 ===== */
@media (max-width: 480px) {
    .gallery-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 4px;
    }
    .gallery-image-item {
        min-height: 65px;
        border-radius: 4px;
    }
    .gallery-image-item img {
        min-height: 65px;
    }
    .gallery-image-item .check-icon {
        width: 16px;
        height: 16px;
        font-size: 8px;
    }
}

/* 加载动画 */
.generating-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ===== 混合方案：角色流程条 ===== */
.gen-role-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 16px;
}
.gen-role-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.gen-role-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.4s ease;
    position: relative;
}
.gen-role-icon.pm { background: #e3f2fd; color: #90caf9; border: 2px solid #bbdefb; }
.gen-role-icon.pm.active { background: linear-gradient(135deg, #1565c0, #1976d2); color: #fff; border-color: #1565c0; box-shadow: 0 4px 14px rgba(21,101,192,0.3); transform: scale(1.06); }
.gen-role-icon.pm.done { background: #e8f5e9; color: #66bb6a; border-color: #c8e6c9; }
.gen-role-icon.designer { background: #fce4ec; color: #ef9a9a; border: 2px solid #f8bbd0; }
.gen-role-icon.designer.active { background: linear-gradient(135deg, #c62828, #e91e63); color: #fff; border-color: #c62828; box-shadow: 0 4px 14px rgba(198,40,40,0.3); transform: scale(1.06); }
.gen-role-icon.designer.done { background: #e8f5e9; color: #66bb6a; border-color: #c8e6c9; }
.gen-role-icon.output { background: #fff3e0; color: #ffcc80; border: 2px solid #ffe0b2; }
.gen-role-icon.output.active { background: linear-gradient(135deg, #e65100, #f57c00); color: #fff; border-color: #e65100; box-shadow: 0 4px 14px rgba(230,81,0,0.3); transform: scale(1.06); }
.gen-role-label { font-size: 0.65rem; font-weight: 600; color: #adb5bd; transition: color 0.3s; }
.gen-role-label.active { color: #212529; }
.gen-role-status { font-size: 0.55rem; color: #c0c0c0; height: 12px; }
.gen-role-status.working { color: #1565c0; font-weight: 600; }
.gen-role-status.working.designer-color { color: #c62828; }
.gen-role-status.done-text { color: #2e7d32; }
.gen-connector { width: 32px; height: 3px; background: #e9ecef; border-radius: 2px; position: relative; overflow: hidden; margin: 0 -2px; top: -7px; }
.gen-connector.flowing::after { content: ''; position: absolute; top: 0; left: 0; height: 100%; width: 100%; background: linear-gradient(90deg, transparent, #1565c0, transparent); border-radius: 2px; animation: genFlow 1.2s ease-in-out infinite; }
.gen-connector.done-conn { background: #a5d6a7; }
@keyframes genFlow { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.gen-spinner-dot { position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: genSpin 0.7s linear infinite; }
@keyframes genSpin { to { transform: rotate(360deg); } }

/* ===== 进度条 ===== */
.gen-progress-wrap { width: 100%; height: 5px; background: #e9ecef; border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.gen-progress-fill { height: 100%; background: linear-gradient(90deg, #1565c0, #e91e63, #f57c00); border-radius: 3px; transition: width 0.6s ease; }
.gen-timer { font-size: 0.62rem; color: #6c757d; text-align: center; margin-bottom: 12px; }
.gen-timer strong { color: #212529; font-weight: 600; }

/* ===== 对话气泡 ===== */
.gen-bubble-area { width: 100%; }
.gen-bubble { display: flex; gap: 8px; align-items: flex-start; animation: genFadeIn 0.4s ease; }
@keyframes genFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.gen-bubble-avatar { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.gen-bubble-avatar.pm-av { background: linear-gradient(135deg, #1565c0, #1976d2); color: #fff; }
.gen-bubble-avatar.designer-av { background: linear-gradient(135deg, #c62828, #e91e63); color: #fff; }
.gen-bubble-content { flex: 1; background: #f8f9fa; border-radius: 8px; padding: 8px 12px; font-size: 0.65rem; color: #495057; border: 1px solid #e9ecef; }
.gen-bubble-name { font-weight: 700; font-size: 0.58rem; margin-bottom: 2px; }
.gen-bubble-name.pm-n { color: #1565c0; }
.gen-bubble-name.designer-n { color: #c62828; }
.gen-bubble.done-bubble { opacity: 0.4; }
.gen-bubble.done-bubble .gen-bubble-content { background: #fafafa; border-color: #f0f0f0; }
.gen-check { color: #2e7d32; font-weight: 600; }
.gen-typing { display: inline-flex; gap: 3px; margin-left: 3px; vertical-align: middle; }
.gen-typing span { width: 4px; height: 4px; background: #adb5bd; border-radius: 50%; animation: genTyping 1.2s infinite; }
.gen-typing span:nth-child(2) { animation-delay: 0.15s; }
.gen-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes genTyping { 0%, 60%, 100% { transform: translateY(0); opacity: 0.3; } 30% { transform: translateY(-4px); opacity: 1; } }
