/* ============================================================
   Short Video Parser v2 — 扩展组件样式
   补充更多高级UI组件
   ============================================================ */

/* ========== 会员相关样式 ========== */
.member-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.member-menu {
    position: relative;
    z-index: 150;
}

.member-chip {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--border-base);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: var(--blur-sm);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    font: inherit;
}

.member-chip:hover,
.member-menu.open .member-chip {
    border-color: var(--primary);
    background: white;
}

.member-name {
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.member-points {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-left: 12px;
    border-left: 1px solid var(--border-base);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}

.guest-chip .member-points {
    border-left: 0;
    padding-left: 0;
}

.member-points.is-updating {
    animation: pointsPulse 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.member-coin {
    display: inline-grid;
    width: 16px;
    height: 16px;
    place-items: center;
    border-radius: 50%;
    color: #8a6116;
    background: linear-gradient(180deg, #ffe79b 0%, #f5b93a 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7),
                0 2px 8px rgba(245, 185, 58, 0.3);
    font-size: 8px;
    font-weight: 900;
    font-style: normal;
}

.member-arrow {
    width: 8px;
    height: 8px;
    margin-left: -2px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.member-menu.open .member-arrow {
    transform: rotate(225deg) translateY(-1px);
    border-color: var(--primary);
}

.member-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 200;
    display: grid;
    gap: 4px;
    min-width: 160px;
    padding: 8px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-xl);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.member-menu.open .member-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.member-dropdown button {
    width: 100%;
    border: 0;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text);
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.member-dropdown button:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(4px);
}

@keyframes pointsPulse {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.9;
    }
    40% {
        transform: translateY(-3px) scale(1.08);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* ========== 历史记录抽屉 ========== */
.history-dock {
    position: fixed;
    right: 32px;
    top: 100px;
    z-index: 90;
}

.history-toggle {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--primary);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-md);
    box-shadow: var(--shadow-lg), var(--inner-highlight);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.history-toggle svg {
    width: 28px;
    height: 28px;
}

.history-toggle path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.history-toggle:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-xl), 0 0 32px rgba(99, 102, 241, 0.3);
}

.history-drawer {
    position: absolute;
    right: 0;
    top: 0;
    width: min(450px, calc(100vw - 48px));
    max-height: min(700px, calc(100vh - 48px));
    padding: 24px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-2xl);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-xl);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.history-dock.open .history-drawer {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.history-dock.open .history-toggle {
    opacity: 0;
    pointer-events: none;
}

.history-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.history-head span {
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.history-head h2 {
    margin: 8px 0 0;
    font-size: 22px;
    color: var(--text);
    font-weight: 700;
}

.history-close {
    display: flex;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-base);
    border-radius: 50%;
    color: var(--text);
    background: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-close svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.history-close:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
    transform: rotate(90deg);
}

.history-note {
    margin: 0 0 16px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
}

.history-list {
    display: grid;
    gap: 12px;
    max-height: min(560px, calc(100vh - 220px));
    overflow-y: auto;
    padding-right: 8px;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 6px;
}

.history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: var(--blur-sm);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.history-item.restorable {
    cursor: pointer;
}

.history-item.restorable:hover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-md), 0 0 24px rgba(99, 102, 241, 0.15);
}

.history-main {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.history-main strong {
    overflow: hidden;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-main span,
.history-main small,
.history-main a {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-main a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.history-main a:hover {
    text-decoration: underline;
}

.history-side {
    display: grid;
    gap: 8px;
    justify-items: end;
}

.history-side em {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
}

.history-side em.ok {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.history-side em.bad {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.history-side time,
.history-empty {
    color: var(--text-muted);
    font-size: 12px;
}

.history-empty {
    padding: 32px;
    border: 2px dashed var(--border-base);
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--text-lighter);
}

/* ========== 认证模态框 ========== */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: var(--blur-lg);
}

.auth-box {
    position: relative;
    width: min(440px, 100%);
    display: grid;
    gap: 16px;
    padding: 36px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-2xl);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-xl);
    box-shadow: var(--shadow-xl);
}

.auth-box h2 {
    margin: 0;
    font-size: 32px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    margin: -4px 0 8px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.auth-box label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.auth-box input {
    width: 100%;
    border: 2px solid var(--border-base);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.8);
    font: inherit;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
}

.auth-box input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.12);
}

.auth-close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.05);
    padding: 0;
    border: 0;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-close:hover {
    color: white;
    background: var(--error);
    transform: rotate(90deg);
}

.auth-error {
    min-height: 24px;
    color: var(--error);
    font-size: 13px;
    font-weight: 600;
}

.auth-box button[type="submit"] {
    margin-top: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.auth-box button[type="submit"]:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg), 0 0 32px rgba(99, 102, 241, 0.4);
}

/* ========== 维护遮罩 ========== */
.maintenance-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(247, 247, 248, 0.95);
    backdrop-filter: var(--blur-xl);
}

.maintenance-modal {
    position: relative;
    width: min(560px, 100%);
    padding: 40px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-2xl);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-xl);
    box-shadow: var(--shadow-xl);
}

.maintenance-kicker {
    display: inline-flex;
    margin-bottom: 16px;
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.maintenance-modal h2 {
    margin: 0;
    font-size: clamp(32px, 6vw, 48px);
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--text);
}

.maintenance-modal p {
    margin: 20px 0 0;
    color: var(--text-soft);
    font-size: 16px;
    line-height: 1.75;
}

.maintenance-lock {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-base);
}

.maintenance-lock strong {
    color: var(--error);
    font-size: 15px;
    font-weight: 700;
}

.maintenance-lock span {
    color: var(--text-muted);
    font-size: 13px;
}

/* ========== 浮动下载按钮 ========== */
.floating-client-download {
    position: fixed;
    right: max(24px, env(safe-area-inset-right));
    bottom: max(24px, env(safe-area-inset-bottom));
    z-index: 80;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 20px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 999px;
    color: white;
    background: var(--gradient-primary);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: var(--shadow-lg), 0 0 32px rgba(99, 102, 241, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-client-download svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: currentColor;
}

.floating-client-download:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-xl), 0 0 48px rgba(99, 102, 241, 0.5);
}

/* ========== 公告条 ========== */
.notice {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding: 16px 20px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.08) 0%,
        rgba(139, 92, 246, 0.05) 100%);
    font-size: 14px;
}

.notice strong {
    flex: 0 0 auto;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
}

.notice span {
    line-height: 1.6;
    color: var(--text-soft);
}

/* ========== 下载iframe ========== */
.download-frame {
    position: absolute;
    width: 0;
    height: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* ========== 响应式优化 ========== */
@media (max-width: 900px) {
    .member-bar {
        justify-content: flex-start;
    }

    .member-chip {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .history-dock {
        right: 16px;
        top: 80px;
    }

    .history-toggle {
        width: 52px;
        height: 52px;
    }

    .history-drawer {
        position: fixed;
        inset: auto 12px 12px 12px;
        width: auto;
        max-height: min(80vh, 640px);
        transform: translateY(20px) scale(0.95);
    }

    .history-dock.open .history-drawer {
        transform: translateY(0) scale(1);
    }

    .history-list {
        max-height: calc(80vh - 180px);
    }

    .history-item {
        grid-template-columns: 1fr;
    }

    .history-side {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .floating-client-download {
        right: 16px;
        bottom: max(16px, env(safe-area-inset-bottom));
        min-height: 48px;
        padding: 0 16px;
        font-size: 14px;
    }

    .maintenance-modal {
        padding: 32px 24px;
    }

    .maintenance-lock {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
