/*
Theme Name: TikTok Shop WhatsApp Checkout Theme
Theme URI: https://github.com/aistudio/tiktok-shop-whatsapp
Author: AI Studio Build
Author URI: https://ai.studio/build
Description: A high-performance, mobile-first WordPress theme styled like TikTok Shop. Optimized for vertical swipe interaction, quick variant selection, and instant checkout redirected directly to WhatsApp, with a comprehensive admin orders tracker and coupon management.
Version: 1.0.0
License: GNU GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tiktok-shop-whatsapp
Tags: mobile-first, ecommerce, tiktokshop, whatsapp-checkout, custom-post-types
*/

/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #010101;
    color: #ffffff;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* TikTok Vertical Scroll Feed Styles */
.tiktok-feed-container {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    height: 100vh;
    width: 100%;
    scrollbar-width: none; /* Firefox */
}

.tiktok-feed-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.tiktok-product-slide {
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* Dark overlay for text readability */
.tiktok-product-slide::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.6) 100%);
    z-index: 1;
}

/* Slide Content Container */
.tiktok-slide-content {
    position: relative;
    z-index: 10;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    padding-top: 70px; /* space for header */
    padding-bottom: 90px; /* space for bottom CTA */
}

/* Header Styles */
.tiktok-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

.tiktok-logo {
    font-weight: 800;
    font-size: 1.3rem;
    color: #fff;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tiktok-logo span {
    color: #fe2c55; /* TikTok Red */
}

.tiktok-logo-accent {
    color: #25f4ee !important; /* TikTok Cyan */
    margin-left: -4px;
}

/* Floating Actions Sidebar (Like, Comment, Share, Cart) */
.tiktok-sidebar-actions {
    position: absolute;
    right: 15px;
    bottom: 220px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.tiktok-action-btn {
    background: none;
    border: none;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: transform 0.2s;
}

.tiktok-action-btn:active {
    transform: scale(0.9);
}

.tiktok-action-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    backdrop-filter: blur(10px);
    transition: background 0.2s;
}

.tiktok-action-btn:hover .tiktok-action-icon {
    background: rgba(255, 255, 255, 0.25);
}

.tiktok-action-btn.active .tiktok-action-icon {
    background: #fe2c55;
    color: #fff;
}

/* Product Info Overlay (Title, Description, Tags) */
.tiktok-product-info {
    position: absolute;
    left: 20px;
    bottom: 120px;
    right: 80px;
    z-index: 20;
    color: #fff;
}

.tiktok-vendor-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.tiktok-vendor-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #fff;
    background-color: #333;
}

.tiktok-product-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.tiktok-product-desc {
    font-size: 0.88rem;
    color: #e5e5e5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.tiktok-price-tag {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.15);
}

.tiktok-current-price {
    font-size: 1.15rem;
    font-weight: 800;
    color: #25f4ee;
}

.tiktok-regular-price {
    font-size: 0.85rem;
    text-decoration: line-through;
    color: #aaa;
}

/* Sticky Quick Buy Bottom Drawer Trigger */
.tiktok-bottom-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(1, 1, 1, 0.95);
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 12px 20px;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(20px);
}

.tiktok-quick-buy-btn {
    width: 100%;
    height: 48px;
    background: #fe2c55;
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 15px rgba(254, 44, 85, 0.4);
}

.tiktok-quick-buy-btn:active {
    transform: scale(0.97);
}

/* Quick Buy Slide-up Drawer */
.tiktok-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tiktok-drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.tiktok-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 85vh;
    background: #121212;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    z-index: 210;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    color: #fff;
    padding: 24px;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
}

.tiktok-drawer.open {
    transform: translateY(0);
}

.tiktok-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
}

.tiktok-drawer-product-summary {
    display: flex;
    gap: 15px;
}

.tiktok-drawer-img {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    object-fit: cover;
    background-color: #222;
}

