/* ===========================================
   JY 自动小店 — 全局样式
   =========================================== */

/* ==================== Reset & Base ==================== */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fc;
    color: #1a1a2e;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #4f46e5;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #3730a3;
}

/* ==================== Layout ==================== */

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

main.container {
    flex: 1;
    padding-top: 32px;
    padding-bottom: 64px;
}

/* ==================== Header ==================== */

.site-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.3px;
}

.logo:hover {
    color: #4f46e5;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-links a {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    padding: 6px 0;
    transition: color 0.2s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #4f46e5;
    transition: width 0.2s;
}

.nav-links a:hover {
    color: #4f46e5;
}

.nav-links a:hover::after {
    width: 100%;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #64748b;
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

/* ==================== Footer ==================== */

.site-footer {
    background: #fff;
    border-top: 1px solid #e8e8e8;
    padding: 32px 0 24px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.footer-brand {
    font-size: 20px;
    font-weight: 800;
    color: #4f46e5;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.footer-copy {
    font-size: 12px;
    color: #94a3b8;
}

/* ==================== Hero Section ==================== */

.hero {
    text-align: center;
    padding: 60px 0 48px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 40%, rgba(79, 70, 229, 0.03) 0%, transparent 60%);
    pointer-events: none;
}

.hero h1 {
    font-size: 36px;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.subtitle {
    font-size: 17px;
    color: #64748b;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ==================== Product Grid ==================== */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 8px;
}

/* ==================== Product Card ==================== */

.product-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
}

.product-thumb {
    height: 160px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.thumb-placeholder {
    font-size: 56px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 12px 12px 0 0;
}

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

.product-name {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 8px;
    line-height: 1.4;
}

.product-desc {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
    line-height: 1.6;
    flex: 1;
}

.product-price {
    font-size: 24px;
    font-weight: 700;
    color: #4f46e5;
    margin-bottom: 16px;
}

.product-card-footer {
    display: flex;
    gap: 8px;
}

.product-card-footer .btn {
    flex: 1;
}

/* ==================== Buttons ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    gap: 6px;
}

.btn-primary {
    background: #4f46e5;
    color: #fff;
}

.btn-primary:hover {
    background: #4338ca;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid #4f46e5;
    color: #4f46e5;
}

.btn-outline:hover {
    background: #4f46e5;
    color: #fff;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 15px;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    color: #fff;
}

.btn-success {
    background: #10b981;
    color: #fff;
}

.btn-success:hover {
    background: #059669;
    color: #fff;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
    color: #fff;
}

/* ==================== Forms ==================== */

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

.hint {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
    display: block;
}

.form-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-top: 12px;
    border: 1px solid #fecaca;
}

/* ==================== Product Detail ==================== */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #64748b;
    transition: color 0.2s;
}

.back-link:hover {
    color: #4f46e5;
}

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

.product-detail-info h1 {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.product-detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.product-detail-meta .price {
    font-size: 32px;
    font-weight: 800;
    color: #4f46e5;
}

.product-detail-meta .compatible {
    font-size: 13px;
    color: #64748b;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
}

.product-desc-section {
    margin-bottom: 24px;
}

.product-desc-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
}

.product-desc-section p {
    font-size: 14px;
    color: #64748b;
    line-height: 1.8;
}

/* ==================== Order Form ==================== */

.order-form {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 84px;
}

.order-form h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1a1a2e;
}

.order-form .btn-lg {
    width: 100%;
}

/* ==================== Order Success ==================== */

.order-success {
    max-width: 520px;
    margin: 40px auto;
    text-align: center;
}

.success-icon {
    font-size: 48px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2);
}

.order-info {
    text-align: left;
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.order-info p {
    font-size: 14px;
    margin-bottom: 8px;
}

.order-info p:last-child {
    margin-bottom: 0;
}

.payment-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 24px;
}

.payment-section h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.qrcode-placeholder {
    width: 200px;
    height: 200px;
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 16px auto;
}

.qrcode-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.qrcode-placeholder p {
    font-size: 13px;
    color: #64748b;
}

.payment-tips {
    text-align: left;
    font-size: 13px;
    color: #64748b;
    background: #fefce8;
    border-radius: 10px;
    padding: 14px 18px;
    border: 1px solid #fde68a;
}

.payment-tips p {
    margin-bottom: 4px;
}

/* ==================== Status Badges ==================== */

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending_payment {
    background: #ffeaa7;
    color: #856404;
}

