/**
 * 画廊区块样式
 *
 * UI 设计规范：禁止使用渐变色。
 * 采用父主题一致的明暗模式选择器。
 *
 * 明色模式选择器：body 无 data-scheme 属性或 data-scheme="light"
 * 暗色模式选择器：body[data-scheme="dark"]
 * 跟随系统：@media (prefers-color-scheme: dark) 配合 body[data-scheme="auto"]
 *
 * @package Alright_Child
 */

/* ================================================================
   1. 布局 - 瀑布流（CSS Columns）
   ================================================================ */

.alright-gallery {
    margin: 1.25rem 0;
}

.gallery-grid {
    column-gap: 10px;
}

.gallery-grid[data-columns="1"] { column-count: 1; }
.gallery-grid[data-columns="2"] { column-count: 2; }
.gallery-grid[data-columns="3"] { column-count: 3; }
.gallery-grid[data-columns="4"] { column-count: 4; }
.gallery-grid[data-columns="5"] { column-count: 5; }
.gallery-grid[data-columns="6"] { column-count: 6; }

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 10px;
    background: transparent;
    border: none;
}

body[data-scheme="dark"] .gallery-item {
    background: transparent;
    border: none;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-item {
        background: transparent;
        border: none;
    }
}

.gallery-img-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    line-height: 0;
    border-radius: 4px;
}

.gallery-img-wrap a {
    display: block;
}

.gallery-img {
    width: 100%;
    height: auto;
    display: block;
    transition: filter 0.3s ease, transform 0.3s ease;
}

.gallery-item:hover .gallery-img {
    transform: scale(1.02);
}

/* ================================================================
   2. 锁定状态
   ================================================================ */

.gallery-item-locked .gallery-img {
    filter: blur(12px);
    -webkit-filter: blur(12px);
    user-select: none;
    pointer-events: none;
}

.gallery-item-unlocked .gallery-img {
    filter: none;
    -webkit-filter: none;
}

/* 锁定的覆盖层 - 居中卡片样式 */
.gallery-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    z-index: 2;
    opacity: 1;
    transition: opacity 0.3s ease;
    padding: 16px;
}

.gallery-item-unlocked .gallery-lock-overlay {
    opacity: 0;
    pointer-events: none;
}

/* 锁图标外层圆圈 */
.gallery-lock-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    margin-bottom: 2px;
}

.gallery-lock-icon svg {
    opacity: 0.9;
    color: #fff;
}

/* 价格标签 */
.gallery-lock-price {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.9;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 10px;
    border-radius: 10px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* 解锁按钮 */
.gallery-btn-unlock {
    background: #fff;
    color: #2c343c;
    font-weight: 600;
    padding: 7px 20px;
    font-size: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gallery-btn-unlock:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: #fff;
    color: #3858F6;
}

body[data-scheme="dark"] .gallery-btn-unlock {
    background: #f2f3f5;
    color: #2c343c;
}

body[data-scheme="dark"] .gallery-btn-unlock:hover {
    color: #3858F6;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-btn-unlock {
        background: #f2f3f5;
        color: #2c343c;
    }
    body[data-scheme="auto"] .gallery-btn-unlock:hover {
        color: #3858F6;
    }
}

/* ================================================================
   3. 按钮通用
   ================================================================ */

.gallery-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease, opacity 0.2s ease;
    outline: none;
    border-radius: 6px;
    line-height: 1;
    font-family: inherit;
    text-decoration: none;
}

.gallery-btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.gallery-btn-primary {
    padding: 10px 28px;
    font-size: 14px;
    background: #3858F6;
    color: #fff;
    font-weight: 600;
    border-radius: 6px;
    min-width: 100px;
}

.gallery-btn-primary:hover {
    opacity: 0.88;
}

.gallery-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gallery-btn-light {
    padding: 10px 22px;
    font-size: 13px;
    background: #f2f3f5;
    color: #606266;
    border-radius: 6px;
    font-weight: 500;
}

body[data-scheme="dark"] .gallery-btn-light {
    background: #303030;
    color: #c9cdd4;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-btn-light {
        background: #303030;
        color: #c9cdd4;
    }
}

