/* ============================================================
   CapCut 推广助手 - 前台样式（美化版）
   现代配色 + 玻璃拟态 + 流畅动画
   ============================================================ */

/* --- 自定义字体 --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap');

/* --- 全局重置 & 自定义属性 --- */
:root {
    --orange-50:  #fff7f0;
    --orange-100: #ffe8d6;
    --orange-400: #ff944d;
    --orange-500: #ff6b35;
    --orange-600: #e8521d;

    --gray-50:   #f9fafb;
    --gray-100: #f3f4f6;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-800: #1f2937;

    --purple-400: #c084fc;

    --green-500: #10b981;
    --green-600: #059669;

    --radius-md:  14px;
    --radius-lg:  20px;
    --radius-xl:  28px;
    --radius-full: 9999px;

    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);

    --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 40%, #ff8f5e 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 30px 20px 60px;
    color: var(--gray-800);
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: rgba(255,107,53,0.25);
    color: var(--gray-800);
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

/* ========== 页面加载动画 ========== */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 40%, #ff8f5e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.loader-content {
    text-align: center;
    color: white;
}
.loader-logo {
    font-size: 4.5rem;
    animation: loaderBounce 1s ease-in-out infinite;
}
.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    margin: 24px auto 16px;
    animation: spin 0.8s linear infinite;
}
.loader-text {
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0.9;
    letter-spacing: 2px;
}
@keyframes loaderBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 主容器 ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeInUp 0.7s ease-out;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== 页头 ========== */
header {
    text-align: center;
    color: white;
    margin-bottom: 36px;
    position: relative;
}
.logo-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}
.logo {
    font-size: 4.2rem;
    animation: logoEntry 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    position: relative;
    z-index: 1;
}
.logo-ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.25);
    animation: ringPulse 2.5s ease-in-out infinite;
}
@keyframes logoEntry {
    from { opacity: 0; transform: scale(0.3) rotate(-30deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.15); opacity: 0; }
}

header h1 {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: -1px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-bottom: 8px;
    animation: fadeInDown 0.6s 0.2s both;
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.subtitle {
    font-size: 1.15rem;
    font-weight: 300;
    opacity: 0.92;
    animation: fadeInDown 0.6s 0.35s both;
}

.header-decoration {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    animation: fadeInDown 0.6s 0.5s both;
}
.header-decoration span {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    animation: dotPulse 1.5s ease-in-out infinite;
}
.header-decoration span:nth-child(2) { animation-delay: 0.2s; }
.header-decoration span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.5); opacity: 1; }
}

/* ========== 工具栏（玻璃拟态） ========== */
.toolbar {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 18px 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 22px;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.5) inset;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: slideUp 0.6s 0.3s both;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 搜索框 */
.search-box {
    position: relative;
}
.search-box input {
    width: 100%;
    padding: 14px 20px 14px 50px;
    border: 2px solid var(--orange-100);
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-family: var(--font);
    transition: var(--transition);
    background: var(--orange-50);
    color: var(--gray-800);
}
.search-box input::placeholder {
    color: var(--gray-400);
}
.search-box input:focus {
    outline: none;
    border-color: var(--orange-500);
    background: white;
    box-shadow: 0 0 0 4px rgba(255,107,53,0.12), 0 1px 3px rgba(0,0,0,0.06);
}
/* 搜索图标（SVG 背景） */
.search-box::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    transition: var(--transition);
}

/* 工具栏第二行 */
.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 搜索结果计数 */
.search-count {
    font-size: 0.85rem;
    color: var(--gray-400);
    transition: var(--transition);
    font-weight: 500;
}
.search-count.has-results {
    color: var(--gray-500);
}
.search-count.highlight {
    color: var(--orange-500);
    font-weight: 700;
}

