/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    height: 100vh;
    overflow: hidden;
}

.menu {
    height: calc(100vh - 144px);
}

a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
}

/* 布局样式 */
.layout-wrapper {
    display: flex;
    height: calc(100vh - 64px);
}

.content-flexible {
    width: 100%;
    padding: 0 24px;
}

/* 主内容区样式 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 内容区域样式 */
.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f7fb;
    border-top-left-radius: 10px;
    border-top: 1px solid #e5e7eb;
    border-left: 1px solid #e5e7eb;
}

.btn {
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    font-size: 14px;
}

.btn-primary {
    background: #1677ff;
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #165dff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(22, 119, 255, 0.25);
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 10px;
    padding: 5px 10px;
}

.btn-secondary:hover {
    background: #d5dbdb;
}


.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 10px;
}

.page-header .header-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
}

.page-header h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 10px;
    position: relative;
    padding-bottom: 10px;
}

.page-header h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: #1677ff;
    border-radius: 3px;
}

.page-header p {
    color: #7f8c8d;
    font-size: 1rem;
}

/* 工具容器样式 */
.tool-container {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.tool-container h3 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Collapse to single column when only one visible .form-group remains */
.form-row:not(:has(> .form-group:not([style*="display:none"]) ~ .form-group:not([style*="display:none"]))) {
    grid-template-columns: 1fr;
}

/* Explicit single-column class as JS fallback */
.form-row.two .single {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 0;
}

.form-row.two .single .form-group {
    margin-bottom: 0;
}

.predef-gallery {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

#dp-style-gallery {
    display: flex;
    gap: 10px;
}

#dp-style-gallery .predef-item {
    width: 120px;
}

#dp-style-gallery .predef-item img {
    margin: 0;
    width: 100%;
}

.predef-gallery19 {
    grid-template-columns: repeat(19, 1fr);
    gap: 8px;
}

.predef-gallery10 {
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
}

.threes {
    display: flex;
}

.predef-item {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    text-align: center;
}

.predef-item img {
    width: 100%;
    /* height: 120px; */
    object-fit: cover;
    display: block;
}

.predef-item .caption,
.predef-item .thumb.none {
    padding: 8px;
    font-size: 12px;
    color: #374151;
}

.predef-item .thumb.none {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 500;
}

.predef-item.active {
    border-color: #1677ff;
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.15);
}

#psr-style-index-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

#psr-style-select-form .layui-form-select {
    display: none !important;
}

.vm-help {
    cursor: pointer;
    color: #9ca3af;
}

.layui-layer-tips .layui-layer-content {
    color: #222 !important;
    border-radius: 8px !important;
}


.form-group {
    margin-bottom: 20px;
}

.form-group .form-group {
    margin-bottom: 0;
}

.form-group.five .form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #1f2937;
}

.form-group label i {
    font-size: 12px;
    color: #6c757d;
    margin-left: 5px;
}

.form-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8l4 4l4-4' fill='none' stroke='%23bfc3cc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px 14px;
    padding-right: 40px;
}

.form-group select:focus {
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8l4 4l4-4' fill='none' stroke='%231677ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-help {
    background: #eaf4ff;
    border-left: 4px solid #1677ff;
    padding: 16px 18px;
    margin-bottom: 22px;
    border-radius: 10px;
}

.form-help p {
    margin: 0;
    color: #2c3e50;
    font-size: 0.9rem;
    line-height: 1.5;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    background-color: #fff;
}

.checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    height: 35px;
}

.checkbox-group label {
    font-weight: normal;
    margin-bottom: 0;
    display: flex;
    align-items: center;
}

.checkbox-group input {
    width: auto;
    margin-right: 8px;
}

.result-container {
    margin-top: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #1677ff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.result-container h4 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.result-content {
    line-height: 1.6;
}

/* 结果工具栏与大图展示 */
.result-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.result-title {
    font-weight: 600;
    color: #2c3e50;
}