.gallery-btn-light:hover {
    background: #e5e6eb;
}

body[data-scheme="dark"] .gallery-btn-light:hover {
    background: #494949;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-btn-light:hover {
        background: #494949;
    }
}

.gallery-btn-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ================================================================
   4. 整体解锁栏
   ================================================================ */

.gallery-all-unlock-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    margin-bottom: 14px;
    background: #f7f8fa;
    border: 1px solid #e5e6eb;
    border-radius: 8px;
}

body[data-scheme="dark"] .gallery-all-unlock-bar {
    background: #202022;
    border-color: #303030;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-all-unlock-bar {
        background: #202022;
        border-color: #303030;
    }
}

.gallery-all-unlock-text {
    font-size: 14px;
    color: #86909c;
    line-height: 1.5;
}

body[data-scheme="dark"] .gallery-all-unlock-text {
    color: #c9cdd4;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-all-unlock-text {
        color: #c9cdd4;
    }
}

/* ================================================================
   5. 弹窗
   ================================================================ */

.gallery-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: gallery-fadein 0.2s ease;
}

@keyframes gallery-fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes gallery-slidein {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.gallery-modal-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    max-width: 420px;
    width: 90%;
    position: relative;
    font-family: inherit;
    animation: gallery-slidein 0.3s ease;
    overflow: hidden;
}

body[data-scheme="dark"] .gallery-modal-box {
    background: #202022;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-modal-box {
        background: #202022;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    }
}

/* 弹窗头部 */
.gallery-modal-header {
    padding: 28px 28px 0;
}

.gallery-modal-title {
    font-size: 17px;
    font-weight: 600;
    color: #2c343c;
    line-height: 1.5;
}

body[data-scheme="dark"] .gallery-modal-title {
    color: #f2f3f5;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-modal-title {
        color: #f2f3f5;
    }
}

/* 弹窗主体 */
.gallery-modal-body {
    padding: 20px 28px 24px;
}

/* 弹窗底部 */
.gallery-modal-footer {
    padding: 16px 28px;
    text-align: right;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #f7f8fa;
    border-top: 1px solid #f2f3f5;
}

body[data-scheme="dark"] .gallery-modal-footer {
    background: #0f0f11;
    border-top-color: #303030;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-modal-footer {
        background: #0f0f11;
        border-top-color: #303030;
    }
}

.gallery-modal-footer .gallery-btn {
    min-width: 80px;
}

/* 余额信息卡片 */
.gallery-modal-info {
    background: #f7f8fa;
    border-radius: 8px;
    padding: 16px 20px;
}

body[data-scheme="dark"] .gallery-modal-info {
    background: #0f0f11;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-modal-info {
        background: #0f0f11;
    }
}

.gallery-modal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.gallery-modal-row + .gallery-modal-row {
    border-top: 1px solid #f2f3f5;
}

body[data-scheme="dark"] .gallery-modal-row + .gallery-modal-row {
    border-top-color: #303030;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-modal-row + .gallery-modal-row {
        border-top-color: #303030;
    }
}

.gallery-modal-label {
    color: #86909c;
    font-size: 14px;
}

body[data-scheme="dark"] .gallery-modal-label {
    color: #c9cdd4;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-modal-label {
        color: #c9cdd4;
    }
}

.gallery-modal-value {
    font-weight: 600;
    color: #2c343c;
    font-size: 15px;
}

body[data-scheme="dark"] .gallery-modal-value {
    color: #f2f3f5;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-modal-value {
        color: #f2f3f5;
    }
}

.gallery-modal-short {
    color: #ff3e3e;
}

/* 积分不足提示条 */
.gallery-modal-short-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef0f0;
    border: 1px solid #fde2e2;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 14px;
}

body[data-scheme="dark"] .gallery-modal-short-bar {
    background: rgba(255, 62, 62, 0.08);
    border-color: rgba(255, 62, 62, 0.2);
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-modal-short-bar {
        background: rgba(255, 62, 62, 0.08);
        border-color: rgba(255, 62, 62, 0.2);
    }
}

