/**
 * App Wishing Pool - Frontend Stylesheet
 */

:root {
    --awp-primary: #3b82f6;
    --awp-primary-hover: #2563eb;
    --awp-primary-light: #eff6ff;
    --awp-success: #10b981;
    --awp-success-light: #ecfdf5;
    --awp-warning: #f59e0b;
    --awp-warning-light: #fffbeb;
    --awp-danger: #ef4444;
    --awp-danger-light: #fef2f2;
    --awp-gray-50: #f9fafb;
    --awp-gray-100: #f3f4f6;
    --awp-gray-200: #e5e7eb;
    --awp-gray-300: #d1d5db;
    --awp-gray-500: #6b7280;
    --awp-gray-700: #374151;
    --awp-gray-900: #111827;
    --awp-radius-sm: 8px;
    --awp-radius-md: 14px;
    --awp-radius-lg: 20px;
    --awp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --awp-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --awp-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.page-template-page-wishing-pool .site-content,
body:has(.awp-wrapper) .site-content {
    padding-top: 0 !important;
}

.awp-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0 40px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--awp-gray-900);
}

/* =========================================================
   顶部引导卡片 (Hero Card)
   ========================================================= */
.awp-hero-card {
    background: #ffffff;
    border: 1px solid var(--awp-gray-200);
    border-radius: var(--awp-radius-lg);
    padding: 24px 30px;
    margin-top: 0;
    margin-bottom: 24px;
    box-shadow: var(--awp-shadow-md);
    transition: box-shadow 0.2s ease;
}

.awp-hero-header {
    margin-bottom: 24px;
}

.awp-hero-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.awp-sparkle-icon {
    font-size: 26px;
}

.awp-hero-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
    color: var(--awp-gray-900);
    letter-spacing: -0.5px;
}

.awp-hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: #fef3c7;
    color: #92400e;
    font-size: 13px;
    font-weight: 600;
    border-radius: 20px;
    border: 1px solid #fde68a;
}

.awp-hero-desc {
    font-size: 14px;
    color: var(--awp-gray-500);
    margin: 0;
    line-height: 1.6;
}

/* 许愿要求提示栏 (紧凑横向) */
.awp-rules-box {
    background: #f8fafc;
    border: 1px solid var(--awp-gray-200);
    border-radius: var(--awp-radius-sm);
    padding: 8px 12px;
    margin-bottom: 16px;
}

.awp-rules-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.awp-rule-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--awp-gray-700);
    line-height: 1.4;
}

.awp-rule-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    background: var(--awp-primary-light);
    color: var(--awp-primary);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.awp-rule-text {
    font-weight: 500;
    color: #334155;
}

.awp-btn-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #ffffff;
    border: 1px solid var(--awp-primary);
    color: var(--awp-primary);
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    line-height: 1.4;
    transition: all 0.15s ease;
    margin-left: 2px;
}

.awp-btn-switch:hover {
    background: var(--awp-primary);
    color: #ffffff;
}

/* 输入与提交表单 */
.awp-submit-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.awp-input-group {
    display: flex;
    gap: 12px;
    align-items: stretch;
    width: 100%;
}

