/**
 * RuiNexus Market - 前端样式 (亮色主题)
 *
 * 开发者: RuiNexus / YeHuaiJing
 */

/* ===== Design Tokens ===== */
:root {
    --primary: #2B6DE5;
    --primary-dark: #1e5bc6;
    --primary-light: #e8f0fe;
    --bg: #f5f6fa;
    --white: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #555770;
    --text-muted: #8e90a6;
    --text-disabled: #c4c6d4;
    --border: #e4e6ed;
    --border-strong: #cdd0db;
    --surface: #ffffff;
    --surface-hover: #f8f9fc;
    --surface-active: #eef1f8;
    --price: #e74c3c;
    --price-original: #8e90a6;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --remaining-safe: #27ae60;
    --remaining-warning: #f39c12;
    --remaining-danger: #e74c3c;
    --font: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --max-width: 1200px;
    --nav-height: 60px;
    --border-radius: 0px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; height: auto; }

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

/* ===== Nav ===== */
.nav {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    height: var(--nav-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.nav-brand {
    font-size: 18px; font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.5px;
}

.nav-logo {
    display: flex; align-items: center;
    flex-shrink: 0;
}

.nav-logo img {
    display: block;
    max-height: 34px;
    width: auto;
    height: auto;
}

.nav-links { display: flex; gap: 28px; list-style: none; align-items: center; }

.nav-links a {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--primary); }

.nav-actions { display: flex; gap: 10px; align-items: center; }

.nav-cta {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--border-radius);
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.nav-cta:hover { background: var(--primary-dark); color: var(--white); }

.nav-cta--ghost {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
    border-radius: var(--border-radius);
    transition: all 0.2s;
}

.nav-cta--ghost:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Notice ===== */
.site-notice {
    background: #fff8e6;
    border-left: 4px solid var(--warning);
    padding: 12px 24px;
    font-size: 14px;
    color: #7c5e00;
    line-height: 1.6;
}

/* ===== Hero ===== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #1a4fc9 100%);
    padding: 72px 24px;
    text-align: center;
    color: var(--white);
}

.hero-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.85;
    margin-bottom: 12px;
}

.hero h1 {
    font-size: 40px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero p {
    font-size: 16px;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 28px;
    line-height: 1.7;
}

.hero-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn-primary {
    display: inline-block;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    background: var(--white);
    color: var(--primary);
    border-radius: var(--border-radius);
    transition: all 0.2s;
    border: 2px solid var(--white);
}

.btn-primary:hover { background: #f0f4ff; transform: translateY(-1px); }

.btn-ghost {
    display: inline-block;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 500;
    background: transparent;
    color: rgba(255,255,255,0.9);
    border-radius: var(--border-radius);
    border: 2px solid rgba(255,255,255,0.5);
    transition: all 0.2s;
}

.btn-ghost:hover { border-color: var(--white); color: var(--white); }

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

.section-label {
    font-size: 12px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.5px;
    margin-bottom: 6px;
}

.section-title {
    font-size: 28px; font-weight: 700; line-height: 1.3;
    margin-bottom: 28px;
    color: var(--text-primary);
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

/* ===== Toolbar ===== */
.toolbar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.toolbar__search {
    flex: 1; min-width: 220px;
    position: relative;
}

.toolbar__search-icon {
    position: absolute; left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.toolbar__search input {
    width: 100%;
    background: var(--white); color: var(--text-primary);
    border: 1px solid var(--border-strong);
    padding: 10px 14px 10px 38px; border-radius: var(--border-radius);
    font-family: var(--font); font-size: 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.toolbar__search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43,109,229,0.12);
}

.toolbar__search input::placeholder { color: var(--text-disabled); }

.toolbar__sort {
    display: flex; align-items: center; gap: 8px;
}

.toolbar__sort-label {
    font-size: 13px; color: var(--text-muted);
    white-space: nowrap;
}

.toolbar__sort select {
    padding: 10px 36px 10px 14px;
    background: var(--white); color: var(--text-primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--border-radius);
    font-family: var(--font); font-size: 14px;
    outline: none; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238e90a6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.toolbar__sort select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43,109,229,0.12);
}

.toolbar__total {
    font-size: 13px; color: var(--text-muted);
    white-space: nowrap;
    margin-left: auto;
}

/* ===== Loading ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14px;
}

.loading i { font-size: 20px; }

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

/* ===== Card Grid ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

/* ===== Product Card ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 24px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    display: flex; flex-direction: column;
    gap: 14px;
}

.card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.card__header {
    display: flex; align-items: flex-start;
    justify-content: space-between; gap: 12px;
}

.card__title {
    font-size: 17px; font-weight: 600; line-height: 1.4;
    color: var(--text-primary);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card__arrow {
    flex-shrink: 0; width: 18px; height: 18px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.card:hover .card__arrow { transform: translateX(3px); }

.card__tags {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.card__tag {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 0px;
    font-size: 12px; font-weight: 500;
    color: var(--text-muted);
    background: var(--surface-hover);
}

.card__tag--days { color: var(--text-secondary); }

.card__tag--days.is-safe { border-color: var(--remaining-safe); color: var(--remaining-safe); background: rgba(39,174,96,0.06); }

.card__tag--days.is-warning { border-color: var(--remaining-warning); color: var(--remaining-warning); background: rgba(243,156,18,0.06); }

.card__tag--days.is-danger { border-color: var(--remaining-danger); color: var(--remaining-danger); background: rgba(231,76,60,0.06); }

/* Specs */
.card__specs {
    display: flex; flex-direction: column; gap: 6px;
}

