/* ===== 导潮客商城 共享样式 ===== */

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

:root {
    --bg: #0f0f1a;
    --card: #1a1a2e;
    --card-hover: #222240;
    --primary: #E53935;
    --primary-dark: #B71C1C;
    --primary-light: #FF5252;
    --gold: #FFD600;
    --white: #FFFFFF;
    --gray: #8899AA;
    --gray-light: #B0C0D0;
    --border: #2a2a40;
    --success: #00C853;
    --danger: #FF1744;
    --container: 1200px;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--white);
    min-height: 100vh;
}

/* ===== Navbar ===== */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.08);
}
.navbar-inner {
    max-width: var(--container); margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
}
.navbar-brand {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none;
}
.navbar-logo { height: 32px; width: auto; }
.navbar-title { font-size: 18px; font-weight: 700; color: #333; }
.navbar-links { display: flex; align-items: center; gap: 12px; }
.navbar-link, .navbar-back {
    color: #555; text-decoration: none;
    font-size: 14px; padding: 6px 14px;
    border: 1px solid #ddd; border-radius: 18px;
    transition: all 0.2s; cursor: pointer;
    white-space: nowrap;
}
.navbar-link:hover, .navbar-back:hover { color: var(--primary); border-color: var(--primary); }
.navbar-link.primary-link {
    background: var(--primary); color: var(--white); border-color: transparent;
}
.navbar-link.primary-link:hover { background: var(--primary-dark); }
.navbar-user { display: flex; align-items: center; gap: 8px; color: #555; font-size: 14px; cursor: pointer; }

/* ===== Hero ===== */
.mall-hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 48px 24px; text-align: center;
    border-bottom: 1px solid var(--border);
}
.mall-hero h1 {
    font-size: 36px; font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--gold) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}
.mall-hero p { color: var(--gray); font-size: 16px; }

/* ===== Container ===== */
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* ===== Category Filter ===== */
.cat-section { padding: 24px 0 8px; }
.cat-scroll {
    display: flex; gap: 10px; overflow-x: auto;
    padding-bottom: 8px; -webkit-overflow-scrolling: touch;
}
.cat-scroll::-webkit-scrollbar { height: 0; }
.cat-pill {
    flex-shrink: 0; padding: 8px 20px;
    background: var(--card); color: var(--gray-light);
    border: 1px solid var(--border); border-radius: 20px;
    font-size: 14px; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
}
.cat-pill:hover { border-color: var(--primary); color: var(--white); }
.cat-pill.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white); border-color: transparent;
}

/* ===== Product Grid ===== */
.product-section { padding: 20px 0 48px; }
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.product-card {
    background: var(--card); border-radius: 16px;
    overflow: hidden; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(229,57,53,0.15);
    border-color: var(--primary);
}
.product-cover {
    width: 100%; aspect-ratio: 1/1; object-fit: cover;
    background: linear-gradient(135deg, #1a1a2e, #222240);
    display: flex; align-items: center; justify-content: center;
    font-size: 64px; position: relative; overflow: hidden;
}
.product-cover img { width: 100%; height: 100%; object-fit: cover; }
.product-info { padding: 16px; }
.product-name {
    font-size: 16px; font-weight: 600; color: var(--white);
    margin-bottom: 6px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.product-subtitle {
    font-size: 12px; color: var(--gray);
    margin-bottom: 10px; min-height: 18px;
}
.product-bottom {
    display: flex; align-items: center; justify-content: space-between;
}
.product-price { font-size: 22px; font-weight: 700; color: var(--primary-light); }
.product-price .yen { font-size: 14px; }
.product-original {
    font-size: 12px; color: var(--gray);
    text-decoration: line-through; margin-left: 6px;
}
.product-sales { font-size: 12px; color: var(--gray); }
.product-tag {
    display: inline-block; padding: 2px 8px;
    background: rgba(229,57,53,0.15); color: var(--primary-light);
    border-radius: 4px; font-size: 11px; margin-bottom: 8px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block; padding: 10px 24px; border-radius: var(--radius);
    font-size: 15px; font-weight: 600; cursor: pointer; border: none;
    transition: all 0.2s; text-align: center; text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229,57,53,0.4);
}
.btn-outline {
    background: transparent; color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: rgba(229,57,53,0.1); }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 14px 32px; font-size: 17px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block; font-size: 14px; color: var(--gray-light);
    margin-bottom: 6px; font-weight: 500;
}
.form-input {
    width: 100%; padding: 12px 16px;
    background: rgba(255,255,255,0.06); color: var(--white);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 15px; transition: border-color 0.2s; outline: none;
}
.form-input:focus { border-color: var(--primary); }
.form-input::placeholder { color: var(--gray); }
.form-select {
    width: 100%; padding: 12px 16px;
    background: rgba(255,255,255,0.06); color: var(--white);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 15px; outline: none; cursor: pointer;
    -webkit-appearance: none; appearance: none;
}
.form-select:focus { border-color: var(--primary); }
.form-error { color: var(--danger); font-size: 13px; margin-top: 4px; }
.form-hint { color: var(--gray); font-size: 13px; margin-top: 4px; }

