/* ===== Image Main Layout ===== */
.image-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.image-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1.5rem;
}

/* ===== Welcome / Empty State ===== */
.image-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 0;
    margin-bottom:150px;
}

.image-welcome-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.image-welcome-icon i {
    font-size: 1.8rem;
    color: var(--accent);
}

.image-welcome-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.image-welcome-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.6;
}

.image-welcome-login-btn {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.75rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #1a1a1a 0%, #000 100%);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.image-welcome-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.20);
    color: #ffffff;
}

/* ===== Gallery Grid ===== */
.image-gallery {
    flex: 1 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    padding: 1rem 0 220px 0;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    align-content: start;
}

.image-gallery-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.image-gallery-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.image-gallery-thumb {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-secondary);
}

.image-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-gallery-item:hover .image-gallery-thumb img { transform: scale(1.05); }

.image-gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-gallery-item:hover .image-gallery-item-overlay { opacity: 1; }

.image-gallery-item-action {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.image-gallery-item-action:hover {
    background: #fff;
    transform: scale(1.1);
}

.image-gallery-item-info { padding: 0.75rem; }

.image-gallery-item-prompt {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 0.4rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-gallery-item-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ===== Input Area (fixed bottom) ===== */
.image-input-area {
    position: fixed;
    bottom: 0;
    left: var(--new-sidebar-width);
    right: 0;
    background: var(--bg-primary);
    z-index: 10;
    padding: 1rem 1.5rem;
    margin: 0px 10px;
}

.image-input-area-inner {
    max-width: 800px;
    margin: 0 auto;
}

.image-input-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.image-input-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.image-input-textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
    font-family: inherit;
    min-height: 65px;
    max-height: 200px;
}

.image-input-textarea::placeholder {
    color: var(--text-muted);
}

/* ===== Params Bar (below textarea) ===== */
.image-params-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.5rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.image-params-bar-2 {
    margin-top: 0.35rem;
    padding-top: 0.4rem;
    border-top: none;
}

/* Compact select in params bar */
.image-param-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.image-param-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
}

.image-param-select {
    padding: 0.4rem 1.6rem 0.4rem 0.6rem;
    background: var(--bg-card);
    border: 1.5px solid #cccccc;
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.45rem center;
    background-size: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.image-param-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.image-param-select:hover { border-color: var(--accent); }

/* Reference image button in params bar */
.image-param-ref-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.image-param-ref-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1.5px solid #cccccc;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.image-param-ref-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 0, 0, 0.04);
}

.image-param-ref-hint {
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 500;
    white-space: nowrap;
}

.image-param-more-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1.5px solid #cccccc;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.image-param-more-btn:hover,
.image-param-more-btn.active {
    border-color: var(--accent);
    color: var(--accent);
}

/* Generate button (like chat send) */
.image-send-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1.05rem;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.image-send-btn:hover { opacity: 0.9; transform: scale(1.05); }
.image-send-btn:active { transform: scale(0.95); }
.image-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== More Params Panel ===== */
.image-more-params {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    animation: imageParamsIn 0.2s ease;
}

