/* ==========================================================================
   1. 基础变量与全局设置
   ========================================================================== */
:root {
    --bg-deep: #0b021c;
    --purple-glow: #bd00ff;
    --purple-dark: #4a0e78;
    --card-bg: rgba(20, 10, 40, 0.75); /* 深色磨砂玻璃背景 */
    --card-border: rgba(189, 0, 255, 0.3);
    --text-main: #ffffff;
    --text-muted: #aaa;
    --accent: #d845ff;
    --error: #ff4d4d;
    --success: #00e676;
    --font-main: 'Inter', sans-serif;
    --font-serif: 'Playfair Display', serif;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: var(--font-main);
    margin: 0;
}

[v-cloak] { display: none; }

/* ==========================================================================
   2. 核心布局容器
   ========================================================================== */

/* 最外层包装器 */
#star-naming-wrapper {
    min-height: calc(100vh - 100px); /* 减去头部导航高度 */
    width: 100%;
    position: relative;
    padding: 40px 20px;
    background: radial-gradient(circle at center, #1a0b35 0%, #000000 100%);
    overflow-x: hidden;
    
    /* Flex 布局居中 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

/* 背景星空纹理 */
.stars-bg {
    position: absolute; top:0; left:0; right:0; bottom:0;
    background-image: url('https://www.transparenttextures.com/patterns/stardust.png');
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

/* --- 骨架屏与应用切换机制 --- */

/* 1. 静态骨架屏 (默认显示，PHP渲染) */
#static-skeleton {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    padding: 0 10px;
    box-sizing: border-box;
    z-index: 2;
    display: block;
}

/* 2. Vue 应用容器 (默认隐藏，JS 加载完后淡入) */
#star-app {
    width: 100%; /* 核心修复：强制占满宽度，防止抖动 */
    max-width: 100%;
    display: none;
    box-sizing: border-box;
    z-index: 1;
}

/* 淡入动画类 */
.app-fade-in {
    animation: fadeIn 0.5s ease-in-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 内容容器 */
.app-container {
    width: 100%;
    max-width: 1400px; /* 桌面端最大宽度 */
    margin: 0 auto;
    position: relative;
    padding: 0 10px;
    box-sizing: border-box;
}

.section-title {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 1.5rem;
    color: white;
    text-shadow: 0 0 10px rgba(189, 0, 255, 0.5);
}

/* ==========================================================================
   3. 顶部步骤导航
   ========================================================================== */
.step-wizard {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
}

.step-item {
    background: rgba(255,255,255,0.1);
    padding: 8px 24px;
    border-radius: 30px;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.3s;
    user-select: none;
    border: 1px solid transparent;
}

.step-item.clickable { cursor: pointer; }
.step-item.clickable:hover { background: rgba(255,255,255,0.2); }

.step-item.active {
    background: var(--purple-glow);
    color: white;
    box-shadow: 0 0 15px var(--purple-glow);
    border-color: rgba(255,255,255,0.3);
}

.step-item.completed {
    background: var(--purple-dark);
    color: #ddd;
}

.step-line {
    width: 60px;
    height: 2px;
    background: rgba(255,255,255,0.1);
    margin: 0 10px;
}

/* ==========================================================================
   4. 网格布局与卡片
   ========================================================================== */

/* 通用两栏网格 (骨架屏也共用此样式) */
.two-col-grid, #static-skeleton .two-col-grid {
    display: grid;
    /* 左侧 45%，右侧 55% */
    grid-template-columns: 4.5fr 5.5fr; 
    gap: 40px;
    align-items: stretch; /* 强制等高 */
    width: 100%;
}

/* 第三步专用的网格 */
.checkout-grid {
    display: grid;
    grid-template-columns: 6.5fr 3.5fr; 
    gap: 40px;
    align-items: stretch; 
    width: 100%;
}

/* 磨砂玻璃卡片 */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    height: 100%; 
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.card-header {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 25px;
    letter-spacing: 1.5px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
}

.card-content { flex-grow: 1; }

