*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --glass-bg: rgba(255, 255, 255, 0.65); 
    --glass-border: rgba(255, 255, 255, 0.7);
    --glass-blur: blur(20px) saturate(160%); 
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.03), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    --bg-base: #f9f9fb; 
    --accent: #007aff; 
    --accent-soft: rgba(0, 122, 255, 0.08);
    --text: #1d1d1f; 
    --text-dim: rgba(0, 0, 0, 0.55); 
    --success: #34c759; 
    --danger: #ff3b30;
    --ease-spring: cubic-bezier(0.25, 0.8, 0.25, 1);
}

html, body { 
    width: 100%; min-height: 100%; 
    background: var(--bg-base); 
    background-image: radial-gradient(circle at 10% 30%, rgba(0, 122, 255, 0.03), transparent 30%), 
                     radial-gradient(circle at 90% 70%, rgba(255, 45, 85, 0.02), transparent 30%);
    background-attachment: fixed; color: var(--text); 
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif; 
    -webkit-font-smoothing: antialiased; overflow-x: hidden;
}

.glass-panel { background: var(--glass-bg); border: 1px solid var(--glass-border); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border-radius: 24px; box-shadow: var(--glass-shadow); }

header { 
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 100; 
    margin: 0 auto; padding: 10px 24px; width: calc(100% - 48px); max-width: 1200px;
    display: flex; align-items: center; justify-content: space-between; 
    background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-radius: 100px; border: 1px solid rgba(255, 255, 255, 0.6); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
}
.brand-logo { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.3px; color: var(--text); text-decoration: none; }
.nav-right { display: flex; gap: 12px; align-items: center; }
.icon-btn { 
    position: relative; width: 40px; height: 40px; border-radius: 50%; 
    border: 1px solid rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.8); color: var(--text); font-size: 1rem; 
    cursor: pointer; display: flex; align-items: center; justify-content: center; text-decoration: none; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.icon-btn:hover { transform: translateY(-2px); background: #ffffff; border-color: #ffffff; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06); }
.cart-badge { position: absolute; top: -2px; right: -2px; background: var(--text); color: #fff; font-size: 0.65rem; font-weight: 600; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1.5px solid #fff; }

main { max-width: 1200px; margin: 0 auto; padding: 140px 24px 80px; }
.breadcrumb { margin-bottom: 28px; font-size: 0.9rem; color: var(--text-dim); font-weight: 500; }
.breadcrumb a { color: var(--text); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { color: var(--accent); }

.product-container { display: grid; grid-template-columns: 1fr; gap: 48px; }
@media(min-width: 768px) { .product-container { grid-template-columns: 1.1fr 0.9fr; } }

.product-image-box { aspect-ratio: 16/11; border-radius: 24px; overflow: hidden; background: rgba(0,0,0,0.02); position: relative; border: 1px solid var(--glass-border); }
.product-image-box img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.3s ease; }
.delivery-badge { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,0.92); backdrop-filter: blur(8px); padding: 5px 12px; border-radius: 10px; font-weight: 700; font-size: 0.75rem; color: var(--danger); box-shadow: 0 4px 12px rgba(0,0,0,0.04); display: flex; align-items: center; gap: 4px; }

.product-details { display: flex; flex-direction: column; min-width: 0; }
.cat-tag { display: inline-block; padding: 6px 14px; background: var(--accent-soft); border: 1px solid rgba(0, 122, 255, 0.1); border-radius: 100px; font-size: 0.8rem; font-weight: 700; color: var(--accent); margin-bottom: 18px; width: fit-content; }
.product-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.25; margin-bottom: 16px; overflow-wrap: break-word; word-break: break-word; }

