/* ==========================================
   发卡网 - 前端样式
   简洁大气设计
   ========================================== */

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

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --primary-light: #ebf0ff;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --text: #2d3748;
    --text-light: #718096;
    --bg: #f7fafc;
    --white: #fff;
    --border: #e2e8f0;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
.site-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 0;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.site-header .logo {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 1px;
}

.site-header nav {
    display: flex;
    gap: 5px;
}

.site-header nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.site-header nav a:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* Main */
main.container {
    flex: 1;
    padding-top: 30px;
    padding-bottom: 40px;
}

/* Hero */
.hero {
    text-align: center;
    padding: 50px 20px 40px;
}

.hero h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.hero p {
    font-size: 16px;
    color: var(--text-light);
}

/* Section Header */
.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
}

/* Category Tabs */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.cat-tab {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-light);
    background: var(--white);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

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

.cat-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

/* Product Card Image */
.product-card-img {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--bg);
}

.product-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-card-img img {
    transform: scale(1.05);
}

.product-cat-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 500;
}

.product-card-body {
    padding: 20px;
    flex: 1;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
    line-height: 1.4;
}

.product-desc {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 16px;
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--danger);
}

.product-stock {
    font-size: 13px;
    color: var(--text-light);
}

.product-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.sales {
    font-size: 13px;
    color: var(--text-light);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

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

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #e53e3e;
}

/* Product Detail Page */
.page-nav {
    margin-bottom: 20px;
}

.back-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
}

.back-link:hover {
    text-decoration: underline;
}

.product-detail {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 768px) {
    .product-detail {
        grid-template-columns: 1fr;
    }
}

.product-info-card,
.order-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
}

.product-info-card h1 {
    font-size: 24px;
    margin-bottom: 16px;
}

/* Product Detail Image */
.product-detail-img {
    width: 100%;
    max-height: 300px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 20px;
    background: var(--bg);
}

.product-detail-img img {
    width: 100%;
    height: 100%;
    max-height: 300px;
    object-fit: contain;
    display: block;
}

.product-info-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.product-price-lg {
    font-size: 28px;
    font-weight: 700;
    color: var(--danger);
}

.stock-info {
    font-size: 14px;
    color: var(--text-light);
}

.product-description {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.product-description h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--text);
}

.desc-content {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-light);
}

.order-card h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

/* Order Form */
.order-form .form-group {
    margin-bottom: 18px;
}

.order-form label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.order-form input[type="email"],
.order-form input[type="number"],
.order-form input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.order-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 0;
}

.quantity-control input {
    width: 80px;
    text-align: center;
    border-radius: 0 !important;
    -moz-appearance: textfield;
}

.quantity-control input::-webkit-outer-spin-button,
.quantity-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-btn {
    width: 40px;
    height: 44px;
    border: 1px solid var(--border);
    background: var(--bg);
    font-size: 18px;
    cursor: pointer;
    color: var(--text);
    transition: background 0.2s;
}

.qty-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.qty-btn:last-child {
    border-radius: 0 6px 6px 0;
}

.qty-btn:hover {
    background: var(--primary-light);
}

.total-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--danger);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fff5f5;
    color: var(--danger);
    border: 1px solid #fed7d7;
}

.alert-warning {
    background: #fffaf0;
    color: #c05621;
    border: 1px solid #feebc8;
}

.alert-success {
    background: #f0fff4;
    color: #276749;
    border: 1px solid #c6f6d5;
}

/* Pay Container */
.pay-container {
    text-align: center;
}

.order-summary {
    text-align: left;
    background: var(--bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.order-summary h3 {
    text-align: center;
    color: var(--success);
    font-size: 18px;
    margin-bottom: 16px;
}

.order-summary table {
    width: 100%;
}

.order-summary td {
    padding: 6px 10px;
    font-size: 14px;
}

.order-summary td:first-child {
    color: var(--text-light);
}

.order-summary .price {
    color: var(--danger);
    font-weight: 700;
    font-size: 18px;
}

.pay-tip {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-light);
}

.pay-tip a {
    color: var(--primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
}

/* Query Page */
.query-page {
    max-width: 700px;
    margin: 0 auto;
}

.query-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    text-align: center;
    margin-bottom: 24px;
}

.query-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.query-card p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
}

.query-form .input-group {
    display: flex;
    gap: 10px;
}

.query-form .input-group input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.query-form .input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.orders-list {
    margin-top: 24px;
}

.orders-list h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.order-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 16px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.order-no {
    font-size: 13px;
    color: var(--text-light);
}

