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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a1a !important;
    color: #ffffff !important;
    padding: 0;
    margin: 0;
}

.app-container {
    max-width: 100vw;
    margin: 0 auto;
    background: #1a1a1a !important;
    min-height: 100vh;
}

/* 頭部樣式 */
.header {
    background: #2d2d2d !important;
    color: #ffffff !important;
    padding: 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #444;
}

.user-info {
    font-size: 0.9rem;
    opacity: 0.8;
    color: #cccccc !important;
}

/* 導航樣式 */
.navigation {
    display: flex;
    background: #2d2d2d !important;
    border-bottom: 1px solid #444;
    position: sticky;
    top: 60px;
    z-index: 99;
}

.nav-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: #2d2d2d !important;
    color: #ffffff !important;
    cursor: pointer;
    font-size: 1rem;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-btn.active {
    color: #64b5f6 !important;
    border-bottom-color: #64b5f6;
    background: #333333 !important;
}

.nav-btn:hover {
    background: #383838 !important;
}

/* 內容區域 */
.tab-content {
    display: none;
    padding: 1rem;
    background: #1a1a1a !important;
}

.tab-content.active {
    display: block;
}

/* 商品網格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* 商品卡片 */
.product-card {
    background: #2d2d2d !important;
    color: #ffffff !important;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
    border: 1px solid #444;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(100, 181, 246, 0.3);
    border-color: #64b5f6;
}

.product-card.adding {
    animation: addToCartPulse 0.6s ease-out;
}

@keyframes addToCartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 8px 20px rgba(100, 181, 246, 0.4); }
    100% { transform: scale(1); }
}

.product-image {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
}

.product-name {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #ffffff !important;
}

.product-description {
    color: #cccccc !important;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.product-rating {
    margin-bottom: 0.5rem;
    color: #ffcc02 !important;
}

.product-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: #64b5f6 !important;
    margin-bottom: 1rem;
}

.add-to-cart-btn {
    width: 100%;
    padding: 0.75rem;
    background: #64b5f6 !important;
    color: #000000 !important;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.add-to-cart-btn:hover {
    background: #42a5f5 !important;
    transform: translateY(-1px);
}

.add-to-cart-btn:active {
    transform: translateY(0);
}

.add-to-cart-btn.added {
    background: #4caf50 !important;
    animation: addedTick 0.8s ease-out;
}

