/* ============================
   烟花订单系统 - 样式文件
   ============================ */

:root {
    --primary: #ff4d4f;
    --primary-dark: #d9363e;
    --primary-light: #fff1f0;
    --success: #52c41a;
    --warning: #faad14;
    --text: #333;
    --text-secondary: #666;
    --text-light: #999;
    --border: #e8e8e8;
    --bg: #f5f5f5;
    --white: #fff;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    max-width: 768px;
    margin: 0 auto;
    min-height: 100vh;
}

/* ============================
   头部导航
   ============================ */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--primary);
    color: var(--white);
    padding: 12px 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.cart-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--white);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -8px;
    background: #faad14;
    color: #333;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.cart-badge:empty,
.cart-badge[data-count="0"] {
    display: none;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 8px;
}

.search-bar input {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    background: rgba(255,255,255,0.9);
}

.search-bar button {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

/* ============================
   分类标签栏
   ============================ */

.category-bar {
    position: sticky;
    top: 96px;
    z-index: 99;
    background: var(--white);
    padding: 8px 0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
}

.category-bar::-webkit-scrollbar {
    display: none;
}

.category-tag {
    display: inline-block;
    padding: 6px 14px;
    margin: 0 4px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    background: var(--bg);
    color: var(--text-secondary);
    border: none;
    transition: all 0.2s;
}

.category-tag:first-child {
    margin-left: 12px;
}

.category-tag.active {
    background: var(--primary);
    color: var(--white);
}

/* ============================
   商品列表
   ============================ */

.product-list {
    padding: 8px 12px;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.product-meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.product-meta .tag {
    background: var(--primary-light);
    color: var(--primary);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.product-prices {
    margin-top: 6px;
    display: flex;
    gap: 12px;
    align-items: baseline;
}

.price-unit {
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
}

.price-unit::before {
    content: '¥';
    font-size: 12px;
}

.price-box {
    color: var(--text-light);
    font-size: 12px;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    flex-shrink: 0;
}

.btn-add {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-add:hover {
    background: var(--primary-dark);
}

.btn-add-box {
    background: none;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

/* ============================
   加载和空状态
   ============================ */

.loading, .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.loading::after {
    content: '';
    display: block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 12px auto;
    animation: spin 0.8s linear infinite;
}

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

.load-more {
    text-align: center;
    padding: 16px;
}

.load-more button {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 8px 24px;
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
}

/* ============================
   购物车浮动按钮
   ============================ */

.cart-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(255,77,79,0.4);
    cursor: pointer;
    z-index: 200;
    text-decoration: none;
    transition: transform 0.2s;
}

.cart-float:hover {
    transform: scale(1.1);
}

.cart-float .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #faad14;
    color: #333;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================
   购物车页面
   ============================ */

.cart-page {
    padding: 12px;
    padding-bottom: 120px;
}

.cart-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
}

.cart-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.cart-item-name {
    font-size: 15px;
    font-weight: 500;
    flex: 1;
}

.cart-item-delete {
    color: var(--text-light);
    cursor: pointer;
    padding: 0 4px;
    font-size: 18px;
}

.cart-item-spec {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.cart-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.cart-item-price {
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.quantity-control button {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    font-size: 16px;
    cursor: pointer;
    color: var(--text);
}

.quantity-control input {
    width: 40px;
    height: 32px;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: center;
    font-size: 14px;
    outline: none;
}

/* 底部结算栏 */
.cart-footer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 768px;
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.cart-total {
    font-size: 14px;
    color: var(--text-secondary);
}

.cart-total .amount {
    color: var(--primary);
    font-size: 20px;
    font-weight: 600;
}

.btn-checkout {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 22px;
    padding: 10px 32px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.btn-checkout:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ============================
   结算页面
   ============================ */

.checkout-page {
    padding: 12px;
    padding-bottom: 100px;
}

.form-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.form-section h3 {
    font-size: 15px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-group label .required {
    color: var(--primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* 订单商品概要 */
.order-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid #f5f5f5;
}

.order-summary-item:last-child {
    border-bottom: none;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
    font-weight: 600;
}

.summary-total .amount {
    color: var(--primary);
    font-size: 18px;
}

/* ============================
   订单成功页面
   ============================ */

.success-page {
    text-align: center;
    padding: 60px 20px;
}

.success-icon {
    font-size: 64px;
    color: var(--success);
    margin-bottom: 16px;
}

.success-page h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.success-page .order-no {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.success-page .btn-back {
    display: inline-block;
    padding: 10px 32px;
    background: var(--primary);
    color: var(--white);
    border-radius: 22px;
    text-decoration: none;
    font-size: 15px;
}

/* ============================
   通知 Toast
   ============================ */

.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    color: var(--white);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

/* ============================
   导航返回
   ============================ */

.back-link {
    color: var(--white);
    text-decoration: none;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================
   响应式适配
   ============================ */

@media (max-width: 480px) {
    .product-card {
        padding: 12px;
    }

    .product-prices {
        flex-direction: column;
        gap: 2px;
    }
}

@media (min-width: 769px) {
    body {
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }
}

/* ============================
   视频播放
   ============================ */

.btn-video {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 11px;
    cursor: pointer;
    vertical-align: middle;
}

.btn-video:active {
    transform: scale(0.95);
}

.video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-overlay.show {
    display: flex;
}

.video-modal {
    background: #000;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    overflow: hidden;
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1a1a1a;
    color: #fff;
    font-size: 14px;
}

.video-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

#videoPlayer {
    width: 100%;
    max-height: 70vh;
    display: block;
    background: #000;
}
