/* 页面最大宽度和内边距 */
.container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 24px;
}

/* 顶部 Header 布局 */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

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

/* Section 外边距 */
section {
    margin-top: 28px;
}

/* Section 标题区布局 */
.section-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 12px;
}

/* 商品网格布局 */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

/* 主体区域 */
main {
    display: block;
}

/* 响应式处理 */
@media (max-width: 640px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    nav a {
        margin-left: 0;
        margin-right: 18px;
    }

    .banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .banner .art {
        width: 100%;
        height: 140px;
    }
}

/* Banner 作为布局时的 flex 设置 */
.banner {
    display: flex;
    gap: 24px;
    align-items: center;
}

/* =============== Auth page layout =============== */

.auth-page {
    min-height: calc(100vh - 160px); /* 减去 header + footer 大概高度 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 820px;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 32px;
    background: #ffffff;
    border-radius: 14px;
    padding: 28px 28px 26px 28px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.auth-copy h1 {
    margin: 0;
    font-size: 24px;
}

.auth-actions {
    margin-top: 14px;
}

/* 右侧缩小一点，让左侧文案更放松 */
.auth-copy {
    border-right: 1px solid #f3f4f6;
    padding-right: 18px;
}

/* 小屏幕下上下堆叠 */
@media (max-width: 768px) {
    .auth-card {
        grid-template-columns: 1fr;
        padding: 20px 18px 18px 18px;
    }

    .auth-copy {
        border-right: 0;
        border-bottom: 1px solid #f3f4f6;
        padding-right: 0;
        padding-bottom: 14px;
        margin-bottom: 10px;
    }

    .auth-page {
        min-height: calc(100vh - 140px);
    }
}

/* =============== Product pages =============== */

.product-page {
    margin-top: 24px;
}

.product-detail {
    margin-top: 24px;
}

.product-detail-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 32px;
}

.product-images {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-info h1 {
    margin: 0 0 4px 0;
    font-size: 24px;
}

.product-price {
    margin: 4px 0 12px 0;
    font-size: 18px;
    color: var(--accent);
    font-weight: 700;
}

.product-desc {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
}

.product-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

/* =============== Cart page layout =============== */

.cart-page {
    margin-top: 24px;
}

.cart-page h1 {
    margin: 0 0 18px 0;
    font-size: 24px;
}

.cart-empty-text {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 16px;
}

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 0.9fr);
    gap: 24px;
    align-items: flex-start;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 120px;
    gap: 16px;
    padding: 12px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.04);
    align-items: center;
}

.cart-item-thumb .thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

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

.cart-item-name {
    margin: 0;
    font-size: 16px;
}

.cart-item-price {
    font-weight: 700;
    color: var(--accent);
}

.cart-item-meta {
    margin: 4px 0 8px 0;
    font-size: 12px;
    color: var(--muted);
}

.cart-item-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cart-update-form {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
}

.cart-update-form input[type="number"] {
    width: 64px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 13px;
}

.cart-item-subtotal {
    text-align: right;
    font-size: 13px;
}

.cart-item-subtotal span {
    display: block;
    color: var(--muted);
    margin-bottom: 4px;
}

.cart-item-subtotal strong {
    font-size: 15px;
}

/* 右侧汇总卡片 */
.cart-summary {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    font-size: 14px;
}

.cart-summary h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
}

.cart-summary-total {
    margin-top: 8px;
    font-weight: 700;
}

.btn-checkout {
    width: 100%;
    margin-top: 14px;
    padding: 10px 14px;
}

.cart-summary-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
}

.cart-continue {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
}

.cart-continue:hover {
    text-decoration: underline;
}

/* 小按钮尺寸 */
.btn-small {
    padding: 6px 10px;
    font-size: 12px;
}

/* 手机端布局调整 */
@media (max-width: 768px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .cart-item {
        grid-template-columns: 64px minmax(0, 1fr);
        grid-template-rows: auto auto;
    }

    .cart-item-subtotal {
        grid-column: 1 / -1;
        text-align: right;
    }
}

@media (max-width: 600px) {
    .add-to-cart-form {
        width: 100%;
        justify-content: space-between;
    }

    .btn-add {
        flex: 1;
        text-align: center;
    }
}

/* =============== Checkout / Shipping pages =============== */

.checkout-page {
    margin-top: 24px;
}

.checkout-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 0.9fr);
    gap: 24px;
    align-items: flex-start;
}

.checkout-main-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.05);
}

.checkout-main-card h1 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 22px;
}

.checkout-subtitle {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--muted);
}

.checkout-section-title {
    margin-top: 18px;
    margin-bottom: 8px;
    font-size: 15px;
}

/* 右侧金额卡片复用 cart summary 的风格 */
.checkout-summary-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    font-size: 14px;
}