@keyframes addedTick {
    0% { background: #64b5f6; }
    50% { background: #4caf50; transform: scale(0.95); }
    100% { background: #64b5f6; transform: scale(1); }
}

/* 購物車項目 */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d2d2d !important;
    color: #ffffff !important;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: transform 0.2s;
    border: 1px solid #444;
}

.cart-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(100, 181, 246, 0.2);
    border-color: #64b5f6;
}

.cart-item-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.cart-item-image {
    font-size: 2rem;
    margin-right: 1rem;
}

.cart-item-details {
    flex: 1;
}

.cart-item-name {
    font-weight: bold;
    margin-bottom: 0.25rem;
    color: #ffffff !important;
}

.cart-item-price {
    color: #64b5f6 !important;
    font-weight: bold;
}

.cart-item-quantity {
    font-size: 0.9rem;
    color: #cccccc !important;
    margin-top: 0.25rem;
}

/* 數量控制 */
.quantity-controls {
    display: flex;
    align-items: center;
    background: #444444 !important;
    border-radius: 20px;
    padding: 0.25rem;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #555555 !important;
    color: #ffffff !important;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.quantity-btn:hover {
    background: #64b5f6 !important;
    color: #000000 !important;
    transform: scale(1.1);
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-display {
    margin: 0 0.75rem;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    color: #ffffff !important;
}

/* 空購物車 */
.empty-cart {
    text-align: center;
    padding: 3rem 2rem;
    color: #cccccc !important;
    font-size: 1.1rem;
}

.empty-cart-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 載入狀態 */
.loading {
    text-align: center;
    padding: 3rem 2rem;
    color: #cccccc !important;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #444444;
    border-top: 4px solid #64b5f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 錯誤狀態 */
.error {
    text-align: center;
    padding: 2rem;
    color: #f44336 !important;
}

/* 購物車徽章 */
.cart-badge {
    background: #f44336 !important;
    color: #ffffff !important;
    border-radius: 50%;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    animation: cartBounce 0.5s ease-out;
}

@keyframes cartBounce {
    0% { transform: scale(0.3); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* 表單樣式 */
.shipping-form, .payment-form {
    background: #2d2d2d !important;
    color: #ffffff !important;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 1px solid #444;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #ffffff !important;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #555555;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: #383838 !important;
    color: #ffffff !important;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #64b5f6;
    background: #444444 !important;
}

.form-input.valid {
    border-color: #4caf50;
}

.form-input.invalid {
    border-color: #f44336;
}

.form-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.form-input::placeholder {
    color: #999999 !important;
}

/* 選項樣式 */
.delivery-options, .payment-options {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.delivery-option, .payment-option {
    background: #383838 !important;
    color: #ffffff !important;
    border: 2px solid #555555;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.delivery-option:hover, .payment-option:hover {
    background: #444444 !important;
    border-color: #64b5f6;
}

.delivery-option.selected, .payment-option.selected {
    border-color: #64b5f6;
    background: #1e3a5f !important;
}

.delivery-option-title, .payment-option-title {
    font-weight: bold;
    margin-bottom: 0.25rem;
    color: #ffffff !important;
}

.delivery-option-desc, .payment-option-desc {
    font-size: 0.9rem;
    color: #cccccc !important;
}

.delivery-fee {
    font-size: 0.9rem;
    color: #4caf50 !important;
    font-weight: bold;
    margin-top: 0.25rem;
}

/* YedPay 付款選項樣式 */
.yedpay-gateway-option {
    background: #383838 !important;
    color: #ffffff !important;
    border: 2px solid #555555;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 0.5rem;
}

.yedpay-gateway-option:hover {
    background: #444444 !important;
    border-color: #64b5f6;
}

.yedpay-gateway-option.selected {
    border-color: #64b5f6;
    background: #1e3a5f !important;
}

.yedpay-gateway-title {
    font-weight: bold;
    margin-bottom: 0.25rem;
    color: #ffffff !important;
    display: flex;
    align-items: center;
}

.yedpay-gateway-icon {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

.yedpay-gateway-desc {
    font-size: 0.9rem;
    color: #cccccc !important;
}

.yedpay-note {
    background: #1a2f1a !important;
    border: 1px solid #4caf50;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #90ee90 !important;
}

/* 運費說明 */
.shipping-note {
    background: #2a2a00 !important;
    border: 1px solid #444400;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.shipping-note-title {
    font-weight: bold;
    color: #ffeb3b !important;
    margin-bottom: 0.5rem;
}

.shipping-note-text {
    font-size: 0.9rem;
    color: #ffeb3b !important;
    line-height: 1.5;
}

/* 購物車總計 */
.cart-summary {
    background: #2d2d2d !important;
    color: #ffffff !important;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 1rem;
    border: 1px solid #444;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    color: #ffffff !important;
}

.summary-total {
    border-top: 1px solid #555;
    padding-top: 0.5rem;
    font-weight: bold;
    font-size: 1.1rem;
    color: #ffffff !important;
}

/* 收貨點信息 */
.pickup-point-info {
    background: #1a3a4a !important;
    border: 1px solid #336699;
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #87ceeb !important;
}

/* 除錯信息 */
.debug-info {
    background: #2a2a2a !important;
    border: 1px solid #555555;
    border-radius: 4px;
    padding: 0.75rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #cccccc !important;
}

/* 結帳按鈕 */
.checkout-btn {
    width: 100%;
    padding: 1rem;
    background: #4caf50 !important;
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s;
}

.checkout-btn:hover {
    background: #45a049 !important;
    transform: translateY(-1px);
}

.checkout-btn:disabled {
    background: #666666 !important;
    cursor: not-allowed;
    transform: none;
}

/* 成功訊息 */
.success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #4caf50 !important;
    color: #ffffff !important;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: bold;
    z-index: 1000;
    animation: successSlide 0.5s ease-out;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

@keyframes successSlide {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* 淡入動畫 */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* API 狀態 */
.api-status {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #2d2d2d;
    border-radius: 4px;
    border: 1px solid #444;
}

.api-status.real {
    color: #4caf50 !important;
    border-color: #4caf50;
}

.api-status.mock {
    color: #ff9800 !important;
    border-color: #ff9800;
}

/* Stripe Elements 樣式 */
.stripe-element {
    background: #383838 !important;
    border: 2px solid #555555;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    transition: border-color 0.3s;
}

.stripe-element:focus {
    border-color: #64b5f6;
}

.stripe-element.invalid {
    border-color: #f44336;
}

/* 付款相關樣式 */
.payment-error {
    color: #f44336 !important;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #2d1b1b;
    border-radius: 4px;
    border: 1px solid #f44336;
}

.payment-processing {
    text-align: center;
    padding: 2rem;
    color: #64b5f6 !important;
}

.payment-success {
    text-align: center;
    padding: 2rem;
    color: #4caf50 !important;
}

.payment-redirect-note {
    background: #1a2332 !important;
    border: 1px solid #3366cc;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #87ceeb !important;
}

/* 覆蓋 Telegram 變數 */
:root {
    --tg-theme-bg-color: #1a1a1a !important;
    --tg-theme-text-color: #ffffff !important;
    --tg-theme-button-color: #64b5f6 !important;
    --tg-theme-button-text-color: #000000 !important;
    --tg-theme-secondary-bg-color: #2d2d2d !important;
}