:root {
    --primary-color: #fe2c55; /* TikTok brand color */
    --primary-light: #ffebef;
    --text-main: #161823;
    --text-secondary: rgba(22, 24, 35, 0.75);
    --text-muted: rgba(22, 24, 35, 0.5);
    --bg-main: #f8f8f8;
    --bg-white: #ffffff;
    --border-color: rgba(22, 24, 35, 0.12);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: #e5e5e5;
    color: var(--text-main);
    line-height: 1.5;
}

.text-primary { color: var(--primary-color); }
.text-gray { color: var(--text-muted); }

/* Mobile Container */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    background-color: var(--bg-main);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    overflow-x: hidden;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: transparent;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.app-header .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.4);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--primary-color);
    color: white;
    font-size: 10px;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: transform 0.2s;
}
.cart-badge.show {
    transform: scale(1);
}

.search-bar {
    flex: 1;
    margin: 0 10px;
    background: rgba(0,0,0,0.4);
    border-radius: 20px;
    padding: 8px 15px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
}

/* Product Media */
.product-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    background: #fff;
}
.product-media .main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.image-indicator {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0,0,0,0.5);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Sections */
.section {
    background: var(--bg-white);
    margin-bottom: 8px;
    padding: 15px;
}

/* Product Info */
/* Sleek Flash Sale Banner */
.sleek-fs-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(90deg, #ff4d4f 0%, #ff0f0f 100%);
    color: white;
    padding: 8px 15px;
    margin: -15px -15px 12px -15px;
    font-size: 13px;
}
.sfs-left {
    font-weight: 800;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sfs-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}
.countdown {
    display: flex;
    align-items: center;
    gap: 2px;
    font-weight: 700;
}
.cd-box {
    background: #000;
    color: #fff;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 12px;
    min-width: 20px;
    text-align: center;
}

/* Price Container */
.price-container {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.current-price {
    color: var(--primary-color);
    font-weight: 700;
}
.current-price .currency { font-size: 18px; }
.current-price .amount { font-size: 28px; transition: all 0.3s; }

.original-price {
    color: var(--text-muted);
    text-decoration: line-through;
    font-size: 14px;
}
.discount-badge {
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.product-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
}
.mall-badge {
    background: #101010;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: middle;
    font-weight: 700;
}
.stats-container {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
    gap: 8px;
}
.rating i { color: #ffb800; margin-right: 4px; font-size: 12px;}
.divider { color: var(--border-color); }
.fs-xtra-badge {
    background: linear-gradient(90deg, #00c675, #009352);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

/* USPs */
.usps {
    padding: 12px 15px;
}
.usp-list {
    display: flex;
    justify-content: space-between;
}
.usp-item {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Vouchers */
.vouchers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}
.voucher-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.voucher-list::-webkit-scrollbar { display: none; }
.voucher-item {
    background: var(--primary-light);
    border: 1px solid var(--primary-light);
    border-radius: 6px;
    display: flex;
    align-items: center;
    min-width: 160px;
    overflow: hidden;
}
.voucher-item.freeship-xtra {
    background: linear-gradient(135deg, #00c675 0%, #009352 100%);
    border: none;
}
.v-info {
    flex: 1;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-color);
}
.voucher-item.freeship-xtra .v-info { color: white; }
.voucher-item.freeship-xtra .v-info small { color: rgba(255,255,255,0.9); }
.voucher-item.freeship-xtra .v-btn {
    background: white;
    color: #009352;
}
.v-info small {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-secondary);
}
.v-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 12px;
    height: 100%;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}
.v-btn.saved {
    background: #ddd;
    color: #666;
}

/* Video Placeholder */
.product-video { padding: 0; }
.video-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: #000;
}
.video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
}
.video-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 2;
}
.play-icon {
    font-size: 48px;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* Product Details */
.section-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 15px;
}
.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}
.detail-row {
    display: flex;
    font-size: 14px;
}
.detail-label {
    width: 100px;
    color: var(--text-muted);
}
.detail-value {
    flex: 1;
    color: var(--text-main);
}
.description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
}
.description p { margin-bottom: 10px; }
.desc-img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* Reviews */
.review-item {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}
.review-item:last-child { border-bottom: none; }
.reviewer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #555;
}
.name-rating .name {
    font-size: 13px;
    font-weight: 500;
}
.name-rating .stars i {
    color: #ffb800;
    font-size: 10px;
}
.review-text {
    font-size: 14px;
    color: var(--text-main);
}