/* ==========================================================================
   5. 表单元素 (样式统一优化版)
   ========================================================================== */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block; margin-bottom: 8px; font-size: 0.9rem; color: #ddd; font-weight: 500;
}
.form-group label.required::after { content: "*"; color: var(--error); margin-left: 4px; }

/* 
   核心修复：强制统一所有输入框(文本/日期)、文本域、下拉框的视觉风格 
   使用 !important 覆盖 Astra/WooCommerce 默认的白色背景 
*/
input[type="text"],
input[type="date"],
input[type="email"],
input[type="number"],
textarea,
select {
    width: 100% !important;
    background-color: rgba(0, 0, 0, 0.5) !important; /* 统一为半透明深色背景 */
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important; /* 统一为纯白字体 */
    padding: 14px !important;
    border-radius: 8px !important;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.3s ease;
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    outline: none !important;
    box-shadow: none !important; /* 去除默认阴影 */
}

/* 针对 Date 日期选择器的小图标颜色反转 (让黑色图标变成白色) */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.7;
    transition: 0.3s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* 统一聚焦状态 (Focus) */
input:focus, 
select:focus, 
textarea:focus {
    border-color: var(--purple-glow) !important;
    box-shadow: 0 0 15px rgba(189, 0, 255, 0.3) !important;
    background-color: rgba(0, 0, 0, 0.7) !important; /* 聚焦时背景稍微加深 */
    color: #ffffff !important;
}

/* 占位符颜色统一 */
input::placeholder,
textarea::placeholder {
    color: #aaa !important;
    opacity: 1;
}

/* 错误状态 */
input.error, select.error, textarea.error { 
    border-color: var(--error) !important; 
    background-color: rgba(255, 77, 77, 0.1) !important; 
}