.awp-input-box-wrap {
    display: flex;
    align-items: center;
    flex: 1;
    background: #ffffff;
    border: 2px solid var(--awp-gray-200);
    border-radius: var(--awp-radius-md);
    padding: 0 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.awp-input-box-wrap:focus-within {
    border-color: var(--awp-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.awp-text-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 12px 0;
    color: var(--awp-gray-900);
    background: transparent;
}

.awp-text-input::placeholder {
    color: #9ca3af;
}

.awp-input-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.awp-btn-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    border: 1px solid var(--awp-gray-200);
    background: var(--awp-gray-100);
    color: var(--awp-gray-700);
}

.awp-btn-action:hover {
    background: var(--awp-gray-200);
    color: var(--awp-gray-900);
}

.awp-btn-clear {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.awp-btn-clear:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.awp-btn-paste {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
}

.awp-btn-paste:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

.awp-btn-tutorial {
    background: var(--awp-gray-100);
    border-color: var(--awp-gray-200);
    color: var(--awp-gray-700);
}

.awp-btn-tutorial:hover {
    background: var(--awp-gray-200);
    color: var(--awp-gray-900);
}

.awp-btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: 0 24px;
    background: var(--awp-primary);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--awp-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.awp-btn-submit:hover {
    background: var(--awp-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(59, 130, 246, 0.4);
}

.awp-btn-submit:active {
    transform: translateY(0);
}

.awp-loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: awp-spin 0.8s linear infinite;
}

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

/* 反馈消息 */
.awp-feedback-msg {
    padding: 12px 16px;
    border-radius: var(--awp-radius-sm);
    font-size: 14px;
    line-height: 1.5;
    animation: awp-fade-in 0.3s ease;
}

.awp-feedback-msg.success {
    background: var(--awp-success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.awp-feedback-msg.error {
    background: var(--awp-danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.awp-feedback-msg.warning {
    background: var(--awp-warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

@keyframes awp-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   选项卡导航栏 (Tabs Navigation - Horizontal Segmented Control)
   ========================================================= */
.awp-tabs-nav-wrap {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

.awp-tabs-nav {
    display: flex;
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--awp-gray-200);
    box-shadow: var(--awp-shadow-sm);
    gap: 4px;
    box-sizing: border-box;
}

.awp-tab-btn {
    flex: 1 1 0%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 4px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--awp-gray-500);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-sizing: border-box;
}

.awp-tab-btn:hover {
    color: var(--awp-gray-900);
    background: var(--awp-gray-100);
}

.awp-tab-btn.active {
    background: var(--awp-primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
}

/* =========================================================
   卡片网格列表 (Wishes Grid)
   ========================================================= */
.awp-wishes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.awp-card {
    background: #ffffff;
    border: 1px solid var(--awp-gray-200);
    border-radius: var(--awp-radius-md);
    padding: 10px 14px;
    box-shadow: var(--awp-shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.awp-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--awp-shadow-md);
    border-color: #cbd5e1;
}

.awp-card-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* 图1: Logo 图标 (左侧) */
.awp-card-icon-wrap {
    width: 50px;
    height: 50px;
    min-width: 50px;
    flex-shrink: 0;
}

.awp-card-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: block;
}

/* 图2: 中间 名称与价格 (Logo 右侧) */
.awp-card-info {
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.awp-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--awp-gray-900);
    margin: 0 0 3px 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
    max-width: 100%;
}

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

.awp-card-price {
    display: inline-block;
    padding: 1px 6px;
    background: #ecfdf5;
    color: #047857;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    border: 1px solid #a7f3d0;
    line-height: 1.3;
}

/* 图3: 最右侧 投票与商店链接 (小巧精致) */
.awp-card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    flex-shrink: 0;
}

.awp-vote-actions {
    display: flex;
    gap: 4px;
}

.awp-vote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 2px 6px;
    min-width: 36px;
    height: 22px;
    border: 1px solid var(--awp-gray-200);
    border-radius: 6px;
    background: #ffffff;
    font-size: 11px;
    font-weight: 600;
    color: var(--awp-gray-700);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.awp-vote-btn:hover {
    background: var(--awp-gray-50);
    border-color: var(--awp-gray-300);
    transform: translateY(-1px);
}

.awp-vote-btn.active.awp-vote-up {
    background: #ecfdf5;
    border-color: #34d399;
    color: #059669;
}

.awp-vote-btn.active.awp-vote-down {
    background: #fef2f2;
    border-color: #f87171;
    color: #dc2626;
}

.awp-vote-count {
    font-size: 11px;
    font-weight: 700;
}

.awp-store-link {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    line-height: 1;
    transition: color 0.15s ease;
}

.awp-store-link:hover {
    color: var(--awp-primary);
}

/* 卡片状态区域 */
.awp-card-body {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--awp-gray-200);
}

/* 我的许愿状态 */
.awp-my-status-box {
    background: var(--awp-gray-50);
    border-radius: var(--awp-radius-sm);
    padding: 12px;
}

.awp-my-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    margin-bottom: 6px;
}

.awp-my-badge-pending {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.awp-my-badge-approved {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.awp-my-badge-fulfilled {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.awp-my-badge-rejected {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.awp-my-tip {
    font-size: 12px;
    color: var(--awp-gray-500);
    margin: 0;
}

.awp-my-reward-banner {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #b45309;
}

.awp-view-post-btn {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--awp-primary);
    text-decoration: underline;
}

.awp-reject-reason-alert {
    margin-top: 6px;
    font-size: 12px;
    color: #991b1b;
    line-height: 1.4;
    background: #ffffff;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #fecaca;
}

.awp-reject-reason-alert p {
    margin: 2px 0 0 0;
}

/* 达成愿望标签 */
.awp-fulfilled-tag-box {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.awp-tag-fulfilled {
    font-size: 12px;
    font-weight: 700;
    color: #92400e;
    background: #fef3c7;
    padding: 2px 8px;
    border-radius: 6px;
}

.awp-tag-points {
    font-size: 12px;
    font-weight: 600;
    color: #047857;
    background: #ecfdf5;
    padding: 2px 8px;
    border-radius: 6px;
}

.awp-post-action-btn {
    display: block;
    text-align: center;
    background: var(--awp-primary-light);
    color: var(--awp-primary);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s ease;
}

.awp-post-action-btn:hover {
    background: var(--awp-primary);
    color: #ffffff;
}

/* 空状态 */
.awp-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border: 1px dashed var(--awp-gray-300);
    border-radius: var(--awp-radius-lg);
}

.awp-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.awp-empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--awp-gray-700);
    margin: 0 0 6px 0;
}

.awp-empty-state p {
    font-size: 14px;
    color: var(--awp-gray-500);
    margin: 0 0 16px 0;
}

.awp-btn-primary {
    display: inline-block;
    padding: 8px 20px;
    background: var(--awp-primary);
    color: #ffffff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

/* =========================================================
   前端模态框组件 (Modals)
   ========================================================= */
.awp-frontend-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.awp-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.awp-modal-container {
    position: relative;
    z-index: 2;
    background: #ffffff;
    border-radius: var(--awp-radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--awp-shadow-lg);
    animation: awp-modal-scale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes awp-modal-scale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.awp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--awp-gray-100);
}

.awp-modal-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: var(--awp-gray-900);
}

.awp-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--awp-gray-500);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.awp-modal-close-btn:hover {
    background: var(--awp-gray-100);
    color: var(--awp-gray-900);
}

.awp-modal-body {
    padding: 24px;
}

/* 教程图片容器 */
.awp-tutorial-img-wrap {
    text-align: center;
}

.awp-tutorial-img {
    max-width: 100%;
    height: auto;
    border-radius: var(--awp-radius-sm);
    box-shadow: var(--awp-shadow-md);
}

/* 美区切换弹窗特别样式 */
.awp-switch-modal-container {
    max-width: 440px;
}

.awp-switch-body {
    text-align: center;
    padding: 24px;
}

.awp-switch-notice {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--awp-radius-sm);
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    color: #334155;
    line-height: 1.6;
}

.awp-switch-notice p {
    margin: 0;
}

.awp-btn-do-switch {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: var(--awp-primary);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--awp-radius-md);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    transition: all 0.2s ease;
}

.awp-btn-do-switch:hover {
    background: var(--awp-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.45);
    color: #ffffff;
}

/* =========================================================
   响应式移动端适配 (Mobile Responsive)
   ========================================================= */
@media (max-width: 768px) {
    .awp-hero-card {
        padding: 20px;
    }

    .awp-hero-title {
        font-size: 22px;
    }

    .awp-input-group {
        flex-direction: column;
    }

    .awp-btn-submit {
        height: 44px;
        width: 100%;
    }

    .awp-tabs-nav-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    .awp-tabs-nav {
        overflow-x: auto;
    }

    .awp-search-input {
        width: 100%;
    }

    .awp-wishes-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
