/*
 * 貴金屬線上訂購系統
 * Aesthetic: Modern Minimal - Clean, functional, contemporary
 * Typography: Inter + System fonts
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Neutral Palette - Clean & Modern */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f4;
    --bg-inverse: #1a1a1a;

    --text-primary: #1a1a1a;
    --text-secondary: #5f6368;
    --text-tertiary: #9aa0a6;
    --text-inverse: #ffffff;

    --border-light: #e8eaed;
    --border-medium: #dadce0;

    /* Accent Colors - Subtle & Refined */
    --accent: #1a1a1a;
    --accent-soft: rgba(26, 26, 26, 0.08);
    --gold: #c9a962;
    --gold-soft: rgba(201, 169, 98, 0.12);
    --silver: #a8a8a8;
    --platinum: #b8b4af;

    /* Semantic */
    --success: #34a853;
    --success-soft: rgba(52, 168, 83, 0.1);
    --warning: #fbbc04;
    --danger: #ea4335;
    --danger-soft: rgba(234, 67, 53, 0.1);
    --info: #4285f4;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;

    /* Shadows - Minimal */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
}

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

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

body {
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* App Container */
.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* ==================== Header ==================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
}

.header h1 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.header-actions {
    margin-top: var(--space-2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

/* ==================== Navigation ==================== */
.nav-tabs {
    display: flex;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}

.nav-tab {
    flex: 1;
    padding: var(--space-3) var(--space-2);
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    position: relative;
    transition: color var(--duration-fast) var(--ease-out);
}

.nav-tab::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    transform: translateX(-50%);
    transition: width var(--duration-normal) var(--ease-out);
}

.nav-tab:hover {
    color: var(--text-secondary);
}

.nav-tab.active {
    color: var(--text-primary);
}

.nav-tab.active::after {
    width: 32px;
}

/* Cart Badge */
.cart-badge {
    position: relative;
}

.cart-count {
    position: absolute;
    top: 2px;
    right: calc(50% - 30px);
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: var(--text-inverse);
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0 5px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== Loading ==================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    color: var(--text-tertiary);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border-light);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--space-4);
}

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

.loading span {
    font-size: 0.8125rem;
    font-weight: 400;
}

/* ==================== Metal Price Banner ==================== */
.price-banner {
    background: var(--bg-secondary);
    padding: var(--space-4);
    margin: var(--space-4);
    border-radius: var(--radius-lg);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
}

.price-item {
    text-align: center;
    padding: var(--space-2);
}

.price-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-bottom: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.price-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.price-value.gold { color: var(--gold); }
.price-value.silver { color: var(--silver); }
.price-value.platinum { color: var(--platinum); }

/* Price Banner — locked state */
.price-banner-locked {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    transition: background var(--duration-fast);
}

.price-banner-locked:hover {
    background: var(--bg-tertiary);
}