/* 视图切换按钮 */
.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.view-btn {
    background: transparent;
    border: none;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--gray-400);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.view-btn:hover {
    color: var(--gray-600);
}
.view-btn.active {
    background: white;
    color: var(--orange-500);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ========== 作品网格 ========== */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
    animation: fadeIn 0.8s 0.5s both;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* 双列模式 */
.works-grid.view-2col {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.works-grid.view-2col .work-card {
    border-radius: var(--radius-md);
}
.works-grid.view-2col .card-header {
    padding: 12px 16px;
}
.works-grid.view-2col .work-name {
    font-size: 1.05rem;
}
.works-grid.view-2col .card-body {
    padding: 12px 16px 14px;
}
.works-grid.view-2col .copy-section {
    margin-bottom: 10px;
}
.works-grid.view-2col .copy-section:last-child {
    margin-bottom: 0;
}
.works-grid.view-2col .copy-label {
    font-size: 0.78rem;
    margin-bottom: 5px;
}
.works-grid.view-2col .copy-content {
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 10px 12px;
    padding-bottom: 24px;
    border-radius: var(--radius-sm);
}
.works-grid.view-2col .copy-hint {
    font-size: 0.68rem;
    bottom: 4px;
    right: 10px;
}

/* ========== 作品卡片 ========== */
.work-card {
    background: white;
    border-radius: 20px !important;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    animation: cardEntry 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
    position: relative;
    clip-path: inset(0 0 0 0 round 20px);
}
.work-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    border: 2px solid transparent;
    transition: var(--transition);
    pointer-events: none;
}
.work-card:hover::before {
    border-color: rgba(255,107,53,0.3);
}

/* 卡片入场动画延时 */
.work-card:nth-child(1)  { animation-delay: 0.05s; }
.work-card:nth-child(2)  { animation-delay: 0.10s; }
.work-card:nth-child(3)  { animation-delay: 0.15s; }
.work-card:nth-child(4)  { animation-delay: 0.20s; }
.work-card:nth-child(5)  { animation-delay: 0.25s; }
.work-card:nth-child(6)  { animation-delay: 0.30s; }
.work-card:nth-child(7)  { animation-delay: 0.35s; }
.work-card:nth-child(8)  { animation-delay: 0.40s; }
.work-card:nth-child(9)  { animation-delay: 0.45s; }

@keyframes cardEntry {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.work-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(255,107,53,0.25);
}

/* 置顶卡片 */
.work-card.pinned-card {
    box-shadow: inset 0 0 0 2px var(--purple-400), 0 4px 20px rgba(192,132,252,0.15);
}
.work-card.pinned-card:hover {
    box-shadow: inset 0 0 0 2px var(--purple-400), 0 12px 40px rgba(192,132,252,0.2);
}
.pin-badge {
    margin-right: 6px;
    font-size: 1.1rem;
}

/* 卡片头部 */
.card-header {
    background: linear-gradient(135deg, var(--orange-500) 0%, var(--orange-400) 100%);
    padding: 16px 22px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    /* 顶部圆角与卡片一致 */
    border-radius: 20px 20px 0 0;
}
.card-header::after {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}
.work-name {
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}
.work-name::before {
    content: '✂️';
    font-size: 1.3rem;
}

/* 卡片底部：card-body 也设置底部圆角，双重保障 */
.card-body {
    padding: 18px 22px 20px;
    border-radius: 0 0 20px 20px;
}

/* 最后一个复制区域底部圆角与卡片一致（桌面端） */
@media (min-width: 769px) {
    .copy-section:last-child .copy-content {
        border-radius: 0 0 18px 18px;
    }
}

/* 最后一个复制区域底部圆角与卡片一致 */
.copy-section:last-child .copy-content {
    border-radius: 0 0 16px 16px;
}

/* 复制区域 */
.copy-section {
    margin-bottom: 18px;
}
.copy-section:last-child {
    margin-bottom: 0;
}
.copy-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--orange-500);
    font-weight: 600;
    margin-bottom: 8px;
}
.copy-label.title-label::before { content: '📝'; }
.copy-label.link-label::before  { content: '🔗'; }

.copy-content {
    background: var(--orange-50);
    border: 1.5px solid var(--orange-100);
    border-radius: 14px;
    padding: 13px 16px;
    padding-bottom: 30px;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    word-break: break-all;
    user-select: none;
}
/* 最后一个复制区域底部圆角与卡片对齐（桌面端） */
@media (min-width: 769px) {
    .copy-section:last-child .copy-content {
        border-radius: 0 0 18px 18px;
    }
}
.copy-content:hover {
    background: white;
    border-color: var(--orange-400);
    box-shadow: 0 2px 12px rgba(255,107,53,0.1);
    transform: translateY(-1px);
}
.copy-content:active {
    transform: scale(0.985);
}
.copy-content.copied {
    background: #ecfdf5;
    border-color: var(--green-500);
    color: #065f46;
}
.copy-content.copied .copy-hint {
    color: var(--green-600);
}
.copy-hint {
    position: absolute;
    right: 14px;
    bottom: 6px;
    font-size: 0.72rem;
    color: var(--orange-400);
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: 500;
}
.copy-content:hover .copy-hint {
    opacity: 1;
}

/* ========== 管理后台入口 ========== */
.admin-entry {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all var(--transition);
    z-index: 100;
    border: 1px solid rgba(255,255,255,0.2);
}
.admin-entry:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg) scale(1.1);
}