/* ===== Modal ===== */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.7); align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--card); border-radius: 20px;
    max-width: 480px; width: 100%; max-height: 85vh;
    overflow-y: auto; position: relative;
    border: 1px solid var(--border);
}
.modal-header {
    padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(0,0,0,0.5); color: var(--white);
    border: none; font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(229,57,53,0.7); }
.modal-body { padding: 24px; }
.modal-footer { padding: 0 24px 24px; display: flex; gap: 12px; justify-content: flex-end; }

/* ===== Tabs ===== */
.tabs {
    display: flex; border-bottom: 2px solid var(--border);
    margin-bottom: 24px; overflow-x: auto;
}
.tab {
    padding: 12px 24px; font-size: 15px; font-weight: 500;
    color: var(--gray); cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; white-space: nowrap;
    transition: all 0.2s;
}
.tab:hover { color: var(--white); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Cards (general) ===== */
.section-card {
    background: var(--card); border-radius: 16px;
    padding: 24px; border: 1px solid var(--border);
    margin-bottom: 20px;
}
.section-title {
    font-size: 18px; font-weight: 600; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}

/* ===== Balance Display ===== */
.balance-display {
    text-align: center; padding: 32px 24px;
    background: linear-gradient(135deg, rgba(229,57,53,0.1), rgba(255,214,0,0.05));
    border-radius: 16px; border: 1px solid rgba(229,57,53,0.2);
}
.balance-amount { font-size: 40px; font-weight: 800; color: var(--primary-light); }
.balance-label { color: var(--gray); font-size: 14px; margin-top: 6px; }
.balance-actions { margin-top: 16px; display: flex; gap: 12px; justify-content: center; }

/* ===== Order List ===== */
.order-card {
    background: var(--card); border-radius: 12px;
    border: 1px solid var(--border); margin-bottom: 12px;
    overflow: hidden;
}
.order-header {
    padding: 12px 16px; background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between;
    font-size: 13px; color: var(--gray);
}
.order-status { font-weight: 600; }
.order-status.pending { color: var(--gold); }
.order-status.paid { color: #2196F3; }
.order-status.shipped { color: #FF9800; }
.order-status.completed { color: var(--success); }
.order-status.cancelled, .order-status.refunded { color: var(--gray); }
.order-body {
    padding: 16px; display: flex; gap: 14px; align-items: center;
}
.order-cover {
    width: 72px; height: 72px; border-radius: 8px;
    background: linear-gradient(135deg, #1a1a2e, #222240);
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; flex-shrink: 0; overflow: hidden;
}
.order-cover img { width: 100%; height: 100%; object-fit: cover; }
.order-info { flex: 1; min-width: 0; }
.order-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.order-price { font-size: 16px; font-weight: 700; color: var(--primary-light); }
.order-qty { font-size: 13px; color: var(--gray); margin-top: 4px; }
.order-footer {
    padding: 12px 16px; border-top: 1px solid var(--border);
    display: flex; gap: 8px; justify-content: flex-end;
}

/* ===== Address Card ===== */
.address-card {
    background: var(--card); border-radius: 12px;
    padding: 16px; margin-bottom: 12px;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}
.address-card.default { border-color: rgba(229,57,53,0.4); }
.address-card:hover { border-color: var(--primary); }
.address-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.address-name { font-weight: 600; font-size: 16px; }
.address-phone { color: var(--gray); margin-left: 12px; font-size: 14px; }
.address-detail { color: var(--gray-light); font-size: 14px; line-height: 1.6; }
.address-default-badge {
    display: inline-block; padding: 2px 8px;
    background: rgba(229,57,53,0.15); color: var(--primary-light);
    border-radius: 4px; font-size: 11px; margin-right: 8px;
}
.address-actions { margin-top: 10px; display: flex; gap: 8px; }

/* ===== Empty State ===== */
.loading, .empty {
    text-align: center; padding: 80px 20px; color: var(--gray);
    font-size: 16px;
}
.loading-spinner {
    display: inline-block; width: 40px; height: 40px;
    border: 3px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Login/Register Page ===== */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: calc(100vh - 56px); padding: 24px;
}
.auth-card {
    background: var(--card); border-radius: 20px;
    max-width: 420px; width: 100%; padding: 40px;
    border: 1px solid var(--border);
}
.auth-title { font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 28px; }
.auth-tabs {
    display: flex; margin-bottom: 28px;
    background: rgba(255,255,255,0.05); border-radius: 10px; padding: 4px;
}
.auth-tab {
    flex: 1; text-align: center; padding: 10px;
    font-size: 15px; font-weight: 500; color: var(--gray);
    cursor: pointer; border-radius: 8px; transition: all 0.2s;
}
.auth-tab.active { background: var(--primary); color: var(--white); }
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-submit { margin-top: 8px; }

/* ===== Product Detail Page ===== */
.product-detail {
    display: grid; grid-template-columns: 1fr 420px;
    gap: 32px; padding: 32px 0;
}
.product-gallery {
    background: var(--card); border-radius: 16px;
    overflow: hidden; border: 1px solid var(--border);
}
.product-main-image {
    width: 100%; height: 420px; object-fit: contain;
    background: linear-gradient(135deg, #1a1a2e, #222240);
    display: flex; align-items: center; justify-content: center;
    font-size: 100px;
}
.product-main-image img { width: 100%; height: 100%; object-fit: contain; }
.product-thumbs {
    display: flex; gap: 10px; padding: 16px; overflow-x: auto;
}
.product-thumb {
    width: 64px; height: 64px; border-radius: 8px;
    border: 2px solid var(--border); cursor: pointer;
    overflow: hidden; flex-shrink: 0; transition: border-color 0.2s;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; background: #1a1a2e;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb.active { border-color: var(--primary); }
.product-sidebar { position: sticky; top: 76px; align-self: start; }
.product-sidebar .section-card { margin-bottom: 16px; }
.product-detail-name { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.product-detail-subtitle { color: var(--gray); margin-bottom: 16px; }
.product-detail-price { font-size: 36px; font-weight: 800; color: var(--primary-light); }
.product-detail-original { font-size: 16px; color: var(--gray); text-decoration: line-through; margin-left: 10px; }
.product-detail-meta {
    display: flex; gap: 20px; margin-top: 12px; padding-top: 12px;
    border-top: 1px solid var(--border); color: var(--gray); font-size: 14px;
}
.product-detail-desc {
    padding: 24px 0; color: var(--gray-light); font-size: 15px; line-height: 1.8;
}
.product-detail-desc img { max-width: 100%; border-radius: 8px; margin: 8px 0; }
.product-detail-desc h1, .product-detail-desc h2, .product-detail-desc h3 { color: var(--white); margin: 16px 0 8px; }

/* ===== Transaction List ===== */
.tx-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 0; border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.tx-item:last-child { border-bottom: none; }
.tx-left { display: flex; flex-direction: column; gap: 4px; }
.tx-desc { color: var(--gray-light); }
.tx-time { color: var(--gray); font-size: 12px; }
.tx-right { text-align: right; }
.tx-amount { font-weight: 700; font-size: 16px; }
.tx-amount.in { color: var(--success); }
.tx-amount.out { color: var(--primary-light); }
.tx-balance { color: var(--gray); font-size: 12px; margin-top: 2px; }

/* ===== Toast ===== */
.toast {
    position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.85); color: var(--white);
    padding: 12px 28px; border-radius: 24px; font-size: 14px;
    z-index: 300; opacity: 0; pointer-events: none;
    transition: opacity 0.3s; white-space: nowrap;
}
.toast.show { opacity: 1; }
.toast.success { background: rgba(0,200,83,0.9); }
.toast.error { background: rgba(255,23,68,0.9); }

/* ===== User Center Layout ===== */
.user-header {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 32px 24px; text-align: center; margin-bottom: 24px;
    border-radius: 16px; border: 1px solid var(--border);
}
.user-avatar {
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; margin: 0 auto 12px; color: var(--white);
}
.user-nickname { font-size: 20px; font-weight: 700; }
.user-meta { color: var(--gray); font-size: 14px; margin-top: 4px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .product-detail { grid-template-columns: 1fr; gap: 20px; }
    .product-main-image { height: 300px; }
    .product-sidebar { position: static; }
    .auth-card { padding: 28px 24px; }
}

@media (max-width: 640px) {
    .navbar-inner { padding: 10px 16px; }
    .navbar-logo { height: 26px; }
    .navbar-title { font-size: 15px; }
    .navbar-link, .navbar-back { font-size: 13px; padding: 5px 12px; }
    .mall-hero { padding: 36px 16px; }
    .mall-hero h1 { font-size: 28px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-cover { font-size: 48px; }
    .product-info { padding: 12px; }
    .product-name { font-size: 14px; }
    .product-price { font-size: 18px; }
    .modal { max-width: 100%; margin: 0; border-radius: 20px 20px 0 0; }
    .tabs { gap: 0; }
    .tab { padding: 10px 16px; font-size: 14px; }
    .balance-amount { font-size: 32px; }
    .order-body { gap: 12px; }
    .order-cover { width: 60px; height: 60px; font-size: 24px; }
}