/* Bottom Bar */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--bg-white);
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
    z-index: 100;
}
.action-buttons {
    flex: 1;
    display: flex;
    gap: 10px;
}
.btn-cart {
    flex: 1;
    background: var(--primary-light);
    color: var(--primary-color);
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 0;
    cursor: pointer;
}
.btn-buy {
    flex: 1;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 0;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(254, 44, 85, 0.3);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content {
    background: #fff;
    width: 100%;
    max-width: 480px;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}
.modal-overlay.active .modal-content { transform: translateY(0); }

.modal-header {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}
.modal-thumb {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    margin-top: -30px;
    border: 3px solid #fff;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.modal-price-info { margin-left: 15px; padding-top: 0; }
.modal-price { font-size: 20px; font-weight: 700; }
.modal-stock { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.modal-selected-variant {
    font-size: 12px;
    color: var(--text-main);
    background: #f0f0f0;
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
}
.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f0f0f0;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    cursor: pointer;
}

.modal-body {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
}

/* Options / Variants */
.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.option-btn {
    background: #f5f5f5;
    border: 1px solid transparent;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}
.option-btn.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.form-group { margin-bottom: 15px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
}
.quantity-selector {
    display: flex;
    align-items: center;
    margin-top: 8px;
}
.qty-btn {
    width: 32px;
    height: 32px;
    background: #f0f0f0;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
}
#qtyInput {
    width: 50px;
    height: 32px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
}
.form-title {
    font-size: 15px;
    font-weight: 600;
    margin: 20px 0 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}
.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fafafa;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
}
select.form-input {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    padding-right: 40px;
}
select.form-input:disabled {
    background-color: #eee;
    color: #999;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
}
.form-input.error {
    border-color: var(--primary-color);
    background: var(--primary-light);
}
.error-msg {
    color: var(--primary-color);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}
.error-msg.show {
    display: block;
}

.address-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Confirm Step */
.confirm-alert {
    background: #e6f6ec;
    color: #00b14f;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.confirm-summary p {
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.5;
}
.price-breakdown {
    border-top: 1px dashed var(--border-color);
    margin-top: 15px;
    padding-top: 10px;
}
.breakdown-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 5px;
}

.modal-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background: #fff;
}
.total-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
}
.total-price {
    color: var(--primary-color);
    font-size: 18px;
}
.btn-submit {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 24px;
    font-weight: 600;
    font-size: 16px;
    padding: 14px 0;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(254, 44, 85, 0.3);
}

/* Toast */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: clamp(12px, 3.8vw, 15px);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 2000;
    white-space: nowrap;
    max-width: 95vw;
}
.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}
.toast i { color: #00e676; font-size: 20px; }

/* Carousel & Lightbox CSS */
.carousel-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-img {
    flex: 0 0 100%;
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    scroll-snap-align: start;
    cursor: pointer;
}

.lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.lightbox.active {
    opacity: 1;
    visibility: visible;
}
.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 3001;
    color: #fff;
}
.lightbox-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}
.lightbox-track {
    flex: 1;
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    align-items: center;
}
.lightbox-track::-webkit-scrollbar { display: none; }
.lb-img {
    flex: 0 0 100%;
    width: 100%;
    max-height: 100vh;
    object-fit: contain;
    scroll-snap-align: start;
}

/* Voucher Status in Modal */
.modal-voucher-status {
    background: #f8f9fa;
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 13px;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
}
.modal-voucher-status .v-applied { color: #00b14f; font-weight: 600; }
.modal-voucher-status .v-missing { color: var(--primary-color); font-weight: 600; }
.modal-voucher-status .v-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 8px;
    font-size: clamp(11px, 3.2vw, 13px);
    white-space: nowrap;
}
.modal-voucher-status .v-item > span:first-child {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.modal-voucher-status .v-item > span:last-child {
    flex-shrink: 0;
    text-align: right;
}
.modal-voucher-status .v-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Reviews Dynamic */
.review-image-grid {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    overflow-x: auto;
}
.review-image-grid::-webkit-scrollbar { display: none; }
.review-image-grid img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}
.view-more-reviews {
    width: 100%;
    text-align: center;
    padding: 12px 0;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 14px;
    background: #fff;
    border: 1px solid var(--primary-light);
    border-radius: 24px;
    margin-top: 15px;
    cursor: pointer;
}

/* Promo Modal */
#promoModal {
    align-items: center;
    padding: 20px;
}
.promo-modal-content {
    text-align: center;
    padding: 0;
    overflow: hidden;
    position: relative;
    border-radius: 16px !important;
    height: auto !important;
    max-width: 380px;
    animation: zoomIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.promo-modal-content .modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    z-index: 10;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.promo-banner {
    background: linear-gradient(135deg, #ff4d4f, #ff0f0f);
    color: white;
    padding: 30px 20px;
    font-size: 50px;
}
.promo-text {
    padding: 20px 20px 10px;
}
.promo-text h2 {
    color: var(--primary-color);
    font-size: 22px;
    margin-bottom: 8px;
    font-weight: 800;
}
.promo-text p {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 15px;
    line-height: 1.4;
}
.promo-voucher {
    background: linear-gradient(135deg, #00c675 0%, #009352 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
#btnPromoSave {
    margin: 0 20px 20px;
    width: calc(100% - 40px);
}