.result-image img {
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    max-height: 400px;
}


/* 聊天容器样式 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    margin-bottom: 20px;
}

.message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.message.bot {
    align-items: flex-start;
}

.message.user {
    align-items: flex-end;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.message.bot .message-content {
    background: #e3f2fd;
    border-bottom-left-radius: 4px;
}

.message.user .message-content {
    background: #3498db;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: #95a5a6;
    margin-top: 5px;
}

.chat-input {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
}

.chat-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.chat-input input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 统计卡片样式 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #eee;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.stat-card h3 {
    font-size: 1rem;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-desc {
    font-size: 0.9rem;
    color: #95a5a6;
}

/* 最近活动样式 */
.recent-activity {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.recent-activity h3 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 20px;
}

.activity-list {
    list-style: none;
}

.activity-item {
    padding: 15px 0;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
}

.activity-item:last-child {
    border-bottom: none;
}

.time {
    font-weight: 600;
    color: #3498db;
    min-width: 80px;
}

.desc {
    color: #7f8c8d;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
    }

    .menu-item .text,
    .menu-item .arrow,
    .submenu {
        display: none;
    }

    .menu-item {
        justify-content: center;
        padding: 25px 0;
    }

    .menu-item .icon {
        margin-right: 0;
        font-size: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-row.four {
        grid-template-columns: 1fr;
    }

    .form-row.five {
        grid-template-columns: 1fr;
    }

    .form-row.three {
        grid-template-columns: 1fr;
    }

    .form-row.two-wide {
        grid-template-columns: 1fr;
    }



    .checkbox-group {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .topbar {
        padding: 0 15px;
        flex-direction: column;
        height: auto;
        padding: 15px;
    }

    .topbar-left,
    .topbar-right {
        margin-bottom: 10px;
    }

    .content-wrapper {
        padding: 15px;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .tool-container {
        padding: 20px;
    }

    .chat-container {
        height: 400px;
    }
}

/* 页面局部通用 */
.required {
    color: red;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.image-preview-row,
.generated-row {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 12px;
}

.image-preview-row img {
    max-height: 350px;
    max-width: 100%;
    width: auto;
    border-radius: 8px;
    display: block;
    object-fit: contain;
    flex: 0 0 auto;
}

#vm-base-preview img,
#vm-mask-preview img,
#ii-base-image-preview img,
#ii-mask-image-preview img {
    max-height: 650px;
    border-radius: 0
}

.generated-row img {
    max-height: 400px;
    width: auto;
    border-radius: 8px;
    display: block;
    object-fit: contain;
    flex: 0 0 auto;
}

.form-row.two {
    display: flex;
    gap: 50px;
    align-items: flex-start;
}

.form-row.three {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.form-row.two-wide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-row.four {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.form-row.five {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
}

#vm-v2-extra-row {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#vm-v2-extra-row .form-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

#vm-v2-extra-row .form-group label {
    flex: 0 0 120px;
    margin: 0;
}

#vm-v2-extra-row .form-group .form-control-inline {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

#vm-v2-extra-row .form-control-inline>select,
#vm-v2-extra-row .form-control-inline>input[type="number"] {
    width: 260px;
    max-width: 100%;
}

#vm-v2-extra-row .layui-slider {
    flex: 1;
}

.form-hint {
    color: #6b7280;
    font-size: 12px;
    margin-top: 5px;
}

#vm-v2-extra-row .form-hint {
    margin-top: 0;
}

.form-row.two .form-group {
    flex: 1;
}


.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px 9px;
    font-size: 14px;
    color: #111827;
    background-color: #fff;
}

.form-group textarea {
    min-height: 80px;
}

.form-group input[type="file"] {
    padding: 8px 0;
}

.alert-inline {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #B91C1C;
    padding: 10px 12px;
    border-radius: 6px;
    line-height: 1.5;
}