.card__spec-row {
    display: flex; align-items: center;
    font-size: 13px; line-height: 1.5;
}

.card__spec-label {
    color: var(--text-muted);
    flex-shrink: 0; min-width: 56px;
}

.card__spec-value {
    color: var(--text-secondary);
    font-weight: 500;
}

.card__spec-tag {
    display: inline-block;
    padding: 1px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 0px;
    font-size: 11px; font-weight: 600;
}

.card__spec-tag.is-yes { border-color: var(--remaining-safe); color: var(--remaining-safe); background: rgba(39,174,96,0.06); }

.card__spec-tag.is-no { color: var(--text-muted); }

/* Meta */
.card__meta {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--text-muted);
    flex-wrap: wrap;
}

.card__meta-item {
    display: inline-flex; align-items: center; gap: 4px;
}

.card__meta-sep {
    width: 1px; height: 10px;
    background: var(--border);
    margin: 0 2px;
}

/* Remaining Bar */
.card__remaining-bar {
    position: relative;
    height: 22px;
    background: rgba(0,0,0,0.04);
    border-radius: 0px;
    overflow: hidden;
}

.card__remaining-fill {
    position: absolute; left: 0; top: 0; height: 100%;
    border-radius: 0px;
    transition: width 0.5s ease;
}

.card__remaining-bar.is-safe .card__remaining-fill { background: rgba(39,174,96,0.3); }

.card__remaining-bar.is-warning .card__remaining-fill { background: rgba(243,156,18,0.3); }

.card__remaining-bar.is-danger .card__remaining-fill { background: rgba(231,76,60,0.3); }

.card__remaining-text {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px; color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap; z-index: 1;
}

/* Pricing */
.card__pricing {
    display: flex; align-items: baseline; gap: 6px;
    margin-top: 4px;
}

.card__discount {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--danger);
    border-radius: 0px;
    color: var(--danger);
    font-size: 11px; font-weight: 600;
}

.card__price-symbol { font-size: 15px; color: var(--price); font-weight: 700; }

.card__price-amount { font-size: 26px; color: var(--price); font-weight: 700; line-height: 1; }

.card__price-unit { font-size: 13px; color: var(--text-muted); margin-right: 8px; }

.card__price-original { font-size: 14px; color: var(--price-original); text-decoration: line-through; }

/* ===== Empty State ===== */
.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 0;
    color: var(--text-muted);
    font-size: 16px;
}

.empty__icon { font-size: 56px; margin-bottom: 16px; opacity: 0.25; }

/* ===== Pagination ===== */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; margin-top: 36px;
    flex-wrap: wrap;
}

.pagination__item {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 14px; font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.pagination__item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination__item.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination__item.disabled {
    color: var(--text-disabled);
    cursor: not-allowed; pointer-events: none;
}

.pagination__info {
    font-size: 13px; color: var(--text-muted);
    margin-left: 14px;
}

/* ===== Showcase Section ===== */
.showcase {
    background: var(--white);
    padding: 56px 24px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.showcase-inner { max-width: var(--max-width); margin: 0 auto; }

/* ===== Breadcrumb ===== */
.breadcrumb {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--text-muted);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-secondary);
    transition: color 0.15s;
}

.breadcrumb a:hover { color: var(--primary); }

.breadcrumb__sep { margin: 0 2px; color: var(--text-disabled); }

.breadcrumb__current { color: var(--text-primary); font-weight: 500; }

/* ===== Detail Layout ===== */
.detail {
    display: flex; gap: 28px;
    align-items: flex-start;
}

.detail__main {
    flex: 1; min-width: 0;
}

.detail__sidebar {
    width: 340px; flex-shrink: 0;
    position: sticky; top: calc(var(--nav-height) + 20px);
}

