/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex: 1;
    gap: 16px;
    padding: 16px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* ===== Header ===== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #999;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
}

.api-status.connected .status-dot {
    background: #52c41a;
}

.api-status.connected .status-text {
    color: #52c41a;
}

.api-status.error .status-dot {
    background: #ff4d4f;
}

.api-status.error .status-text {
    color: #ff4d4f;
}

.btn-settings {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.btn-settings:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

/* ===== Main Content ===== */
.main-content {
    display: flex;
    flex: 1;
    gap: 16px;
    padding: 16px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.left-panel {
    width: 480px;
    min-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* ===== Upload Section ===== */
.upload-section {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.upload-area {
    position: relative;
    border: 2px dashed #d9d9d9;
    border-radius: 10px;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    background: #fafafa;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #438CE0;
    background: #f0f7ff;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #999;
}

.upload-icon {
    color: #ccc;
}

.upload-text {
    font-size: 15px;
    color: #666;
}

.upload-hint {
    font-size: 12px;
    color: #bbb;
}

.upload-preview {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-preview img {
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: 6px;
}

.btn-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-remove:hover {
    background: rgba(255, 77, 79, 0.8);
}

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

.btn-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: all 0.2s;
}

.btn-action:hover {
    border-color: #438CE0;
    color: #438CE0;
    background: #f0f7ff;
}

/* ===== Model Section ===== */
.model-section {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.model-row {
    display: flex;
    gap: 12px;
}

.model-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.model-field label {
    font-size: 12px;
    color: #999;
}

.model-field select {
    padding: 8px 10px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.model-field select:focus {
    border-color: #438CE0;
}

/* ===== Tabs Header (4 tabs) ===== */
.tabs-header {
    display: flex;
    border-bottom: 1px solid #f0f0f0;
    padding: 0 16px;
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 14px;
    color: #888;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #438CE0;
}

.tab-btn.active {
    color: #438CE0;
    font-weight: 500;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    background: #438CE0;
    border-radius: 1px;
}

/* ===== Size Options (4 options) ===== */
.size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: #438CE0;
    color: #438CE0;
}

.radio-option.active {
    border-color: #438CE0;
    background: #f0f7ff;
    color: #438CE0;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-mark {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #d9d9d9;
    position: relative;
    transition: border-color 0.2s;
}

.radio-option.active .radio-mark {
    border-color: #438CE0;
}

.radio-option.active .radio-mark::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #438CE0;
}

/* ===== Color Options (expanded) ===== */
.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: all 0.2s;
}

.color-option:hover {
    border-color: #438CE0;
}

.color-option.active {
    border-color: #438CE0;
    background: #f0f7ff;
    color: #438CE0;
}

.color-option input[type="radio"] {
    display: none;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===== Results Layout (standard + HD side by side) ===== */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.results-top-row {
    display: flex;
    gap: 16px;
}

.results-top-row .result-card {
    flex: 1;
}

.result-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    color: #666;
}

.result-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-header-actions {
    display: flex;
    gap: 4px;
}

.btn-header-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: #999;
    transition: all 0.2s;
}

.btn-header-action:hover {
    background: #f0f0f0;
    color: #438CE0;
}

.result-icon {
    display: flex;
    align-items: center;
    color: #999;
}

.result-title {
    font-weight: 500;
}

.result-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 260px;
    background: #fafafa;
}

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #ccc;
}

.result-placeholder svg {
    color: #ddd;
}

.result-placeholder p {
    font-size: 13px;
}

.result-body img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 4px;
}

.result-actions {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-top: 1px solid #f5f5f5;
    justify-content: flex-end;
}

.btn-result-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: #888;
    transition: all 0.2s;
}

.btn-result-action:hover {
    background: #f0f0f0;
    color: #438CE0;
}

/* ===== Layout Photo Grid ===== */
.layout-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.layout-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 16px;
}

.layout-grid-item {
    aspect-ratio: 3/4;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layout-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Collapsible Sections ===== */
.collapsible-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    user-select: none;
}

.collapsible-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #999;
    transition: transform 0.3s;
}

.btn-toggle.collapsed {
    transform: rotate(-90deg);
}

.collapsible-body {
    padding: 12px 14px;
    transition: max-height 0.3s ease;
}

.collapsible-body.hidden {
    display: none;
}

/* ===== Params Section ===== */
.params-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.tab-content {
    display: none;
    padding: 16px;
}

.tab-content.active {
    display: block;
}

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

.param-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 10px;
}

.param-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.param-select:focus {
    border-color: #438CE0;
}

.generate-section {
    margin-top: 8px;
}

.btn-generate {
    width: 100%;
    padding: 14px;
    border: none;
    background: linear-gradient(135deg, #438CE0, #2563eb);
    color: #fff;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(67, 140, 224, 0.3);
}

.btn-generate:hover:not(:disabled) {
    background: linear-gradient(135deg, #3a7bd5, #1d4ed8);
    box-shadow: 0 6px 16px rgba(67, 140, 224, 0.4);
    transform: translateY(-1px);
}

.btn-generate:disabled {
    background: #d9d9d9;
    box-shadow: none;
    cursor: not-allowed;
}

.param-range {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: #e8e8e8;
    border-radius: 3px;
    outline: none;
}

.param-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #438CE0;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(67, 140, 224, 0.3);
}

.param-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #438CE0;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.range-value {
    font-size: 13px;
    color: #438CE0;
    min-width: 36px;
    text-align: right;
}