.gallery-modal-short-bar-icon {
    flex-shrink: 0;
    color: #ff3e3e;
    display: flex;
    align-items: center;
}

.gallery-modal-short-bar-text {
    font-size: 13px;
    color: #cc3d3d;
    line-height: 1.5;
}

body[data-scheme="dark"] .gallery-modal-short-bar-text {
    color: #ff6b6b;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-modal-short-bar-text {
        color: #ff6b6b;
    }
}

.gallery-modal-short-bar-text strong {
    font-weight: 700;
}

/* 充值区域 */
.gallery-modal-recharge {
    text-align: center;
    margin-top: 18px;
    padding-top: 16px;
}

.gallery-modal-recharge::before {
    content: '';
    display: block;
    width: 50px;
    height: 1px;
    background: #d0d5dd;
    margin: 0 auto 16px;
}

body[data-scheme="dark"] .gallery-modal-recharge::before {
    background: #303030;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-modal-recharge::before {
        background: #303030;
    }
}

.gallery-recharge-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 11px 28px;
    background: #3858F6;
    border: none;
    border-radius: 6px;
    transition: opacity 0.2s ease;
}

.gallery-recharge-link:hover {
    opacity: 0.85;
    color: #fff;
    text-decoration: none;
}

body[data-scheme="dark"] .gallery-recharge-link {
    background: #4d7aff;
}

body[data-scheme="dark"] .gallery-recharge-link:hover {
    background: #6890ff;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-recharge-link {
        background: #4d7aff;
    }
    body[data-scheme="auto"] .gallery-recharge-link:hover {
        background: #6890ff;
    }
}

/* 成功提示 */
.gallery-modal-success {
    text-align: center;
    padding: 20px 0 8px;
}

.gallery-modal-success-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    background: #4abd86;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: gallery-scalein 0.3s ease;
}

@keyframes gallery-scalein {
    from { transform: scale(0); }
    50% { transform: scale(1.1); }
    to { transform: scale(1); }
}

.gallery-modal-success-text {
    color: #2c343c;
    font-size: 16px;
    font-weight: 600;
}

body[data-scheme="dark"] .gallery-modal-success-text {
    color: #f2f3f5;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-modal-success-text {
        color: #f2f3f5;
    }
}

/* 错误提示 */
.gallery-modal-error-text {
    color: #ff3e3e;
    text-align: center;
    padding: 24px 0;
    font-size: 14px;
    line-height: 1.6;
}

/* ================================================================
   6. 编辑器空状态
   ================================================================ */

.gallery-empty-notice {
    padding: 40px 20px;
    text-align: center;
    background: #f2f3f5;
    border: 2px dashed #d0d5dd;
    border-radius: 6px;
    color: #86909c;
    font-size: 14px;
}

body[data-scheme="dark"] .gallery-empty-notice {
    background: #303030;
    border-color: #494949;
    color: #c9cdd4;
}

@media (prefers-color-scheme: dark) {
    body[data-scheme="auto"] .gallery-empty-notice {
        background: #303030;
        border-color: #494949;
        color: #c9cdd4;
    }
}

/* ================================================================
   7. 响应式
   ================================================================ */

/* 平板端：一行两列（覆盖 data-columns 设置） */
@media (min-width: 576px) and (max-width: 991.98px) {
    .gallery-grid[data-columns] {
        column-count: 2 !important;
    }
    .gallery-grid {
        column-gap: 8px;
    }
    .gallery-item {
        margin-bottom: 8px;
    }
}

/* 移动端：一行一列（覆盖 data-columns 设置） */
@media (max-width: 575.98px) {
    .gallery-grid[data-columns] {
        column-count: 1 !important;
    }
    .gallery-grid {
        column-gap: 0;
    }
    .gallery-item {
        margin-bottom: 8px;
    }

    .gallery-all-unlock-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .gallery-modal-box {
        width: 92%;
        max-width: 360px;
    }

    .gallery-modal-header {
        padding: 22px 22px 0;
    }

    .gallery-modal-body {
        padding: 16px 22px 20px;
    }

    .gallery-modal-footer {
        padding: 14px 22px;
    }

    .gallery-modal-info {
        padding: 12px 16px;
    }
}