.checkout-summary-total {
    margin-top: 8px;
    font-weight: 700;
}

/* shipping options */
.shipping-form .form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.shipping-form input[type="text"] {
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

.shipping-form input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.3);
}

.shipping-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shipping-option {
    display: block;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 8px 10px;
    cursor: pointer;
}

.shipping-option input[type="radio"] {
    margin-right: 10px;
}

.shipping-option-body {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
}

.shipping-name {
    font-weight: 600;
}

.shipping-desc {
    font-size: 12px;
    color: var(--muted);
}

.shipping-price {
    font-weight: 600;
}

/* checkout items 列表 */
.checkout-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkout-item-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.checkout-item-name {
    font-weight: 600;
}

.checkout-item-meta {
    font-size: 12px;
    color: var(--muted);
}

/* 响应式 */
@media (max-width: 768px) {
    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .shipping-form .form-row {
        grid-template-columns: 1fr;
    }
}

/* =============== Order List Page =============== */

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

.orders-page h1 {
    margin: 0 0 18px 0;
    font-size: 24px;
}

.orders-empty {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 16px;
}

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

.order-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 12px 30px rgba(17, 24, 39, 0.05);
}

.order-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.order-id {
    font-weight: 700;
    font-size: 15px;
}

.order-date {
    font-size: 13px;
    color: var(--muted);
}

.order-body {
    border-top: 1px solid #f3f4f6;
    padding-top: 10px;
}

.order-line {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.order-footer {
    margin-top: 10px;
    text-align: right;
}

/* =============== BADGES (status) =============== */

.badge {
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

/* pending（建议换成黄/橙色更显眼）*/
.badge-pending {
    background: #ca8a04;   /* amber-600 */
}

/* processing */
.badge-processing {
    background: #2563eb;   /* blue-600 */
}

/* complete */
.badge-complete {
    background: #16a34a;   /* green-600 */
}

/* canceled */
.badge-canceled {
    background: #b91c1c;   /* red-700 */
}

/* grey badge (optional) */
.badge-light {
    background: #e5e7eb;
    color: #374151;
}


/* Small button */
.btn-small {
    padding: 6px 10px;
    font-size: 12px;
}

/* ===================== Profile Page ===================== */

.profile-page {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.profile-card {
    width: 100%;
    max-width: 640px;
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.05);
}

.profile-card h1 {
    margin: 0 0 10px 0;
    font-size: 24px;
}

.profile-subtitle {
    margin: 0 0 20px 0;
    color: var(--muted);
    font-size: 14px;
}

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

.profile-form label {
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.profile-form input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

.profile-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(255,107,107,0.3);
}

.profile-value {
    padding: 8px 4px;
    font-size: 14px;
}

.form-actions {
    margin-top: 18px;
    display: flex;
    gap: 12px;
}

/* =============== Admin pages =============== */

.admin-page {
    margin-top: 24px;
}

.admin-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 22px;
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.05);
}

.admin-card h1 {
    margin: 0 0 8px 0;
    font-size: 22px;
}

.admin-subtitle {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--muted);
}

.admin-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* 通用表格样式 */
.table-wrapper {
    margin-top: 10px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.data-table th {
    font-size: 13px;
    text-transform: uppercase;
    color: #6b7280;
}

/* badge 针对角色 */
.badge-admin {
    background: #1d4ed8;
    color: #ffffff;
}

.badge-customer {
    background: #047857;
    color: #ffffff;
}

/* profile / detail form 复用 */
.profile-form .form-group {
    margin-bottom: 16px;
}

.profile-form .form-label {
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.profile-form input {
    width: 100%;
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

.profile-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.3);
}

.profile-value {
    padding: 6px 4px;
    font-size: 14px;
}

.form-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 订单筛选条 */
.order-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 8px 0 14px 0;
    flex-wrap: wrap;
}

.order-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-pill {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    font-size: 12px;
    text-decoration: none;
    color: #4b5563;
    background: #ffffff;
}

.filter-pill:hover {
    background: #f3f4f6;
}

.filter-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

/* 搜索框 */
.order-search {
    display: flex;
    align-items: center;
    gap: 6px;
}

.order-search input[type="text"] {
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    font-size: 13px;
    min-width: 180px;
}

.order-search button {
    padding: 6px 10px;
    border-radius: 999px;
    border: none;
    font-size: 12px;
    background: #111827;
    color: #ffffff;
    cursor: pointer;
}

.order-search button:hover {
    background: #374151;
}

/* 列表右侧操作按钮 */
.order-actions {
    display: inline-flex;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
}

.inline-form {
    display: inline;
}

.btn-ghost {
    border: none;
    background: transparent;
    padding: 4px 6px;
    font-size: 11px;
    cursor: pointer;
    color: #4b5563;
}

.btn-ghost:hover {
    text-decoration: underline;
}