.error-msg { color: var(--error); font-size: 0.8rem; margin-top: 6px; display: block; }
.note { font-size: 0.75rem; color: #888; margin-top: 5px; display: block; }
.char-count { text-align: right; font-size: 0.75rem; color: #888; margin-top: 5px; }
.char-count.limit { color: var(--error); }

/* 骨架屏伪输入框保持一致 */
.fake-input {
    width: 100%;
    height: 48px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
}

/* ==========================================================================
   6. 步骤 1: 详情展示
   ========================================================================== */
.detail-rows { display: flex; flex-direction: column; gap: 15px; }
.detail-row {
    display: flex; justify-content: space-between; padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.95rem;
}
.detail-row span:first-child { color: #aaa; }
.detail-row span:last-child { font-weight: 600; color: white; }

/* ==========================================================================
   7. 步骤 2: 证书选择与预览
   ========================================================================== */
.style-section-label {
    font-size: 0.8rem; color: #aaa; margin: 15px 0 8px; 
    text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}
.style-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 20px;
}
.style-item {
    cursor: pointer; text-align: center; opacity: 0.6; transition: 0.3s;
    display: flex; flex-direction: column; align-items: center;
}
.style-item:hover { opacity: 0.9; }
.style-item.selected { opacity: 1; transform: scale(1.05); }

/* 优化缩略图质感 */
.thumb-box {
    width: 100%; 
    aspect-ratio: 1.414 / 1; 
    border-radius: 6px; 
    border: 2px solid rgba(255,255,255,0.1); /* 默认微弱边框 */
    margin-bottom: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}
/* 选中状态加强光晕 */
.style-item.selected .thumb-box { 
    border-color: var(--accent); 
    box-shadow: 0 0 15px var(--accent), inset 0 0 10px rgba(255,255,255,0.2); 
}
.style-item.portrait .thumb-box { aspect-ratio: 1 / 1.414; width: 60%; }
.style-item.selected .thumb-box { border-color: var(--accent); box-shadow: 0 0 15px var(--accent); }

/* 1. Classic (羊皮纸质感 - 模拟陈旧纸张) */
.thumb-box.parchment { 
    background: linear-gradient(135deg, #e3c498 0%, #d1b080 100%);
    box-shadow: inset 0 0 20px rgba(139, 69, 19, 0.2);
}
/* 给羊皮纸加一点纹理伪元素 */
.thumb-box.parchment::after {
    content: ""; position: absolute; top:0; left:0; right:0; bottom:0;
    background-image: url('https://www.transparenttextures.com/patterns/aged-paper.png');
    opacity: 0.4;
}

/* 2. Deep Space (深空质感 - 模拟星空) */
.thumb-box.deepspace { 
    background: radial-gradient(circle at center, #2a0e4e 0%, #000000 100%);
    border: 1px solid #bd00ff; /* 默认带一点紫边 */
}
/* 给深空加一点星星 */
.thumb-box.deepspace::after {
    content: "✦"; color: white; position: absolute; top: 10%; right: 20%; font-size: 10px; opacity: 0.8;
    box-shadow: -20px 20px 0 -2px white, 15px 30px 0 -1px white;
}

/* 3. Modern (现代质感 - 纯净白灰) */
.thumb-box.modern { 
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
}
.thumb-box.modern::after {
    content: ""; position: absolute; top: 5px; left: 5px; right: 5px; bottom: 5px;
    border: 1px solid #ccc; /* 模拟内部边框 */
}

/* 预览容器 */
.preview-wrapper {
    width: 100%; height: 100%; display: flex; justify-content: center; align-items: center;
    background: rgba(0,0,0,0.2); border-radius: 12px; padding: 20px; box-sizing: border-box; overflow: hidden;
}
.certificate-preview {
    width: 100%; max-width: 600px; position: relative; padding: 40px; box-sizing: border-box;
    text-align: center; color: #000; font-family: var(--font-serif);
    display: flex; flex-direction: column; justify-content: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); transition: all 0.5s ease; overflow: hidden;
}
.certificate-preview.landscape { aspect-ratio: 1.414 / 1; }
.certificate-preview.portrait { aspect-ratio: 1 / 1.414; width: 70%; max-width: 450px; }


.certificate-preview .cert-title { 
    font-family: 'Playfair Display', serif;
    font-size: clamp(0.8rem, 2.5vw, 1.4rem); /* 稍微调小标题 */
    margin-bottom: 2%; 
    letter-spacing: 4px; 
    text-transform: uppercase;
    opacity: 0.9;
}

.certificate-preview .cert-star-name { 
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.2rem, 4vw, 2.2rem); /* 调整名字大小，不要过于巨大 */
    font-weight: 700; 
    margin-bottom: 1%; 
    font-style: italic; 
    line-height: 1.2;
    text-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.certificate-preview .cert-coords { 
    font-size: clamp(0.6rem, 1.2vw, 0.9rem); 
    margin-bottom: 5%; 
    opacity: 0.7; 
    font-family: 'Inter', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
}



.certificate-preview .cert-msg { 
    font-style: italic; width: 85%; margin: 0 auto 6%; font-size: clamp(0.7rem, 1.8vw, 1.1rem); 
    line-height: 1.4; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; 
}
.certificate-preview .cert-footer {
    position: absolute; bottom: 8%; left: 10%; right: 10%; display: flex; justify-content: space-between;
    font-size: clamp(0.6rem, 1.2vw, 0.9rem); border-top: 1px solid currentColor; padding-top: 15px;
}
.certificate-preview.parchment { background: url('https://www.transparenttextures.com/patterns/aged-paper.png'), #f4e4bc; }


/* 针对 Deep Space 风格增加高级感边框 */
.certificate-preview.deepspace { 
    background: radial-gradient(circle, #1a0b35 0%, #000000 100%); 
    color: #fff; 
    border: 1px solid #d845ff; /* 外边框 */
    box-shadow: inset 0 0 0 5px #000, inset 0 0 0 7px #d845ff; /* 双重内边框模拟 */
}


.certificate-preview.modern { background: #fff; color: #333; }

/* ==========================================================================
   8. 步骤 3: 增值服务 (紧凑横版)
   ========================================================================== */
.addons-list {
    display: flex; flex-direction: column; gap: 15px; justify-content: flex-start;
}

.addon-card {
    display: flex; flex-direction: row; /* 横向 */
    align-items: center; gap: 20px; padding: 20px;
    background: rgba(20, 10, 40, 0.5); border-radius: 12px;
    transition: 0.3s; border: 1px solid rgba(255,255,255,0.05);
    height: auto; min-height: 0;
}
.addon-card.included { border: 1px solid var(--success); background: rgba(0, 230, 118, 0.05); }

.addon-img {
    width: 80px; height: 80px; 
    border-radius: 8px;
    flex-shrink: 0; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    background-size: cover; 
    background-position: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}


/* 1. 星空指南 (书籍图标效果) */
.addon-img.book-img {
    background: linear-gradient(135deg, #2c3e50 0%, #000000 100%);
    display: flex; align-items: center; justify-content: center;
}
.addon-img.book-img::before {
    content: "📖"; font-size: 30px; filter: drop-shadow(0 0 5px rgba(255,255,255,0.5));
}

/* 2. 相框 (模拟木框效果) */
.addon-img.frame-img {
    background: #1a1a1a;
    display: flex; align-items: center; justify-content: center;
    border: 4px solid #8b4513; /* 模拟木边框 */
}
.addon-img.frame-img::after {
    content: "★"; color: white; font-size: 24px;
}

/* 3. 额外证书 (模拟叠纸效果) */
.addon-img.certs-img {
    background: #333;
    display: flex; align-items: center; justify-content: center;
}
.addon-img.certs-img::before {
    content: ""; position: absolute; width: 60%; height: 70%; 
    background: #fff; transform: rotate(-5deg); box-shadow: 0 2px 5px #000;
}
.addon-img.certs-img::after {
    content: ""; position: absolute; width: 60%; height: 70%; 
    background: #f0f0f0; transform: rotate(5deg); box-shadow: 0 2px 5px #000;
}



.addon-content-wrap {
    flex-grow: 1; display: flex; flex-direction: column; justify-content: center; gap: 5px;
}

.addon-header-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.addon-header-row h3 { margin: 0; font-size: 1.1rem; color: white; font-weight: 600; }

.desc { font-size: 0.85rem; color: #aaa; margin: 0; line-height: 1.4; max-width: 90%; }
.free-tag { color: var(--success); font-size: 0.75rem; font-weight: bold; letter-spacing: 1px; background: rgba(0, 230, 118, 0.1); padding: 4px 8px; border-radius: 4px; }

.addon-options-row { display: flex; align-items: center; gap: 15px; margin-top: 8px; }
.color-opts { display: flex; gap: 8px; align-items: center; }
.color-label { font-size: 0.8rem; color: #888; margin-right: 5px; }
.dot { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
.dot.black { background: #000; border-color: #555; }
.dot.wood { background: #8b4513; }
.dot.active { border-color: white; transform: scale(1.2); box-shadow: 0 0 8px white; }

.qty-ctrl { display: inline-flex; align-items: center; gap: 8px; }
.qty-ctrl button {
    width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,0.1);
    border: none; color: white; cursor: pointer; font-size: 1rem; line-height: 1;
    display: flex; justify-content: center; align-items: center;
}
.qty-ctrl button:hover { background: rgba(255,255,255,0.2); }
.qty-ctrl span { font-size: 0.9rem; min-width: 15px; text-align: center; }

.btn-sm {
    background: transparent; border: 1px solid var(--accent); color: var(--accent);
    padding: 6px 16px; border-radius: 20px; cursor: pointer; font-size: 0.85rem;
    transition: 0.3s; font-weight: 600; white-space: nowrap;
}
.btn-sm.selected { background: var(--accent); color: white; }
.btn-sm:hover { background: rgba(216, 69, 255, 0.2); }

/* 订单总结 */
.summary-card .line-items { margin-bottom: auto; padding-bottom: 20px; }
.summary-card .item {
    display: flex; justify-content: space-between; margin-bottom: 12px;
    font-size: 1rem; border-bottom: 1px dashed rgba(255,255,255,0.1); padding-bottom: 8px;
}
.item.highlight { color: var(--success); }
.total-row {
    display: flex; justify-content: space-between; font-size: 1.8rem; font-weight: 800;
    margin-top: 20px; padding-top: 20px; border-top: 2px solid rgba(255,255,255,0.2); color: var(--accent);
}

/* ==========================================================================
   9. 底部导航栏
   ========================================================================== */
.step-navigation-bar {
    margin-top: 40px; display: flex; justify-content: space-between; align-items: center;
    padding: 20px 30px; background: rgba(0,0,0,0.3); border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.05); backdrop-filter: blur(10px);
}
.step-navigation-bar.single-btn { justify-content: flex-end; }
.btn-nav {
    height: 54px; padding: 0 45px; border-radius: 27px; font-weight: 600;
    cursor: pointer; font-size: 1rem; letter-spacing: 1px; text-transform: uppercase;
    transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; min-width: 160px;
}
.btn-nav.secondary { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #ccc; }
.btn-nav.secondary:hover { border-color: var(--accent); color: white; background: rgba(255,255,255,0.05); }
.btn-nav.primary { background: linear-gradient(135deg, #9c00e6, #d845ff); border: none; color: white; box-shadow: 0 4px 15px rgba(156, 0, 230, 0.4); }
.btn-nav.primary:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(156, 0, 230, 0.6); }
.btn-nav:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); transform: none; }

/* 动画与响应式 */
.fade-slide-enter-active, .fade-slide-leave-active { transition: opacity 0.3s ease, transform 0.3s ease; }
.fade-slide-enter, .fade-slide-leave-to { opacity: 0; transform: translateY(10px); }
.fade-slide-leave-active { position: absolute; width: 100%; left: 0; top: 0; z-index: -1; }

@media (max-width: 900px) {
    .two-col-grid, .checkout-grid, #static-skeleton .two-col-grid { grid-template-columns: 1fr !important; gap: 30px; }
    .glass-card { height: auto; }
    .certificate-preview.portrait { width: 100%; max-width: none; }
    .addon-card { padding: 15px; gap: 15px; }
    .addon-img { width: 60px; height: 60px; }
    .step-navigation-bar { flex-direction: column-reverse; gap: 15px; border-radius: 20px; }
    .btn-nav { width: 100%; }
    #star-naming-wrapper { padding-top: 80px; align-items: flex-start; }
}

/* ==========================================================================
   强制修复 Select 下拉框显示 (修复 Select2 干扰 & 恢复分组颜色)
   ========================================================================== */
select#constellation-select,
select.wc-no-select2 {
    visibility: visible !important;
    display: block !important;
    opacity: 1 !important;
    width: 100% !important;
    height: auto !important;
    padding: 14px !important;
    appearance: menulist !important; /* 还原原生外观 */
    -webkit-appearance: menulist !important;
    background-color: rgba(0,0,0,0.5) !important;
    color: #fff !important;
    z-index: 999 !important;
    position: relative !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 8px !important;
}

/* 选项通用样式 */
select#constellation-select option,
select.wc-no-select2 option {
    background-color: #0b021c;
    color: #fff;
    padding: 10px;
}

/* ★★★ 关键修复：恢复 optgroup 分组标题颜色 ★★★ */
select#constellation-select optgroup,
select.wc-no-select2 optgroup {
    background-color: #0b021c;
    color: #d845ff; /* 恢复原本的紫色高亮 */
    font-weight: 800;
    font-style: normal;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

/* 占位符颜色 (未选择时) */
select#constellation-select option[value=""],
select.wc-no-select2 option[value=""] {
    color: #aaa;
}


/* ==========================================================================
   强制修复下拉框聚焦样式 (Fix Select Focus State)
   优先级覆盖：确保 Constellation 和 Language 下拉框获得紫色高亮
   ========================================================================== */
select#constellation-select:focus,
select.wc-no-select2:focus,
select.no-select2:focus {
    border-color: #bd00ff !important; /* 强制紫色边框 */
    box-shadow: 0 0 15px rgba(189, 0, 255, 0.3) !important; /* 强制紫色光晕 */
    background-color: rgba(0, 0, 0, 0.7) !important;
    outline: none !important;
    color: #ffffff !important;
}