.tiktok-drawer-title-price {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tiktok-drawer-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.tiktok-drawer-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fe2c55;
}

.tiktok-drawer-close {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Variant Selector Chips */
.tiktok-variant-section {
    margin-bottom: 18px;
}

.tiktok-variant-label {
    font-size: 0.85rem;
    color: #aaa;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.tiktok-variant-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tiktok-variant-chip {
    padding: 8px 16px;
    background: #222;
    border: 1px solid #333;
    color: #fff;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.tiktok-variant-chip:hover {
    border-color: #555;
}

.tiktok-variant-chip.selected,
.tiktok-variant-chip.active {
    background: #fe2c55;
    border-color: #fe2c55;
    color: #fff;
    font-weight: 600;
}

/* Form inputs for checkout */
.tiktok-checkout-form {
    margin-top: 20px;
}

.tiktok-form-group {
    margin-bottom: 16px;
}

.tiktok-form-label {
    display: block;
    font-size: 0.85rem;
    color: #bbb;
    margin-bottom: 6px;
    font-weight: 500;
}

.tiktok-input {
    width: 100%;
    padding: 12px 16px;
    background: #1c1c1e;
    border: 1px solid #2c2c2e;
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tiktok-input:focus {
    outline: none;
    border-color: #fe2c55;
    box-shadow: 0 0 0 2px rgba(254, 44, 85, 0.2);
}

.tiktok-input::placeholder {
    color: #555;
}

.tiktok-coupon-wrapper {
    display: flex;
    gap: 8px;
}

.tiktok-coupon-apply-btn {
    padding: 0 16px;
    background: #25f4ee;
    color: #000;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.tiktok-coupon-apply-btn:hover {
    opacity: 0.9;
}

.tiktok-coupon-feedback {
    font-size: 0.8rem;
    margin-top: 5px;
    display: none;
}

.tiktok-coupon-feedback.success {
    color: #25f4ee;
    display: block;
}

.tiktok-coupon-feedback.error {
    color: #fe2c55;
    display: block;
}

/* Order Totals Summary */
.tiktok-order-summary {
    background: #1c1c1e;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
}

.tiktok-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 8px;
}

.tiktok-summary-row:last-child {
    margin-bottom: 0;
}

.tiktok-summary-row.total {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    border-top: 1px solid #2c2c2e;
    padding-top: 8px;
    margin-top: 8px;
}

/* WhatsApp Checkout Button */
.tiktok-whatsapp-submit {
    width: 100%;
    height: 52px;
    background: #25D366; /* WhatsApp Green */
    color: #fff;
    border: none;
    border-radius: 26px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    transition: transform 0.1s, opacity 0.2s;
}

.tiktok-whatsapp-submit:active {
    transform: scale(0.97);
}

.tiktok-whatsapp-submit:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
}

/* Notice Banner when Shop is Closed */
.tiktok-closed-banner {
    background: #fe2c55;
    color: #fff;
    text-align: center;
    padding: 10px 15px;
    font-size: 0.85rem;
    font-weight: 700;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    z-index: 99;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Responsive Grid layouts for Desktop fallback */
@media (min-width: 768px) {
    .tiktok-feed-container {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
        height: auto;
        gap: 20px;
        padding: 80px 40px;
        scroll-snap-type: none;
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .tiktok-product-slide {
        height: 600px;
        border-radius: 16px;
        scroll-snap-align: none;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }
    
    .tiktok-product-info {
        bottom: 30px;
    }
    
    .tiktok-sidebar-actions {
        bottom: 120px;
    }
    
    .tiktok-bottom-cta {
        display: none;
    }
    
    .tiktok-drawer {
        width: 450px;
        right: 0;
        left: auto;
        border-top-left-radius: 20px;
        border-bottom-left-radius: 20px;
        border-top-right-radius: 0;
        height: 100vh;
        max-height: 100vh;
    }
}