.file-input {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 3px;
    background-color: #fff;
}

.hidden-file {
    position: absolute;
    left: -9999px;
}

.file-name {
    color: #6b7280;
    font-size: 0.95rem;
}

/* Layui Switch theme and layout */
.switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.layui-form-switch {
    background: #dcdfe6;
    border-color: #dcdfe6;
    border-radius: 12px;
    margin-top: 0;
    width: 40px;
}

.layui-form-switch em {
    display: none;
}

.layui-form-switch i {
    top: 2px;
    background: #fff;
}

.layui-form-onswitch {
    background: #1677ff;
    border-color: #1677ff;
}

.layui-form-switch+.switch-label {
    margin-bottom: 0;
    transition: color .2s ease;
}

.layui-form-switch.layui-form-onswitch+.switch-label {
    color: #1677ff;
}

.checkbox-group {
    margin-top: 4px;
}

.actions {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

form>.actions {
    margin: 10px auto;
    width: 200px;
    flex-direction: column;
    gap: 4px;
}

.model-quota-info {
    color: #878aab;
    font-size: 12px;
}

.model-quota-info a {
    color: #56597e;
    font-size: 12px;
    margin-right: 4px;
}

.model-quota-info span {
    color: #56597e;
    margin-left: 2px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

.checkbox-group label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #374151;
}



.image-preview-row {
    border: 1px dashed #e5e7eb;
    padding: 8px;
    border-radius: 10px;
    background: #fafafa;
    position: relative;
    margin-top: 12px;
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
}

.image-preview-row .image-thumb {
    flex: 0 1 auto;
    min-width: 0;
}

.image-preview-row .image-thumb img {
    max-width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
}

.source-switch {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

/* .source-switch .btn {
    min-width: 96px;
} */

.source-switch .btn.active {
    background: #1677ff;
    color: #fff;
}

.paste-box {
    height: 40px;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 8px;
    background: #fafafa;
    overflow: auto;
    outline: none;
}

.paste-box:empty::before {
    content: '\8BF7\5C06\56FE\7247\7C98\8D34\5230\6B64\5904 (Ctrl+V)';
    color: #9ca3af;
    font-size: 14px;
    display: block;
    pointer-events: none;
}

.dnd-box {
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    color: #6b7280;
    height: 40px;
}

/* 图片编辑遮罩工具栏样式 */
.vm-mask-inline-tools {
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 40px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    white-space: nowrap;
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: 100%;
    margin-top: 10px;
    box-sizing: border-box;
}

.tools-row {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
}

.tools-row>div {
    width: 80px;
    display: flex;
}

.tools-row>span {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.tools-row .layui-slider {
    width: 80px;
    display: inline-block;
}

.tools-row .btn {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 20px;
    margin-left: 5px;
}

.tools-row .erase {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.tools-row .erase input {
    margin: 0;
    margin-right: 4px;
    width: 14px;
    height: 14px;
    display: inline-block;
    vertical-align: middle;
    -webkit-appearance: checkbox;
    appearance: checkbox;
}

.layui-form-select dl dd.layui-this {
    background-color: #1677ff;
}

.psr-demo-btn {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 20px;
    margin-left: 5px;
}

.form-row-flex {
    display: flex;
    align-items: center;
    gap: 100px;
    justify-content: flex-start;
}

.result-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.result-title {
    font-weight: 600;
    font-size: 16px;
    color: #0a7f3f;
}

.result-title.error {
    color: #d32f2f;
}

/* 通用示例图片容器样式 */
.generic-examples-container {
    padding: 12px;
}

.generic-examples-container .clx-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.generic-examples-container.layui-layer-wrap {
    width: 90vw;
    max-width: 980px;
    max-height: 600px;
    overflow: auto;
    box-sizing: border-box;
}

.generic-examples-container .clx-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    background: #fff;
    transition: all .2s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    overflow: hidden;
}

.generic-examples-container .clx-card:hover {
    border-color: #1677ff;
    box-shadow: 0 6px 18px rgba(22, 119, 255, .12);
}

.generic-examples-container .clx-card img {
    max-height: 160px;
    width: auto;
    display: block;
    margin: 0 auto;
}

.generic-examples-container .clx-card .img-wrapper-monitored {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.generic-examples-container .example-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: #333;
    width: 100%;
}

.generic-examples-container .example-images-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
    margin-bottom: 8px;
}

.generic-examples-container .example-images-row img {
    display: block;
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    height: auto;
    max-height: 140px;
    object-fit: contain;
    border-radius: 4px;
    background: #f5f5f5;
}

.generic-examples-container .example-images-row img:only-child {
    flex: 0 0 100%;
    max-height: 160px;
    background: transparent;
}

.generic-examples-container .example-prompt {
    font-size: 12px;
    color: #777;
    line-height: 1.4;
    width: 100%;
    /* overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    max-height: 48px; */
    margin-top: 10px;
}

.generic-examples-container .hidden-prompt {
    display: none;
}

.ai-loading {
    padding: 30px;
    text-align: center;
    color: #555;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 10px 0;
}

.ai-loading .timer {
    font-weight: bold;
    color: #1677ff;
    font-family: monospace;
    font-size: 1.2em;
    margin: 0 4px;
}

.poster-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.poster-item {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    /* background: #fff; */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.poster-item img {
    width: 100%;
    height: auto;
    display: block;
}

.card-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid #f1f5f9;
}

.upgrade-results {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e5e7eb;
}

.upgrade-section {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
}

.upgrade-section p {
    padding: 5px 10px;
}

.upgrade-title {
    font-weight: 600;
    color: #2c3e50;
    margin-left: 8px;
    margin-bottom: 8px;
}

.upgrade-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0 0;
    padding: 10px 12px;
    border: 1px solid #ffd6d6;
    background: #fff3f3;
    color: #8a0c0c;
    border-radius: 8px;
}

.upgrade-error .error-icon {
    color: #b00020;
    font-size: 16px;
    line-height: 1;
}

.upgrade-error .error-text {
    font-size: 13px;
    line-height: 1.6;
}

/* Unified Result Layout */
.ai-result-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    width: 100%;
    overflow-x: hidden;
    /* Strict no scroll */
    align-items: flex-start;
}