@keyframes imageParamsIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.image-more-params-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Each param group */
.image-param-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.image-param-label {
    font-size: 0.72rem;
   /* font-weight: 600;*/
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Chip buttons */
.image-param-chips {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.image-chip {
    padding: 0.3rem 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}

.image-chip:hover {
    border-color: #999999;
    color: var(--text-primary);
}

.image-chip.active {
    border-color: #333333;
    background: #1a1a1a;
    color: #f5f5f5;
    font-weight: 600;
}

/* Slider in more params */
.image-param-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    margin-top: 0.25rem;
}

.image-param-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.image-param-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Upload button */
.image-param-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.image-param-upload-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.image-param-hint {
    font-size: 0.72rem;
    color: var(--accent);
    margin-left: 0.35rem;
}

.image-param-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ===== File Preview Container (above textarea) ===== */
.image-files-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.image-file-item {
    position: relative;
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.image-file-thumb {
    width: 64px;
    height: 64px;
}

.image-file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-file-badge {
    position: absolute;
    top: 3px;
    left: 3px;
    padding: 1px 5px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 600;
    border-radius: 4px;
    line-height: 1.4;
}

.image-file-badge-ref {
    background: var(--accent);
}

.image-file-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.image-file-item:hover .image-file-remove { opacity: 1; }
.image-file-remove:hover { background: rgba(0, 0, 0, 0.85); }

/* Bottom hint */
.image-input-hint {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ===== Messages Area ===== */
.image-messages {
    flex: 1 0 auto;
    padding: 1rem 0 220px 0;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.image-msg-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.25rem;
}

.image-msg-user {
    align-items: flex-end;
}

.image-msg-user .image-msg-body {
    max-width: 85%;
}

.image-msg-assistant {
    flex-direction: column;
    align-items: flex-start;
}

.image-msg-assistant .image-msg-body {
    padding-left: 40px;
}

.image-msg-header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.image-msg-header .image-msg-avatar {
    margin: 0 8px 0 0;
}

.image-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--bg-secondary);
    color: var(--accent);
    border: 1px solid var(--border);
    overflow: hidden;
}

.image-msg-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.image-msg-meta {
    display: flex;
    align-items: center;
}

.image-model-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.image-msg-bubble {
   /* max-width: 85%;*/
    padding: 0.75rem 1rem;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 0.95rem;
    word-wrap: break-word;
}

.image-msg-user .image-msg-bubble {
    background: #f0f0f0;
    color: #000;
   /* border-bottom-right-radius: 4px;*/
}

.image-msg-assistant .image-msg-bubble {
    background: var(--bg-card);
   /* border: 1px solid var(--border);*/
    color: var(--text-primary);
 /*   border-bottom-left-radius: 4px;*/
}

/* ===== 参考图缩略图 ===== */
.image-msg-refs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.image-msg-ref-item {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.image-msg-ref-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-msg-time {
    display: none;
}

/* ===== Message Actions (Copy / Edit / Regenerate) ===== */
.image-msg-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
}

.image-msg-user .image-msg-actions {
    justify-content: flex-end;
}

.image-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.image-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.image-action-btn:active {
    transform: scale(0.95);
}

/* ===== User Edit Area ===== */
.image-msg-body.is-editing {
    max-width: 100% !important;
    width: 100%;
}

.user-edit-area {
    margin-top: 8px;
}

.user-edit-textarea {
    width: 100%;
    min-height: 80px;
    min-width: 400px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

.user-edit-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.user-edit-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}

.user-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.user-edit-btn.cancel-btn {
    background: transparent;
    color: var(--text-secondary);
}

.user-edit-btn.cancel-btn:hover {
    background: var(--bg-secondary);
}

.user-edit-btn.send-btn {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.user-edit-btn.send-btn:hover {
    opacity: 0.9;
}

.image-msg-status {
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 2px;
}

.image-msg-status .loading-dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    animation: imageStatusBounce 1.4s ease-in-out infinite;
}

.image-msg-status .loading-dot:nth-child(2) { animation-delay: 0.2s; }
.image-msg-status .loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes imageStatusBounce {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.3); }
}

/* Image grid inside assistant messages */
.image-msg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.image-msg-grid-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    aspect-ratio: 1;
    cursor: pointer;
}

.image-msg-grid-item-toolbar {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    z-index: 2;
}

.img-toolbar-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}

.img-toolbar-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.image-msg-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
    background: rgba(0, 0, 0, 0.03);
}

.image-msg-grid-item:hover img {
    transform: scale(1.05);
}

/* ===== 图片预览弹框 ===== */
.image-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
}

.image-preview-modal.open {
    display: block;
}

.image-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
}

.image-preview-container {
    position: absolute;
    inset: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.image-preview-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 1;
    transition: transform 0.15s ease;
}

.image-preview-close:hover {
    transform: scale(1.1);
}

/* ===== Floating Toolbox (top-right) ===== */
.image-toolbox {
    position: fixed;
    right: 16px;
    top: 16px;
    display: flex;
    gap: 6px;
    z-index: 99;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.image-toolbox.toolbox-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.toolbox-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.toolbox-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

/* ===== Right Panel (History Sidebar) ===== */
.image-right-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.image-right-panel.open {
    transform: translateX(0);
}

.right-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.right-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.right-panel-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.right-panel-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0.75rem 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.right-panel-search i {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.right-panel-search input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
}

.right-panel-search input::placeholder {
    color: var(--text-muted);
}

.right-panel-new-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 1rem 0.75rem;
    padding: 0.55rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    font-family: inherit;
}

.right-panel-new-chat:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.right-panel-history {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem;
}

.right-panel-loading,
.right-panel-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
    overflow: hidden;
}

.history-item:hover {
    background: var(--bg-secondary);
}

.history-item.active {
    background: #f0f0f0;
    color: #000;
}

.history-item i {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.history-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.history-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.history-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.history-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ===== Panel-Open State (shift main content) ===== */
.new-main-wrapper.panel-open {
    margin-right: 320px;
}

.new-main-wrapper.panel-open .image-input-area {
    right: 320px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .image-input-area {
        left: 0;
        padding: 0.75rem 1rem;
    }
    .image-container {
        padding: 1.5rem 1rem;
    }
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
        padding-bottom: 260px;
    }
    .image-more-params-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .image-toolbox {
        right: 8px;
    }

    .image-right-panel {
        width: 100vw;
    }

    .new-main-wrapper.panel-open {
        margin-right: 0;
    }

    .image-msg-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .image-gallery { grid-template-columns: 1fr; }
    .image-more-params-grid { grid-template-columns: 1fr; }
}