.price-banner-lock-msg {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Price hidden state */
.price-hidden {
    color: var(--text-tertiary) !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
}

/* ==================== Product List ==================== */
.product-list {
    padding: var(--space-4);
    padding-bottom: 80px;
}

.category-section {
    margin-bottom: var(--space-6);
}

.category-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

/* ==================== Product Card ==================== */
.product-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.product-card:hover {
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
}

.product-card:active {
    transform: scale(0.99);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image.gold { background: linear-gradient(135deg, #faf6ed, #f5eed9); }
.product-image.silver { background: linear-gradient(135deg, #f5f5f5, #ebebeb); }
.product-image.platinum { background: linear-gradient(135deg, #f7f6f4, #edebe8); }

.product-placeholder {
    font-size: 2.5rem;
    opacity: 0.6;
}

.product-info {
    padding: var(--space-3);
}

.product-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-weight {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
}

.product-price {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.product-stock {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
}

.product-stock.out-of-stock {
    color: var(--danger);
}

/* Add to Cart Button */
.add-to-cart-btn {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    margin-top: var(--space-2);
    background: var(--bg-inverse);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-inverse);
    cursor: pointer;
    transition: opacity var(--duration-fast);
}

.add-to-cart-btn:hover {
    opacity: 0.85;
}

.add-to-cart-btn:active {
    opacity: 0.7;
}

.add-to-cart-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

/* ==================== Cart Page ==================== */
.cart-page {
    padding: var(--space-4);
    padding-bottom: 80px;
    min-height: 50vh;
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-4);
    padding-bottom: 80px;
    text-align: center;
}

.cart-empty-icon {
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.cart-empty p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.cart-empty p:last-child {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}

/* Cart Item */
.cart-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
}

.cart-item-image {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.cart-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-medium);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast), border-color var(--duration-fast);
}

.qty-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--text-tertiary);
}

.qty-btn:active {
    background: var(--bg-tertiary);
}

.qty-value {
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    font-size: 0.875rem;
}

.remove-btn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
    transition: color var(--duration-fast);
}

.remove-btn:hover {
    color: var(--danger);
}

/* Cart Summary */
.cart-summary {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-top: var(--space-4);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.summary-row small {
    font-size: 0.75rem;
    color: var(--success);
    margin-left: var(--space-1);
}

.summary-row.total {
    border-top: 1px solid var(--border-light);
    margin-top: var(--space-2);
    padding-top: var(--space-3);
    font-weight: 600;
    color: var(--text-primary);
}

.summary-row.total .amount {
    font-size: 1.125rem;
}

/* Checkout Button */
.checkout-btn {
    width: 100%;
    padding: var(--space-4);
    margin-top: var(--space-4);
    background: var(--bg-inverse);
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-inverse);
    cursor: pointer;
    transition: opacity var(--duration-fast);
}

.checkout-btn:hover {
    opacity: 0.9;
}

.checkout-btn:active {
    opacity: 0.8;
}

.checkout-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

/* ==================== Checkout Page ==================== */
.checkout-page {
    padding: var(--space-4);
    padding-bottom: 80px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: var(--space-4);
    transition: background var(--duration-fast);
}

.back-btn:hover {
    background: var(--bg-tertiary);
}

/* Form Sections */
.form-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
}

.form-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.form-group {
    margin-bottom: var(--space-4);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    color: var(--text-primary);
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.form-group select {
    cursor: pointer;
    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='%235f6368' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ==================== Order Success ==================== */
.order-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-12) var(--space-4);
    padding-bottom: 80px;
    min-height: 50vh;
}

.success-icon {
    margin-bottom: var(--space-4);
}

.success-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--success);
    margin-bottom: var(--space-2);
}

.order-number {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

/* ==================== Orders Page ==================== */
.orders-page {
    padding: var(--space-4);
    padding-bottom: 80px;
    min-height: 50vh;
}

.order-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    transition: border-color var(--duration-fast);
}

.order-card:hover {
    border-color: var(--border-medium);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

.order-number-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: monospace;
}

.order-status {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
}

.order-status.pending {
    background: var(--gold-soft);
    color: #8b7028;
}

.order-status.pending_payment {
    background: rgba(234, 134, 45, 0.1);
    color: #c67a1e;
}

.order-status.paid {
    background: rgba(66, 133, 244, 0.1);
    color: #4285f4;
}

.order-status.confirmed,
.order-status.processing {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.order-status.shipped {
    background: rgba(6, 182, 212, 0.1);
    color: #0891b2;
}

.order-status.ready_pickup {
    background: rgba(155, 81, 224, 0.1);
    color: #9b51e0;
}

.order-status.completed {
    background: var(--success-soft);
    color: var(--success);
}

.order-status.cancelled {
    background: var(--danger-soft);
    color: var(--danger);
}

.order-status.rejected {
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
}

.order-items-preview {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    line-height: 1.4;
}

.order-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.order-store-tag {
    color: var(--text-tertiary);
}

.order-total {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.order-date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: var(--space-2);
}

/* 門市選擇器 */
.store-picker {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.store-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--duration-fast), background var(--duration-fast);
}

.store-option:hover {
    border-color: var(--text-tertiary);
}

.store-option.selected {
    border-color: var(--gold);
    background: var(--gold-soft);
}

.store-option input[type="radio"] {
    accent-color: var(--gold);
    margin: 0;
}

.store-option-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.store-option-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.store-option-address {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    bottom: 72px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-inverse);
    color: var(--text-inverse);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    z-index: 1001;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    animation: toast-in 0.3s var(--ease-out);
    margin-bottom: env(safe-area-inset-bottom);
}