/* ===== Detail Title ===== */
.detail__title {
    font-size: 26px; font-weight: 700; line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ===== Detail Tags ===== */
.detail__tags {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* ===== Detail Section Title ===== */
.detail__section-title {
    font-size: 16px; font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* ===== Detail Description ===== */
.detail__description {
    margin-bottom: 28px;
}

.detail__description p {
    font-size: 15px; line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-line;
}

/* ===== Detail Specs Table ===== */
.detail__specs {
    margin-bottom: 28px;
}

.detail__specs-table {
    width: 100%;
    border-collapse: collapse;
}

.detail__specs-table tr {
    border-bottom: 1px solid var(--border);
}

.detail__specs-table tr:last-child {
    border-bottom: none;
}

.detail__specs-label {
    padding: 12px 16px 12px 0;
    font-size: 14px; color: var(--text-muted);
    width: 120px; white-space: nowrap;
    vertical-align: middle;
}

.detail__specs-value {
    padding: 12px 0;
    font-size: 14px; color: var(--text-secondary);
    font-weight: 500;
    vertical-align: middle;
}

/* ===== Detail Remaining ===== */
.detail__remaining {
    margin-bottom: 28px;
}

.detail__remaining .card__remaining-bar {
    max-width: 480px;
}

/* ===== Detail Card (Sidebar) ===== */
.detail__card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 16px;
}

/* ===== Detail Price Block ===== */
.detail__price-block {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.detail__price-main {
    display: flex; align-items: baseline; gap: 4px;
    margin-bottom: 8px;
}

.detail__price-symbol {
    font-size: 18px; color: var(--price); font-weight: 700;
}

.detail__price-amount {
    font-size: 36px; color: var(--price); font-weight: 700; line-height: 1;
}

.detail__price-unit {
    font-size: 14px; color: var(--text-muted);
    margin-left: 4px;
}

.detail__price-original-line {
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap;
}

.detail__price-original {
    font-size: 14px; color: var(--price-original);
    text-decoration: line-through;
}

/* ===== Detail Seller ===== */
.detail__seller {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.detail__seller-icon {
    font-size: 36px; color: var(--text-muted);
}

.detail__seller-info {
    display: flex; flex-direction: column;
}

.detail__seller-label {
    font-size: 12px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}

.detail__seller-name {
    font-size: 16px; font-weight: 600;
    color: var(--text-primary);
}

/* ===== Detail Actions ===== */
.detail__actions {
    display: flex; flex-direction: column; gap: 10px;
    margin-bottom: 16px;
}

.detail__btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px 20px;
    font-family: var(--font); font-size: 15px; font-weight: 600;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-strong);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.detail__btn--buy {
    background: var(--primary); color: var(--white);
    border-color: var(--primary);
    font-size: 16px;
}

.detail__btn--buy:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--white);
}

.detail__btn--fav {
    background: var(--white); color: var(--text-secondary);
}

.detail__btn--fav:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.detail__btn--fav.is-active {
    border-color: var(--danger); color: var(--danger);
    background: rgba(231,76,60,0.04);
}

.detail__btn--fav:disabled {
    opacity: 0.5; cursor: not-allowed;
}

.detail__btn--back {
    background: var(--white); color: var(--text-secondary);
}

.detail__btn--back:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== Detail Meta ===== */
.detail__meta {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 13px; color: var(--text-muted);
}

.detail__meta-item {
    display: flex; align-items: center; gap: 6px;
}

/* ===== Detail Tips ===== */
.detail__tips-title {
    font-size: 14px; font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}

.detail__tips-title i {
    color: var(--primary);
}

.detail__tips-list {
    list-style: none;
    display: flex; flex-direction: column; gap: 8px;
}

.detail__tips-list li {
    font-size: 13px; color: var(--text-muted);
    line-height: 1.6;
    padding-left: 14px;
    position: relative;
}

.detail__tips-list li::before {
    content: ''; position: absolute;
    left: 0; top: 8px;
    width: 4px; height: 4px;
    background: var(--text-disabled);
    border-radius: 0px;
}

/* ===== Footer ===== */
.footer {
    padding: 44px 24px 28px;
    border-top: 1px solid var(--border);
}

.footer-inner {
    max-width: var(--max-width); margin: 0 auto;
    display: flex; flex-wrap: wrap; gap: 56px;
}

.footer__brand { flex: 1; min-width: 200px; }

.footer__brand-name {
    font-size: 15px; font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.footer__brand-desc {
    font-size: 13px; color: var(--text-muted);
    line-height: 1.6; max-width: 320px;
}

.footer__links-group { min-width: 130px; }

.footer__links-group h4 {
    font-size: 13px; font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.footer__links-group ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.footer__links-group a {
    font-size: 14px; color: var(--text-secondary);
    transition: color 0.15s;
}

.footer__links-group a:hover { color: var(--primary); }

.footer__bottom {
    max-width: var(--max-width); margin: 0 auto;
    padding-top: 20px;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 8px;
    font-size: 12px; color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nav { padding: 0 16px; }
    .nav-links { display: none; }
    .container { padding: 0 16px; }
    .hero { padding: 48px 16px 40px; }
    .hero h1 { font-size: 30px; }
    .section { padding: 36px 16px; }
    .showcase { padding: 36px 16px; }
    .card-grid { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar__total { margin-left: 0; }
    .footer { padding: 28px 16px 20px; }
    .footer-inner { flex-direction: column; gap: 28px; }
    .detail { flex-direction: column; }
    .detail__sidebar { width: 100%; position: static; }
    .detail__title { font-size: 22px; }
    .detail__specs-label { width: 90px; }
}