.price-wrap { display: flex; align-items: baseline; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.price-current { font-size: 1.85rem; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; }
.price-old { font-size: 1.1rem; color: rgba(0, 0, 0, 0.35); text-decoration: line-through; }

.product-desc { font-size: 0.95rem; color: var(--text-dim); line-height: 1.6; margin-bottom: 30px; overflow-wrap: break-word; }

.stock-info { font-weight: 700; font-size: 0.9rem; margin-bottom: 28px; display: flex; align-items: center; gap: 8px; }

.buy-controls { display: flex; gap: 16px; align-items: center; }

.qty-input { display: flex; align-items: center; justify-content: space-between; background: rgba(0,0,0,0.04); border-radius: 100px; padding: 4px; width: 130px; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.01); }
.qty-btn { border: none; background: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-weight: 800; font-size: 1.1rem; transition: 0.2s; display: flex; align-items: center; justify-content: center; color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,0.05); flex-shrink: 0; }
.qty-btn:hover:not(:disabled) { background: var(--text); color: #fff; }
.qty-btn:active:not(:disabled) { transform: scale(0.9); }
.qty-val { width: 36px; text-align: center; font-weight: 700; font-size: 1rem; color: var(--text); flex-shrink: 0; }

.btn-add-cart { flex: 1; padding: 16px; border: none; border-radius: 16px; background: var(--text); color: #fff; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.4s var(--ease-spring); }
.btn-add-cart:hover:not(:disabled) { background: #000; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.btn-add-cart:disabled { background: rgba(0,0,0,0.1); color: rgba(0,0,0,0.25); cursor: not-allowed; }

/* BỐ CỤC LƯỚI CHO LỰA CHỌN PHIÊN BẢN (NGAY NGẮN HƠN) */
.variants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    max-height: 220px; /* Thêm thanh cuộn nếu có quá nhiều lựa chọn */
    overflow-y: auto;
    padding-right: 6px; /* Cách ra một chút cho thanh cuộn */
}
/* Tuỳ biến thanh cuộn cho khu vực variants */
.variants-grid::-webkit-scrollbar { width: 6px; }
.variants-grid::-webkit-scrollbar-track { background: transparent; }
.variants-grid::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 10px; }

.variant-chip {
    padding: 10px 14px; 
    border: 1px solid rgba(0,0,0,0.06); 
    background: rgba(255,255,255,0.7); 
    border-radius: 12px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 0.9rem; 
    transition: all 0.2s;
    color: var(--text-dim);
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Cắt chữ nếu tên phiên bản quá dài */
}
.variant-chip:hover {
    background: #fff;
    color: var(--text);
    border-color: rgba(0,0,0,0.15);
}
.variant-chip.active { 
    border-color: var(--text) !important; 
    background: var(--text) !important; 
    color: #fff !important; 
}

.glass-toast {
    position: fixed; top: -70px; left: 50%; transform: translateX(-50%); z-index: 9999;
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.6); box-shadow: 0 10px 40px rgba(0,0,0,0.06);
    padding: 14px 28px; border-radius: 100px; display: flex; align-items: center; gap: 10px;
    font-size: 0.9rem; font-weight: 600; color: var(--text); opacity: 0; transition: all 0.4s var(--ease-spring);
}
.glass-toast.show { top: 24px; opacity: 1; }
.toast-success .toast-icon i { color: var(--success); }
.toast-error .toast-icon i { color: var(--danger); }

.format-link { color: var(--accent); text-decoration: underline; font-weight: 600; word-break: break-all; }
.format-paren { display: inline-block; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 6px; margin: 0 2px; }
.format-star { font-weight: 800; color: var(--text); }
.format-list { display: list-item; list-style-type: disc; margin-left: 20px; font-style: italic; margin-bottom: 6px; }
.format-quote { border-left: 3px solid var(--success); padding-left: 12px; margin: 8px 0; background: rgba(52, 199, 89, 0.1); padding: 8px 12px; border-radius: 6px; font-style: italic; display: block; }
.format-alert { display: block; color: var(--danger); font-weight: bold; background: rgba(255, 59, 48, 0.1); padding: 6px 12px; border-radius: 6px; margin: 4px 0; }

@media (max-width: 480px) {
    header { width: calc(100% - 24px); top: 16px; padding: 10px 20px; }
    main { padding: 110px 16px 60px; }
    .product-title { font-size: 1.65rem; }
    .price-current { font-size: 1.65rem; }
    .buy-controls { flex-direction: column; align-items: stretch; gap: 14px; }
    
    .qty-input { width: 130px; align-self: flex-start; } 
    .qty-btn { width: 36px; height: 36px; }
    .btn-add-cart { width: 100%; padding: 15px; border-radius: 14px; }
    .variants-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}