.ai-result-item {
    flex: 0 1 auto;
    /* Allow shrinking */
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    /* Crucial for shrinking */
    max-width: 100%;
}

.ai-result-item .media-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
    background: #fafafa;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.ai-result-item .media-wrapper img,
.ai-result-item .media-wrapper video {
    display: block;
    max-height: 400px;
    width: auto;
    max-width: 100%;
    /* Shrink if container is smaller */
    object-fit: contain;
}

.ai-result-item .actions {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ai-result-item .btn-direct-download {
    font-size: 12px;
    padding: 4px 12px;
    width: 30%;
    white-space: nowrap;
    margin-bottom: 5px;
}

/* Inline Mask Drawer Layout Fix */
.image-preview-row.has-inline-tools {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 60px;
    /* Space for toolbar */
    display: flex;
    align-items: flex-start;
}

.image-preview-row.has-inline-tools .image-thumb {
    flex-shrink: 0;
}

.image-preview-row.has-inline-tools .vm-mask-inline-tools {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    margin-top: 0;
    z-index: 100;
}

/* Global AI Hint Styles */
.global-ai-hint {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 5px;
}

.global-ai-hint.info {
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
    color: #0050b3;
}

.global-ai-hint.warn {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    color: #d48806;
}

.global-ai-hint .btn-link {
    color: #1890ff;
    text-decoration: none;
    font-weight: 600;
    margin-left: 5px;
}

.global-ai-hint .btn-link:hover {
    text-decoration: underline;
}

.header-price-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 10px;
    margin-bottom: 10px;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 4px;
    background-color: #e6f7ff;
    color: #1890ff;
    display: none;
}

