/**
 * Image Prompt Theme - 主样式文件
 * 
 * @package Image Prompt Theme
 * @author AI Assistant
 * @version 1.0
 */

/* 基础样式 */
:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --success: #2ecc71;
    --text-color: #333;
    --text-muted: #777;
    --bg-color: #f5f5f5;
    --bg-alt: #f5f5f5;
    --card-bg: #fff;
    /* 边框颜色调浅 */
    --border-color: #f0f0f0;
    --header-bg: #fff;
    --footer-bg: #f9f9f9;
    --input-bg: #fff;
    --input-border: #ddd;
    --btn-primary-bg: #3498db;
    --btn-primary-color: #fff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --text-color: #f5f5f5;
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --border-color: #444;
    --header-bg: #222;
    --footer-bg: #222;
    --input-bg: #333;
    --input-border: #555;
    --btn-primary-bg: #3498db;
    --btn-primary-color: #fff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 'Source Han Sans SC', 'Source Han Sans', 'Noto Sans CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

.tag-link {
    display: inline-block;
    padding: 4px 12px;
    margin: 4px;
    background-color: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.tag-link:hover {
    background-color: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col-12 {
    width: 100%;
    padding: 0 15px;
}

/* 网格系统 */
.col-md-2 {
    width: 16.666667%;
}

.col-md-3 {
    width: 25%;
}

.col-md-4 {
    width: 33.333333%;
}

.col-md-6 {
    width: 50%;
}

/* 响应式调整 */
@media (max-width: 992px) {
    .col-md-3, .col-md-4, .col-md-6 {
        width: 50%;
    }
}

@media (max-width: 768px) {
    .col-md-2, .col-md-3, .col-md-4, .col-md-6 {
        width: 100%;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* 灯箱样式 */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

/* 复制按钮样式 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.copy-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

.copy-btn:hover {
    background-color: var(--primary-dark, #2980b9);
}

.copy-btn:disabled {
    background-color: var(--success, #27ae60);
}

/* Toast提示样式 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

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

/* 头部样式 */
.site-header {
    background-color: var(--header-bg);
    box-shadow: var(--shadow);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.site-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 0;
}

.site-title a {
    color: var(--text-color);
}

.site-description {
    margin: 5px 0 0;
    font-size: 0.9rem;
    color: #777;
}

/* 导航菜单 */
.main-navigation {
    display: flex;
    align-items: flex-start;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.main-navigation li {
    margin-left: 20px;
    position: relative;
}

.main-navigation a {
    color: var(--text-color);
    font-weight: 500;
    padding: 5px 0;
    display: block;
}

.main-navigation a:hover {
    color: var(--primary-color);
}

/* 搜索表单 */
.search-form {
    margin: 20px 0;
}

.search-input-group {
    display: flex;
}

.search-input-group input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--input-border);
    border-radius: 4px 0 0 4px;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.search-input-group button {
    padding: 10px 20px;
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-color);
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

/* 内容区域 */
.site-content {
    /* padding: 30px 0; */
    min-height: calc(100vh - 200px);
}

/* 提示词卡片 */
.prompt-grid {
    margin-top: 20px;
}

.prompt-card {
    margin-bottom: 30px;
}

.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.card-images {
    display: flex;
    flex-wrap: wrap;
}

.card-image {
    position: relative;
    width: 50%;
    padding-top: 50%; /* 1:1 宽高比 */
    overflow: hidden;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.card-body {
    padding: 15px;
}

.card-title {
    margin: 0 0 10px;
    font-size: 1.2rem;
}

.card-meta {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #777;
}

.card-prompt {
    margin-bottom: 15px;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 4px;
}

.prompt-label {
    font-weight: bold;
    margin-bottom: 5px;
}

.prompt-text {
    font-family: monospace;
    white-space: pre-wrap;
    font-size: 0.9rem;
}

.card-footer {
    margin-top: 15px;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 4px;
    border-radius: 0.375rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm {
    /*padding: 5px 10px;*/
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-color);
    border: none;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    color: var(--btn-primary-color);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: var(--bg-alt);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 30px 0;
}

.pagination li {
    margin: 0 5px;
}

.pagination a {
    display: block;
    padding: 8px 12px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
}

.pagination .active a {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* 详情页样式 */
.prompt-detail {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 30px;
}

.prompt-header {
    margin-bottom: 1.5rem;
}

.prompt-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.prompt-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.meta-item i {
    margin-right: 0.5rem;
}

.hover-primary:hover {
    color: var(--primary);
    transition: color 0.2s;
}

.prompt-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.4rem;
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* 新的图片展示样式 */
.carousel-container {
    margin-bottom: 3rem;
    position: relative;
}

.carousel {
    position: relative;
    overflow: hidden;
}

.carousel-item {
    display: none;
}

.carousel-item.active {
    display: block;
}

.image-pair-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: center;
}

/* 单图模式：保持与双图时左侧卡片一致的宽度，并左对齐 */
.image-pair-grid.single-output {
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    justify-items: start;
}

.image-pair-grid.single-output .arrow-container {
    display: none;
}

.image-pair-grid.single-output .card {
    width: auto;
}

.card {
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.hover-card:hover {
    transform: translateY(-0.25rem);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-weight: bold;
}

.card-content {
    padding: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}

.bg-blue {
    background-color: #3498db;
}

.bg-green {
    background-color: #2ecc71;
}

.image-container {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-alt);
    border-radius: 0.25rem;
    overflow: hidden;
}

.img-contain {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cursor-pointer {
    cursor: pointer;
}

.arrow-container {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-muted);
}

.carousel-controls {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
    gap: 6rem;
    min-height: 2.5rem;
}

.carousel-prev,
.carousel-next {
    background: var(--bg-alt);
    border: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: var(--border-color);
}

.carousel-indicators {
    display: flex;
    gap: 0.75rem; /* 增加指示器间距，避免重合 */
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.indicator {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--bg-alt);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.indicator.active {
    background: var(--primary);
    transform: scale(1.12);
}

@media (max-width: 768px) {
    .image-pair-grid:not(.single-output) {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto 1fr;
    }
    /* 移动端单图模式：左对齐，自适应宽度 */
    .image-pair-grid.single-output {
        grid-template-columns: 1fr;
    }
    .image-pair-grid.single-output .card {
        width: 100%;
    }
    
    .arrow-container {
        transform: rotate(90deg);
        margin: 1rem 0;
    }
}

.prompt-content {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.prompt-text {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 15px;
    border-radius: 4px;
    white-space: pre-wrap;
    font-family: monospace;
    overflow-x: auto;
}

/* Prompt display copy icon (hidden by default, show on hover) */
.prompt-display {
    position: relative;
    background-color: #f5f5f5; 
    padding: 10px; 
    border-radius: 4px; 
}

.prompt-display .copy-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.prompt-display:hover .copy-icon {
    opacity: 1;
    color: var(--text-color);
    background-color: rgba(0,0,0,0.03);
}

.prompt-display .copy-icon:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.12);
}

/* Copied state: green check style */
.prompt-display .copy-icon.copied {
    background-color: var(--success);
    color: #fff;
}

.example-image {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.example-image img {
    width: 100%;
    display: block;
}

.example-label {
    font-weight: bold;
}

.prompt-tags {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.post-near {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.post-near li {
    margin-bottom: 10px;
}

/* 评论区样式 */
.prompt-comments {
    margin-top: 30px;
}

.comments-title {
    font-size: 1.4rem;
    margin-bottom: 20px;
}

.comment-list {
    list-style: none;
    padding: 0;
}

.comment-body {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.comment-author {
    font-weight: bold;
}

.comment-meta {
    font-size: 0.8rem;
    color: #777;
    margin: 5px 0 10px;
}

.comment-reply-title {
    font-size: 1.2rem;
    margin: 20px 0 15px;
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-color);
}

/* 页脚样式 */
.site-footer {
    background-color: var(--footer-bg);
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
}

.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.copyright {
    font-size: 0.9rem;
}

/* 错误页面 */
.error-page {
    text-align: center;
    padding: 50px 0;
}

.error-title {
    font-size: 2rem;
    margin-bottom: 20px;
}

.error-description {
    margin-bottom: 30px;
}

.back-home {
    margin-top: 20px;
}

/* 工具类 */
.form-control {
    display: block;
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

/* 首页新卡片布局 */
.prompt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.card-image {
    position: relative;
    width: 100%;
    padding-top: 60%; /* 5:3 aspect ratio */
    overflow: hidden;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    line-height: 1.4;
}

.card-author {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: auto;
}

.card-author a {
    color: var(--text-muted);
}

.card-author a:hover {
    color: var(--primary);
}

.card-author .fa-user {
    margin-right: 0.5rem;
}


.prompt-tags {
    margin-top: 20px;
}

.tag-item {
    display: inline-block;
    background-color: #eee;
    color: #333;
    padding: 5px 10px;
    border-radius: 15px;
    margin-right: 10px;
    margin-bottom: 10px;
    font-size: 14px;
}

/* 页面卡片组间距 - 增加优先级确保生效 */
.home-section {
    margin-bottom: 20px;
}

p {
    margin:10px 0;
}

.tip-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
}