.param-range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== Hanfu Section ===== */
.hanfu-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fff7e6;
    border: 1px solid #ffd591;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 12px;
    color: #d48806;
}

.hanfu-notice svg {
    flex-shrink: 0;
    color: #faad14;
}

.hanfu-category-tabs {
    display: flex;
    gap: 8px;
}

.hanfu-cat-btn {
    padding: 8px 20px;
    border: 1px solid #e8e8e8;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.hanfu-cat-btn:hover {
    border-color: #438CE0;
    color: #438CE0;
}

.hanfu-cat-btn.active {
    border-color: #438CE0;
    background: #f0f7ff;
    color: #438CE0;
    font-weight: 500;
}

.hanfu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.hanfu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px;
    border: 2px solid #f0f0f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.hanfu-item:hover {
    border-color: #438CE0;
    background: #f0f7ff;
}

.hanfu-item.selected {
    border-color: #438CE0;
    background: #f0f7ff;
    box-shadow: 0 0 0 2px rgba(67, 140, 224, 0.15);
}

.hanfu-item-preview {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    position: relative;
    overflow: hidden;
}

.hanfu-item-name {
    font-size: 12px;
    color: #555;
    text-align: center;
    font-weight: 500;
}

.hanfu-item-tag {
    font-size: 10px;
    color: #999;
    text-align: center;
}

/* Color Scheme Options */
.color-scheme-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-scheme-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    color: #555;
    transition: all 0.2s;
}

.color-scheme-option:hover {
    border-color: #438CE0;
}

.color-scheme-option.active {
    border-color: #438CE0;
    background: #f0f7ff;
    color: #438CE0;
}

.color-scheme-option input[type="radio"] {
    display: none;
}

.scheme-mark {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #d9d9d9;
    position: relative;
    transition: border-color 0.2s;
}

.color-scheme-option.active .scheme-mark {
    border-color: #438CE0;
}

.color-scheme-option.active .scheme-mark::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #438CE0;
}

.param-range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Hanfu Preview */
.hanfu-preview-area {
    margin: 16px 0;
}

.hanfu-canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background: #fafafa;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
}

#hanfuCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hanfu-canvas-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ccc;
}

.hanfu-canvas-placeholder svg {
    color: #ddd;
}

.hanfu-canvas-placeholder p {
    font-size: 13px;
}

.btn-hanfu-generate {
    background: linear-gradient(135deg, #e8590c, #d9480f) !important;
    box-shadow: 0 4px 12px rgba(232, 89, 12, 0.3) !important;
}

.btn-hanfu-generate:hover:not(:disabled) {
    background: linear-gradient(135deg, #d9480f, #bf360c) !important;
    box-shadow: 0 6px 16px rgba(232, 89, 12, 0.4) !important;
}

/* ===== Social Templates ===== */
.social-templates,
.matting-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.template-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.btn-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #999;
    transition: transform 0.3s;
}

.btn-toggle.collapsed {
    transform: rotate(-90deg);
}

.template-body {
    padding: 12px 14px;
}

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

.template-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.template-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.template-preview:hover {
    transform: scale(1.05);
}

.template-item span {
    font-size: 12px;
    color: #888;
}

.matting-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    background: repeating-conic-gradient(#e8e8e8 0% 25%, transparent 0% 50%) 50% / 16px 16px;
    border-radius: 8px;
    color: #999;
    font-size: 13px;
}

.matting-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: #fff;
    padding: 40px 48px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f0f0f0;
    border-top-color: #438CE0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.loading-subtext {
    font-size: 13px;
    color: #999;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: #fff;
    border-radius: 16px;
    width: 440px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.btn-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: #999;
    transition: all 0.2s;
}

.btn-close:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 20px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: #438CE0;
}

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

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-test {
    padding: 8px 20px;
    border: 1px solid #438CE0;
    background: #fff;
    color: #438CE0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-test:hover {
    background: #f0f7ff;
}

.btn-save {
    padding: 8px 20px;
    border: none;
    background: #438CE0;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save:hover {
    background: #3a7bd5;
}

/* ===== Fullscreen ===== */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.btn-close-fullscreen {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-close-fullscreen:hover {
    background: rgba(255, 255, 255, 0.2);
}

.fullscreen-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 10px 24px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: #52c41a;
}

.toast.error {
    background: #ff4d4f;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .left-panel {
        width: 100%;
        min-width: unset;
    }

    .results-section {
        flex-wrap: wrap;
    }

    .result-card {
        min-width: 200px;
    }
}

@media (max-width: 640px) {
    .model-row {
        flex-direction: column;
    }

    .results-section {
        flex-direction: column;
    }

    .template-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