.order-status {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.status-0 { background: #fffaf0; color: #c05621; }
.status-1 { background: #f0fff4; color: #276749; }
.status-2 { background: #f7fafc; color: var(--text-light); }
.status-3 { background: #fff5f5; color: var(--danger); }

.order-body {
    padding: 20px;
}

.order-body table {
    width: 100%;
}

.order-body td {
    padding: 5px 10px;
    font-size: 14px;
}

.order-body td:first-child {
    color: var(--text-light);
    width: 80px;
}

.card-keys {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.card-keys h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text);
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-key-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.card-index {
    font-size: 13px;
    color: var(--text-light);
    min-width: 28px;
}

.card-key-item code {
    flex: 1;
    font-size: 14px;
    color: var(--text);
    word-break: break-all;
}

.btn-copy {
    padding: 4px 12px;
    font-size: 12px;
    white-space: nowrap;
}

.no-card,
.pay-reminder,
.expired-reminder {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
}

/* Pay Result Page */
.pay-result {
    max-width: 520px;
    margin: 40px auto;
}

.result-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 50px 40px;
    text-align: center;
}

.result-icon {
    width: 72px;
    height: 72px;
    line-height: 72px;
    border-radius: 50%;
    font-size: 32px;
    margin: 0 auto 20px;
}

.result-card.success .result-icon {
    background: #f0fff4;
    color: var(--success);
}

.result-card.pending .result-icon {
    background: #fffaf0;
    color: var(--warning);
}

.result-card h1 {
    font-size: 24px;
    margin-bottom: 12px;
}

.result-card p {
    font-size: 15px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.result-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Footer */
.site-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    margin-top: auto;
}

.site-footer p {
    font-size: 13px;
    color: var(--text-light);
}

/* Admin Login Override */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 24px;
    color: var(--text);
    margin-bottom: 6px;
}

.login-header p {
    font-size: 14px;
    color: var(--text-light);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer a {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    text-decoration: none;
}

.login-footer a:hover {
    color: #fff;
}

/* ==========================================
   响应式设计
   ========================================== */

/* 平板 (≤1024px) */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

/* 小屏/手机横屏 (≤768px) */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .hero {
        padding: 30px 16px 24px;
    }

    .hero h1 {
        font-size: 22px;
    }

    .hero p {
        font-size: 14px;
    }

    .product-card-img {
        height: 120px;
    }

    .product-card-body {
        padding: 14px;
    }

    .product-name {
        font-size: 14px;
    }

    .product-desc {
        font-size: 12px;
        margin-bottom: 10px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-price {
        font-size: 18px;
    }

    .product-stock {
        font-size: 11px;
    }

    .product-card-footer {
        padding: 10px 14px;
    }

    .sales {
        font-size: 11px;
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: 12px;
    }

    .product-detail {
        grid-template-columns: 1fr;
    }

    .product-info-card,
    .order-card {
        padding: 20px;
    }

    .product-info-card h1 {
        font-size: 20px;
    }

    .product-price-lg {
        font-size: 22px;
    }

    .product-detail-img {
        max-height: 200px;
    }

    .product-detail-img img {
        max-height: 200px;
    }

    .category-tabs {
        gap: 6px;
    }

    .cat-tab {
        padding: 6px 14px;
        font-size: 13px;
    }

    .query-card {
        padding: 24px;
    }

    .query-form .input-group {
        flex-direction: column;
    }

    .order-header {
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
    }

    .card-key-item {
        flex-wrap: wrap;
    }

    .card-key-item code {
        font-size: 12px;
        width: 100%;
        order: 1;
    }

    .btn-copy {
        order: 2;
    }

    .pay-result {
        margin: 20px auto;
    }

    .result-card {
        padding: 30px 20px;
    }
}

/* 小手机 (≤480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    main.container {
        padding-top: 20px;
        padding-bottom: 30px;
    }

    .product-grid {
        gap: 10px;
    }

    .product-card-img {
        height: 100px;
    }

    .product-card-body {
        padding: 10px;
    }

    .product-name {
        font-size: 13px;
    }

    .product-price {
        font-size: 16px;
    }

    .product-card-footer {
        padding: 8px 10px;
    }

    .site-header .logo {
        font-size: 16px;
    }

    .site-header nav a {
        padding: 6px 10px;
        font-size: 13px;
    }

    .order-summary td {
        font-size: 13px;
    }

    .quantity-control input {
        width: 60px;
    }
}
