/*
 * 应用公共样式补充
 * 配合 cyberpunk-unified.css 使用
 * 包含尚未纳入统一样式的公共组件
 */

/* ==================== 通知弹窗 ==================== */
.app-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    z-index: 10000;
    max-width: 80%;
    text-align: center;
    animation: fadeInDown 0.3s ease-out;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.app-notification.info {
    background: rgba(0, 212, 255, 0.95);
    color: #fff;
}

.app-notification.success {
    background: rgba(0, 255, 136, 0.95);
    color: #000;
}

.app-notification.warning {
    background: rgba(255, 136, 0, 0.95);
    color: #fff;
}

.app-notification.error {
    background: rgba(255, 68, 68, 0.95);
    color: #fff;
}

.app-notification.hide {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ==================== 结果图片网格（多图展示） ==================== */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.result-item {
    background: var(--bg-card, #0d1520);
    border: 1px solid var(--border-light, rgba(0, 212, 255, 0.15));
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.result-item:hover {
    transform: translateY(-3px);
    border-color: var(--accent, #00d4ff);
}

.result-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.result-item-info {
    padding: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-item-name {
    font-size: 0.85rem;
    color: var(--text-muted, #6a8fa8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 0.5rem;
}

.result-item .btn-download {
    padding: 0.4rem 0.8rem;
    background: var(--success, #00ff88);
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s ease;
    white-space: nowrap;
}

.result-item .btn-download:hover {
    background: #00cc6a;
}

/* ==================== 下载区域 ==================== */
.download-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-card, #0d1520);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 14px;
}

.download-section h3 {
    font-size: 1.1rem;
    color: var(--accent, #00d4ff);
    margin-bottom: 1rem;
}

/* ==================== 模型加载状态 ==================== */
.model-loading {
    font-size: 0.8rem;
    color: var(--warning, #ff8800);
    margin-top: 0.3rem;
}

/* ==================== LoRA 区域 ==================== */
.lora-section {
    display: none;
    padding: 0.8rem;
    background: rgba(34, 34, 64, 0.3);
    border-radius: 8px;
    margin-bottom: 0.8rem;
    border-left: 3px solid var(--accent-purple, #b44aff);
}

.lora-section.active {
    display: block;
}

.lora-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-purple, #b44aff);
    margin-bottom: 0.8rem;
}

/* ==================== 开关组件 ==================== */
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: rgba(34, 34, 64, 0.4);
    border-radius: 10px;
    margin-bottom: 0.8rem;
    border: 1px solid rgba(180, 74, 255, 0.1);
}

.switch-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main, #e0e7ef);
}

.switch-desc {
    font-size: 0.75rem;
    color: var(--text-muted, #6a8fa8);
    margin-top: 0.2rem;
}

.switch {
    position: relative;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(102, 102, 128, 0.4);
    border-radius: 26px;
    transition: 0.3s;
}

.slider-toggle::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider-toggle {
    background: var(--accent, #00d4ff);
}

input:checked + .slider-toggle::before {
    transform: translateX(24px);
}

/* ==================== 历史缩略图区域 ==================== */
.history-section {
    margin-top: 1.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.history-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text2, #aaa);
    letter-spacing: 0.05em;
}

.history-clear-btn {
    font-size: 0.75rem;
    color: var(--muted, #666);
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 3px 10px;
    cursor: pointer;
    transition: 0.3s;
    font-family: inherit;
}

.history-clear-btn:hover {
    color: var(--red, #ff6b6b);
    border-color: var(--red, #ff6b6b);
}

.history-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    max-height: 400px;
    overflow-y: auto;
    padding-bottom: 0.5rem;
}

.history-grid::-webkit-scrollbar {
    width: 4px;
}

.history-grid::-webkit-scrollbar-thumb {
    background: var(--purple, #7b2cbf);
    border-radius: 2px;
}

.history-thumb {
    flex-shrink: 0;
    width: 150px;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    transition: 0.3s;
    background: rgba(0, 0, 0, 0.3);
}

.history-thumb:hover {
    border-color: var(--blue, #00d4ff);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

.history-thumb.active {
    border-color: var(--blue, #00d4ff);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.history-thumb .thumb-del {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.history-thumb:hover .thumb-del {
    display: flex;
}

.history-thumb .thumb-del:hover {
    background: var(--red, #ff6b6b);
}

.history-empty {
    font-size: 0.8rem;
    color: var(--muted, #666);
    text-align: center;
    padding: 1rem 0;
}

/* ==================== Lightbox 全屏预览 ==================== */
.km-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
}

.km-lightbox.open {
    display: flex;
}

.km-lightbox img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
}

.km-lb-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.km-lb-close:hover {
    background: rgba(0, 229, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.7);
}

.km-lb-close::after {
    content: '\2715';
}

.km-lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.km-lb-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.km-lb-prev {
    left: 1.5rem;
}

.km-lb-next {
    right: 1.5rem;
}

.km-lb-info {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.km-lightbox img.zooming {
    cursor: grab;
}

.km-lightbox img.zooming:active {
    cursor: grabbing;
}

.km-lightbox .lb-img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ==================== 生成按钮 ==================== */
.generate-btn,
.btn-generate {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--blue, #00d4ff), var(--purple, #b44aff));
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 700;
}

.generate-btn:hover:not(:disabled),
.btn-generate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.3);
}

.generate-btn:disabled,
.btn-generate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==================== Toast 通知 ==================== */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    background: var(--card, #1a1a2e);
    border-radius: 10px;
    border: 1px solid rgba(180, 74, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transform: translateY(100px);
    opacity: 0;
    transition: 0.3s;
    z-index: 1000;
    max-width: 350px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--green, #00ff88);
}

.toast.error {
    border-color: var(--red, #ff4444);
}

/* ==================== 页面通知弹窗 ==================== */
.notification {
    position: fixed;
    top: 60px;
    right: 15px;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    backdrop-filter: blur(10px);
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: rgba(0, 255, 136, 0.2);
    border: 1px solid rgba(0, 255, 136, 0.4);
    color: var(--green, #00ff88);
}

.notification.error {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid rgba(255, 68, 68, 0.4);
    color: var(--red, #ff4444);
}

.notification.info {
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.4);
    color: var(--blue, #00d4ff);
}