.toast-icon {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--success);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ==================== Category Filter Tabs ==================== */
.product-list .nav-tabs {
    position: static;
    transform: none;
    left: auto;
    bottom: auto;
    width: auto;
    max-width: none;
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: var(--space-4);
    gap: var(--space-2);
    flex-wrap: wrap;
    justify-content: flex-start;
    box-shadow: none;
}

.product-list .nav-tab {
    flex: none;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
}

.product-list .nav-tab::after {
    display: none;
}

.product-list .nav-tab.active {
    background: var(--bg-inverse);
    color: var(--text-inverse);
}

.product-list .nav-tab:hover:not(.active) {
    background: var(--bg-tertiary);
}

/* ==================== Responsive ==================== */
@media (max-width: 360px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .price-banner {
        padding: var(--space-3);
    }

    .price-value {
        font-size: 0.9375rem;
    }
}

@media (min-width: 481px) {
    body {
        background: var(--bg-tertiary);
    }

    .app {
        margin-top: var(--space-6);
        margin-bottom: var(--space-6);
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-lg);
        min-height: calc(100vh - var(--space-12));
        overflow: hidden;
    }
}

/* ==================== Product Detail Modal ==================== */
.product-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
}

.product-modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    transform: translateY(60px);
    -webkit-overflow-scrolling: touch;
}

.product-modal-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.product-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-modal-image .modal-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.product-modal-image.gold { background: linear-gradient(135deg, #faf6ed, #f5eed9); }
.product-modal-image.silver { background: linear-gradient(135deg, #f5f5f5, #ebebeb); }
.product-modal-image.platinum { background: linear-gradient(135deg, #f7f6f4, #edebe8); }

.product-modal-close {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast);
    z-index: 1;
}

.product-modal-close:hover {
    background: rgba(0, 0, 0, 0.6);
}

.product-modal-body {
    padding: var(--space-5);
}

.product-modal-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    line-height: 1.4;
}

.product-modal-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-5);
}

.product-modal-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.product-modal-spec {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.product-modal-spec-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-1);
}

.product-modal-spec-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.product-modal-footer {
    padding: 0 var(--space-5) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.product-modal-price-block {
    flex: 1;
}

.product-modal-price {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
}

.product-modal-stock {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

.product-modal-stock.out-of-stock {
    color: var(--danger);
}

.product-modal-cart-btn {
    padding: var(--space-3) var(--space-6);
    background: var(--bg-inverse);
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-inverse);
    cursor: pointer;
    transition: opacity var(--duration-fast);
    white-space: nowrap;
}

.product-modal-cart-btn:hover {
    opacity: 0.85;
}

.product-modal-cart-btn:active {
    opacity: 0.7;
}

.product-modal-cart-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

/* Card clickable hint */
.product-card-clickable {
    cursor: pointer;
}

/* ==================== Animations ==================== */
@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card,
.cart-item,
.order-card {
    animation: fade-up 0.4s var(--ease-out) backwards;
}

.product-card:nth-child(1) { animation-delay: 0.02s; }
.product-card:nth-child(2) { animation-delay: 0.04s; }
.product-card:nth-child(3) { animation-delay: 0.06s; }
.product-card:nth-child(4) { animation-delay: 0.08s; }

.cart-item:nth-child(1) { animation-delay: 0.02s; }
.cart-item:nth-child(2) { animation-delay: 0.04s; }
.cart-item:nth-child(3) { animation-delay: 0.06s; }

.order-card:nth-child(1) { animation-delay: 0.02s; }
.order-card:nth-child(2) { animation-delay: 0.04s; }
.order-card:nth-child(3) { animation-delay: 0.06s; }

/* ==================== Profile Page ==================== */
.profile-page {
    padding: var(--space-4);
    padding-bottom: 80px;
    min-height: 50vh;
}

/* 鐵灰色金屬髮絲紋路卡片 */
.profile-card {
    background:
        repeating-linear-gradient(90deg,
            transparent, transparent 1px,
            rgba(255,255,255,0.03) 1px, rgba(255,255,255,0.03) 2px),
        linear-gradient(105deg,
            #3a3d42, #4a4e54 15%, #5c6168 30%,
            #6b7078 45%, #5c6168 55%, #4a4e54 70%, #3a3d42 85%, #2f3338);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2), 0 8px 32px rgba(0,0,0,0.15),
                inset 0 1px 0 rgba(255,255,255,0.1);
    color: #fff;
}

.profile-card-content {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.profile-avatar-placeholder {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    flex-shrink: 0;
}

.profile-card-info {
    min-width: 0;
    flex: 1;
}

.profile-card-edit-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--duration-fast);
}

.profile-card-edit-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.profile-card-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-card-company {
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: var(--space-2);
}

/* Role Badges */
.profile-role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.profile-role-badge.customer {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
}

.profile-role-badge.jeweler {
    background: rgba(201,169,98,0.25);
    color: #e8d5a3;
}

.profile-role-badge.admin {
    background: rgba(66,133,244,0.25);
    color: #93bbf7;
}

/* Profile Section */
.profile-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.profile-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.profile-section-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-edit-btn {
    padding: var(--space-1) var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--duration-fast), border-color var(--duration-fast);
}

.profile-edit-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
}