.status-confirmed {
    background: #dfe6e9;
    color: #2d3436;
}

.status-processing {
    background: #74b9ff;
    color: #fff;
}

.status-delivered {
    background: #55efc4;
    color: #006644;
}

.status-failed {
    background: #ff7675;
    color: #fff;
}

.status-cancelled {
    background: #b2bec3;
    color: #fff;
}

/* ==================== My Orders ==================== */

.my-orders-search {
    max-width: 480px;
}

.search-row {
    display: flex;
    gap: 8px;
}

.search-row input {
    flex: 1;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==================== Order Card ==================== */

.order-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.order-no {
    font-weight: 600;
    font-size: 14px;
}

.order-card-body {
    font-size: 13px;
    color: #636e72;
}

.order-card-body p {
    margin-bottom: 4px;
}

.order-card-footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

/* ==================== Empty State ==================== */

.empty-state {
    text-align: center;
    padding: 40px;
    color: #b2bec3;
    font-size: 15px;
}

/* ==================== Card（通用）==================== */

.card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
    margin-bottom: 20px;
}

/* ==================== Admin Styles ==================== */

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 200px;
    background: #2d3436;
    color: #fff;
    padding: 20px 0;
    flex-shrink: 0;
}

.admin-sidebar h2 {
    font-size: 16px;
    padding: 0 16px;
    margin-bottom: 20px;
    color: #dfe6e9;
}

.admin-sidebar a {
    display: block;
    padding: 10px 16px;
    color: #b2bec3;
    font-size: 14px;
    transition: all 0.2s;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.admin-content {
    flex: 1;
    padding: 24px;
    background: #f5f6fa;
}

.admin-content h1 {
    font-size: 22px;
    margin-bottom: 20px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #2d3436;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #636e72;
    margin-top: 4px;
}

.stat-card.stat-warning .stat-value {
    color: #fdcb6e;
}

.stat-card.stat-info .stat-value {
    color: #74b9ff;
}

.stat-card.stat-success .stat-value {
    color: #55efc4;
}

.stat-card.stat-danger .stat-value {
    color: #ff7675;
}

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
}

.admin-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #636e72;
    font-size: 12px;
    text-transform: uppercase;
}

.admin-table tr:hover td {
    background: #f8f9fa;
}

.admin-table .actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 360px;
}

.login-card h1 {
    font-size: 20px;
    text-align: center;
    margin-bottom: 24px;
}

.login-error {
    background: #ffeaa7;
    color: #d63031;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
    text-align: center;
}

/* Admin Logs */
.logs-list {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.log-item {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    display: flex;
    gap: 12px;
}

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

.log-time {
    color: #b2bec3;
    white-space: nowrap;
    font-family: monospace;
    font-size: 12px;
}

.log-action {
    font-weight: 600;
    color: #636e72;
    min-width: 80px;
}

.log-msg {
    color: #2d3436;
    flex: 1;
}

/* Admin Detail */
.detail-section {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
}

.detail-section h3 {
    font-size: 15px;
    margin-bottom: 12px;
    color: #636e72;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
}

.detail-grid .full {
    grid-column: 1 / -1;
}

.detail-item {
    font-size: 13px;
}

.detail-item .label {
    color: #b2bec3;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item .value {
    color: #2d3436;
    font-weight: 500;
}

/* ==================== Responsive ==================== */

/* 手机端：导航菜单 */
@media (max-width: 640px) {
    .mobile-menu-btn {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        flex-direction: column;
        padding: 12px 20px;
        border-bottom: 1px solid #e2e8f0;
        gap: 4px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 10px 0;
        font-size: 15px;
    }

    .nav-links a::after {
        display: none;
    }

    .hero {
        padding: 40px 0 32px;
    }

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

    .subtitle {
        font-size: 15px;
    }

    .product-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .product-detail-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .order-form {
        position: static;
    }

    .product-detail-info h1 {
        font-size: 22px;
    }

    .product-detail-meta .price {
        font-size: 26px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-sidebar {
        width: 100%;
        padding: 12px 0;
        display: flex;
        overflow-x: auto;
    }

    .admin-sidebar h2 {
        display: none;
    }

    .admin-sidebar a {
        white-space: nowrap;
        padding: 8px 12px;
    }

    .admin-layout {
        flex-direction: column;
    }

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

    .admin-table {
        font-size: 12px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
    }

    .product-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