/* ========== 回到顶部按钮 ========== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 46px;
    height: 46px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all var(--transition);
    z-index: 100;
    border: 1px solid rgba(255,255,255,0.25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
.back-to-top:hover {
    background: rgba(255,255,255,0.4);
    transform: translateY(-3px);
}

/* ========== 模态框 ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 0.25s ease;
}
.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: white;
    margin: 10% auto;
    padding: 36px;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 460px;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 80px rgba(0,0,0,0.18);
    position: relative;
}
@keyframes modalSlideIn {
    from { transform: translateY(-40px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* 关闭按钮 */
.close {
    color: var(--gray-400);
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    line-height: 1;
}
.close:hover {
    color: var(--gray-800);
    background: var(--gray-100);
}

/* 密码弹窗专用 */
.password-modal-content {
    text-align: center;
    padding: 44px 36px 36px;
}
.lock-icon {
    margin-bottom: 18px;
    color: var(--orange-500);
    display: flex;
    justify-content: center;
}
.password-modal-content h2 {
    margin-bottom: 6px;
    color: var(--gray-800);
    font-size: 1.5rem;
    font-weight: 800;
}
.password-desc {
    color: var(--gray-400);
    margin-bottom: 28px;
    font-size: 0.95rem;
}
.password-modal-content .form-group input {
    text-align: center;
    font-size: 1.1rem;
    letter-spacing: 4px;
    padding: 16px;
}
.password-error {
    color: #ef4444;
    font-size: 0.88rem;
    margin-top: 14px;
    min-height: 20px;
}

/* 提交按钮 */
.submit-btn {
    width: 100%;
    padding: 0 32px;
    height: 54px;
    line-height: 54px;
    background: linear-gradient(135deg, var(--orange-500) 0%, var(--orange-400) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 18px rgba(255,107,53,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
    letter-spacing: 0.5px;
}
.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255,107,53,0.45);
}
.submit-btn:active {
    transform: translateY(0);
}

/* 表单输入框 */
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--orange-100);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--font);
    transition: var(--transition);
    background: var(--orange-50);
    color: var(--gray-800);
    resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--orange-500);
    background: white;
    box-shadow: 0 0 0 4px rgba(255,107,53,0.1);
}

/* ========== Toast 提示 ========== */
.toast {
    visibility: hidden;
    min-width: 320px;
    background: linear-gradient(135deg, var(--green-500) 0%, var(--green-600) 100%);
    color: white;
    text-align: center;
    border-radius: var(--radius-md);
    padding: 16px 28px;
    position: fixed;
    z-index: 2000;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%) translateY(20px);
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 10px 40px rgba(16,185,129,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
.toast.show {
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ========== 空状态 ========== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: white;
}
.empty-state-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    opacity: 0.85;
}
.empty-state-text {
    font-size: 1.25rem;
    font-weight: 300;
    opacity: 0.9;
}

/* ============================================================
   响应式设计
   ============================================================ */
@media (max-width: 768px) {
    body {
        padding: 16px 12px 50px;
    }
    header {
        margin-bottom: 28px;
    }
    header h1 {
        font-size: 2rem;
    }
    .logo {
        font-size: 3.2rem;
    }
    .subtitle {
        font-size: 1rem;
    }
    .toolbar {
        padding: 14px 16px;
        border-radius: var(--radius-md);
    }
    .works-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .works-grid.view-2col {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .works-grid.view-2col .work-card {
        border-radius: var(--radius-sm);
    }
    .works-grid.view-2col .card-header {
        padding: 10px 12px;
    }
    .works-grid.view-2col .work-name {
        font-size: 0.9rem;
    }
    .works-grid.view-2col .card-body {
        padding: 10px 12px 12px;
    }
    .works-grid.view-2col .copy-content {
        font-size: 0.78rem;
        padding: 8px 10px;
        padding-bottom: 20px;
    }
    .card-header {
        padding: 14px 18px;
    }
    .card-body {
        padding: 16px 18px 18px;
    }
    .modal-content {
        margin: 12% auto;
        padding: 28px 22px;
        width: 94%;
        border-radius: var(--radius-lg);
    }
    .password-modal-content {
        padding: 36px 24px 28px;
    }
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 42px;
        height: 42px;
    }
    .admin-entry {
        top: 14px;
        right: 14px;
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.6rem;
    }
    .logo {
        font-size: 2.6rem;
    }
    .work-name {
        font-size: 1.15rem;
    }
    .copy-content {
        font-size: 0.9rem;
    }
}