.profile-edit-actions {
    display: flex;
    gap: var(--space-2);
}

.profile-cancel-btn {
    padding: var(--space-1) var(--space-3);
    background: none;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: background var(--duration-fast);
}

.profile-cancel-btn:hover {
    background: var(--bg-secondary);
}

.profile-save-btn {
    padding: var(--space-1) var(--space-3);
    background: var(--bg-inverse);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-inverse);
    cursor: pointer;
    transition: opacity var(--duration-fast);
}

.profile-save-btn:hover {
    opacity: 0.85;
}

.profile-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Profile Info List */
.profile-info-list {
    display: flex;
    flex-direction: column;
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-light);
}

.profile-info-row:last-child {
    border-bottom: none;
}

.profile-info-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-tertiary);
    flex-shrink: 0;
    min-width: 72px;
}

.profile-info-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
}

/* Profile Edit Modal */
.profile-modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    transform: translateY(60px);
    -webkit-overflow-scrolling: touch;
}

.profile-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-5) var(--space-5) var(--space-3);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 1;
}

.profile-modal-header h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-modal-body {
    padding: 0 var(--space-5) var(--space-4);
}

.profile-modal-body .form-group {
    margin-bottom: var(--space-3);
}

.profile-modal-body .form-group:last-child {
    margin-bottom: 0;
}

.profile-modal-footer {
    padding: var(--space-3) var(--space-5) var(--space-6);
    display: flex;
    gap: var(--space-3);
    position: sticky;
    bottom: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
}

.profile-modal-footer .profile-cancel-btn {
    flex: 1;
    padding: var(--space-3);
    text-align: center;
}

.profile-modal-footer .profile-save-btn {
    flex: 2;
    padding: var(--space-3);
    text-align: center;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

/* Logout Button */
.profile-logout-btn {
    width: 100%;
    padding: var(--space-3);
    background: none;
    border: 1px solid var(--danger);
    border-radius: var(--radius-lg);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--danger);
    cursor: pointer;
    margin-bottom: var(--space-4);
    transition: background var(--duration-fast), color var(--duration-fast);
}

.profile-logout-btn:hover {
    background: var(--danger-soft);
}

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

/* Login Button (used in profile page) */
.login-btn {
    padding: var(--space-3) var(--space-6);
    background: #06c755;
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: opacity var(--duration-fast);
}

.login-btn:hover {
    opacity: 0.9;
}

.login-btn:active {
    opacity: 0.8;
}

/* Order Item Detail Rows */
.order-items-detail {
    margin-bottom: var(--space-2);
}

.order-item-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.order-item-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-item-qty {
    color: var(--text-tertiary);
    font-weight: 500;
    flex-shrink: 0;
}

.order-item-price {
    font-weight: 500;
    color: var(--text-primary);
    flex-shrink: 0;
}

/* Order Footer with Cancel */
.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-2);
}

.order-confirm-btn {
    padding: var(--space-1) var(--space-3);
    background: none;
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--success);
    cursor: pointer;
    transition: background var(--duration-fast), color var(--duration-fast);
}

.order-confirm-btn:hover {
    background: var(--success-soft);
}

.order-confirm-btn:active {
    background: var(--success);
    color: #fff;
}

.order-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.order-cancel-btn {
    padding: var(--space-1) var(--space-3);
    background: none;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--danger);
    cursor: pointer;
    transition: background var(--duration-fast), color var(--duration-fast);
}

.order-cancel-btn:hover {
    background: var(--danger-soft);
}

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

.order-cancel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