#psr-style-select-form .layui-form-select .layui-anim.up {
    top: 38px !important;
    bottom: auto !important;
}

#psr-style-select-form .layui-form-select dl {
    max-height: 260px;
    overflow: auto;
}

.generic-demo-btn {
    margin-left: 10px;
    border-radius: 10px;
    padding: 2px 10px;
    font-size: 12px;
}

#wordart-steps-slider .layui-slider {
    min-width: 150px;
}

#wordart-texture-short-size-slider .layui-slider {
    min-width: 150px;
}

#wordart-texture-params-group .layui-form-switch {
    margin: 13px 0;
    display: block;
}

#wordart-texture-params-group .form-control-inline {
    margin: 22px 0;
}

#wordart-semantic-form .form-control-inline {
    margin: 22px 0;
}

.predef-gallery .img-info-badge {
    display: none;
}

.poster-example-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
}

.poster-example-card {
    width: 220px;
    cursor: pointer;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}

.poster-example-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #1677ff;
}

.poster-example-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.poster-example-card .caption {
    padding: 10px;
    text-align: center;
    font-weight: bold;
    background: #f9f9f9;
}

.sharemodal {
    margin-top: 60px;
    text-align: center;
}

.sharemodal .btn {
    background: rgb(0 0 0 / 5%);
    padding: 10px 30px;
}

/* Lightbox Styles */
.image-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 20000000;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.image-viewer-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.image-viewer-close {
    position: absolute;
    top: 10px;
    right: 20px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    z-index: 20000001;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    line-height: 46px;
    text-align: center;
    border-radius: 50%;
}

/* Image Badge Styles */
.img-wrapper-monitored {
    position: relative;
    /* display: inline-block; */
    max-width: 100%;
    overflow: hidden;
}

.img-info-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    pointer-events: none;
    z-index: 10;
    line-height: 1.2;
    backdrop-filter: blur(2px);
}

.form-group .layui-slider-input-txt input {
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    display: inline-block !important;
}

#tryon-model-examples {
    padding: 12px;
}

#tryon-model-examples .tmx-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

#tryon-model-examples .tmx-tab {
    border: 1px solid #e5e7eb;
    background: #f6f8fa;
    color: #374151;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

#tryon-model-examples .tmx-tab.active {
    background: #1677ff;
    color: #fff;
    border-color: #1677ff;
}

#tryon-model-examples .tmx-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

#tryon-model-examples .tmx-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    gap: 12px;
    cursor: pointer;
    background: #fff;
    position: relative;
}

#tryon-model-examples .tmx-card:hover {
    border-color: #1677ff;
    box-shadow: 0 6px 18px rgba(22, 119, 255, .15);
}

#tryon-model-examples .tmx-info {
    flex: 1;
    color: #1f2937;
}

#tryon-model-examples .tmx-info h4 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
}

#tryon-model-examples .tmx-info .style {
    color: #374151;
    margin-bottom: 6px;
}

#tryon-model-examples .tmx-info .meta {
    color: #374151;
    font-size: 13px;
    line-height: 1.6;
}

#tryon-model-examples .tmx-info .meta .kv-row {
    line-height: 1.6;
}

#tryon-model-examples .tmx-info .meta .kv-key {
    display: inline-block;
    width: 42px;
    color: #6b7280;
}

#tryon-model-examples .tmx-info .meta .kv-val {
    color: #1f2937;
    font-weight: 600;
}

#tryon-model-examples .tmx-card img {
    max-height: 220px;
    display: block;
    border-radius: 6px;
}

#tryon-model-examples .tmx-radio {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    background: #fff;
    z-index: 1;
}

#tryon-model-examples .tmx-card.selected .tmx-radio {
    border-color: #1677ff;
    background: #1677ff;
}