/* ============================================================
   TikTok Auto Commerce Bot - Ultimate Premium Gemini Glassmorphism UI
   ============================================================ */

:root {
    /* Ultimate Gemini Songkran Theme - Pitch Black & Neon Glow */
    --bg-primary: #000000; 
    --bg-secondary: transparent;
    --bg-card: rgba(20, 20, 30, 0.35);
    --bg-card-hover: rgba(30, 30, 45, 0.55);
    --bg-input: rgba(10, 10, 15, 0.6);
    --bg-sidebar: rgba(10, 10, 15, 0.45);

    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #38bdf8;

    --accent-purple: #d8b4fe;
    --accent-blue: #7dd3fc;
    --accent-green: #5eead4; /* Neon Teal */
    --accent-orange: #fcd34d;
    --accent-red: #fda4af;
    --accent-pink: #f9a8d4;
    --accent-cyan: #67e8f9;
    --accent-tiktok: #06b6d4; /* Deep bright cyan replacing standard pink/white */

    --gradient-purple: linear-gradient(135deg, #c084fc, #ec4899);
    --gradient-blue: linear-gradient(135deg, #38bdf8, #818cf8);
    --gradient-green: linear-gradient(135deg, #2dd4bf, #0284c7); 
    --gradient-orange: linear-gradient(135deg, #fbbf24, #f59e0b);
    --gradient-pink: linear-gradient(135deg, #f472b6, #fb7185);
    
    /* Cosmic Water Gradient */
    --gradient-tiktok: linear-gradient(135deg, #0ea5e9, #a855f7, #ec4899);

    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(34, 211, 238, 0.5);
    --shadow-sm: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.8);
    --shadow-glow: 0 0 40px rgba(14, 165, 233, 0.4);
    
    --radius-sm: 14px;
    --radius-md: 20px;
    --radius-lg: 24px;
    
    --transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    --sidebar-width: 250px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    z-index: 0;
}

/* --- Massive Glowing Background Orbs (Gemini Style) --- */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    left: 10%;
    width: 60vw;
    height: 60vh;
    background: radial-gradient(circle at center, rgba(6, 182, 212, 0.25), transparent 60%);
    filter: blur(120px);
    z-index: -1;
    animation: blob-float1 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    right: 0%;
    width: 70vw;
    height: 70vh;
    background: radial-gradient(circle at center, rgba(168, 85, 247, 0.25), transparent 60%);
    filter: blur(140px);
    z-index: -1;
    animation: blob-float2 25s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

/* --- Songkran Floating Badge --- */
.songkran-badge-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(10, 10, 15, 0.5);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(6, 182, 212, 0.3);
    padding: 14px 28px;
    border-radius: 50px;
    color: #e0f2fe;
    font-weight: 800;
    font-size: 14px;
    z-index: 99999;
    animation: float-songkran 4s ease-in-out infinite, pulse-border 3s infinite;
    pointer-events: none;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.songkran-badge-container::before {
    content: "🌊";
    font-size: 18px;
    animation: wave-emoji 2s infinite;
}
.songkran-badge-container::after {
    content: "สาดสุขสงกรานต์ '69 X Gemini UI";
    background: var(--gradient-tiktok);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Animations */
@keyframes blob-float1 {
    0% { transform: translate(0, 0) scale(1); opacity: 0.7; }
    50% { transform: translate(10vw, 5vh) scale(1.1); opacity: 1; }
    100% { transform: translate(-5vw, 15vh) scale(0.9); opacity: 0.8; }
}

@keyframes blob-float2 {
    0% { transform: translate(0, 0) scale(1); opacity: 0.8; }
    50% { transform: translate(-10vw, -10vh) scale(1.05); opacity: 1; }
    100% { transform: translate(10vw, -5vh) scale(0.95); opacity: 0.9; }
}

@keyframes float-songkran {
    0%, 100% { transform: translateY(0); box-shadow: 0 10px 40px rgba(6, 182, 212, 0.2); }
    50% { transform: translateY(-10px); box-shadow: 0 15px 50px rgba(6, 182, 212, 0.4); }
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(6, 182, 212, 0.2); }
    50% { border-color: rgba(168, 85, 247, 0.5); }
}

@keyframes wave-emoji {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(15deg) scale(1.1); }
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

/* ===== SIDEBAR ===== */
#sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: var(--shadow-sm);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 18px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    font-size: 26px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-tiktok);
    border-radius: var(--radius-md);
}

.sidebar-brand h1 {
    font-size: 17px;
    font-weight: 800;
    background: var(--gradient-tiktok);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-links {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto; /* ★ FIX: ให้ scroll ได้เมื่อมีเมนูเยอะ (บนมือถือจอเล็ก) */
    overflow-x: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-item:hover {
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(254, 44, 85, 0.1);
    color: var(--accent-tiktok);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    background: var(--accent-tiktok);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    font-size: 17px;
    width: 22px;
    text-align: center;
}

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--border-color);
}

.pipeline-mini {
    background: rgba(254, 44, 85, 0.08);
    border: 1px solid rgba(254, 44, 85, 0.15);
    border-radius: var(--radius-md);
    padding: 10px;
}

.pipeline-mini-label {
    font-size: 10px;
    color: var(--accent-tiktok);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.pipeline-mini-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.pipeline-mini-progress {
    height: 4px;
    background: rgba(254, 44, 85, 0.15);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.pipeline-mini-fill {
    height: 100%;
    background: var(--gradient-tiktok);
    border-radius: 2px;
    transition: width 0.5s ease;
    width: 0;
}

/* ===== MAIN ===== */
#main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 22px 28px;
    min-height: 100vh;
    min-width: 0; /* prevent flex overflow */
    width: calc(100% - var(--sidebar-width));
}




/* ===== TOP BAR ===== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: rgba(4, 13, 26, 0.7);
    backdrop-filter: blur(16px);
    z-index: 90;
    box-shadow: 0 4px 24px rgba(14, 165, 233, 0.1);
}

.update-info {
    font-size: 11px;
    color: var(--text-muted);
}

#last-update-time {
    color: var(--accent-cyan);
    font-weight: 600;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-badge {
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
}

.header-badge.live {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    animation: pulse 2s infinite;
}

.header-badge.offline {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    animation: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.5
    }
}

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    transform: translate(25%, -25%);
}

.gradient-pink {
    background: var(--gradient-pink);
}

.gradient-purple {
    background: var(--gradient-purple);
}

.gradient-blue {
    background: var(--gradient-blue);
}

.gradient-green {
    background: var(--gradient-green);
}

.stat-icon {
    font-size: 28px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 3px;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 18px;
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(139, 92, 246, 0.12);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 700;
}

.add-form {
    border: 1px solid rgba(254, 44, 85, 0.2);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* ===== BUTTON ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-tiktok);
    color: white;
    box-shadow: 0 4px 14px rgba(254, 44, 85, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(254, 44, 85, 0.45);
}

.btn-secondary {
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 11px;
    font-size: 11.5px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

/* ===== FORM ===== */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

textarea,
select,
input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    transition: var(--transition);
    outline: none;
}

textarea:focus,
select:focus,
input:focus {
    border-color: var(--accent-tiktok);
    box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.12);
}

textarea {
    resize: vertical;
    min-height: 90px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%238585a0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-tiktok);
}

/* ===== CHANNEL CARDS ===== */
.channel-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.channel-card:hover {
    border-color: rgba(254, 44, 85, 0.2);
    transform: translateX(4px);
}

.channel-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.ch-a1 {
    background: var(--gradient-tiktok);
}

.ch-a2 {
    background: var(--gradient-purple);
}

.ch-a3 {
    background: var(--gradient-blue);
}

.ch-a4 {
    background: var(--gradient-green);
}

.ch-a5 {
    background: var(--gradient-orange);
}

.channel-info {
    flex: 1;
    min-width: 0;
}

.channel-name {
    font-size: 15px;
    font-weight: 700;
}

.channel-id {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.channel-meta {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.channel-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-valid {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.status-invalid {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}

.status-disabled {
    background: rgba(85, 85, 106, 0.15);
    color: var(--text-muted);
}

.status-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-orange);
}

.channel-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ===== PRODUCT GRID ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.product-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    border-color: rgba(254, 44, 85, 0.2);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.product-card.selected {
    border-color: var(--accent-tiktok);
    box-shadow: 0 0 12px rgba(254, 44, 85, 0.2);
}

.product-card.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 24px;
    height: 24px;
    background: var(--accent-tiktok);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.product-thumb {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    overflow: hidden;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 12px 14px;
}

.product-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-tiktok);
    margin-top: 4px;
}

.product-commission {
    font-size: 11px;
    color: var(--accent-green);
    margin-top: 2px;
}

/* ===== PIPELINE PRODUCTS ===== */
.pipe-product-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
}

.pipe-product-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: default;
    transition: var(--transition);
    position: relative;
}

.pipe-product-item:hover {
    background: var(--bg-card-hover);
}

.btn-remove-pipe {
    background: rgba(255, 60, 60, 0.15);
    border: none;
    color: #ff4444;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.btn-remove-pipe:hover {
    background: rgba(255, 60, 60, 0.35);
    transform: scale(1.15);
}

.pipe-product-item img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.pipe-product-item .name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.pipe-product-item .price {
    font-size: 12px;
    color: var(--accent-tiktok);
    font-weight: 600;
    flex-shrink: 0;
}

.pipe-acc-badge {
    font-size: 11px;
    background: rgba(0, 200, 255, 0.12);
    color: #00c8ff;
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.pipeline-summary {
    background: rgba(254, 44, 85, 0.06);
    border: 1px solid rgba(254, 44, 85, 0.15);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
    display: flex;
    gap: 24px;
    justify-content: center;
}

.summary-item {
    text-align: center;
}

.summary-item span {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
}

.summary-item strong {
    font-size: 20px;
    font-weight: 800;
}

.summary-item strong.accent {
    color: var(--accent-tiktok);
}

/* ===== PIPELINE PROGRESS ===== */
.pipeline-task-list {
    max-height: 500px;
    overflow-y: auto;
}

.pipeline-task {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    background: var(--bg-input);
}

.task-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.task-dot.pending {
    background: var(--text-muted);
}

.task-dot.generating {
    background: var(--accent-orange);
    animation: pulse 1s infinite;
}

.task-dot.posting {
    background: var(--accent-blue);
    animation: pulse 1s infinite;
}

.task-dot.completed {
    background: var(--accent-green);
}

.task-dot.failed {
    background: var(--accent-red);
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-product {
    font-size: 12px;
    font-weight: 600;
}

.task-prompt {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-status {
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 8px;
}

/* ===== GALLERY ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.gallery-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(254, 44, 85, 0.3);
}

.gallery-thumb {
    width: 100%;
    aspect-ratio: 9/16;
    background: var(--bg-input);
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.gallery-thumb video,
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumb .gallery-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    opacity: 0.7;
    pointer-events: none;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: opacity 0.2s;
}

.gallery-item:hover .gallery-play-icon {
    opacity: 1;
}

.gallery-info {
    padding: 10px 14px;
}

.gallery-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    justify-content: space-between;
}

/* Gallery Pagination */
.gallery-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 16px 0;
    flex-wrap: wrap;
}

.gallery-pagination button {
    min-width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-pagination button:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}

.gallery-pagination button.active {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.gallery-pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gallery-pagination .page-info {
    font-size: 13px;
    color: var(--text-muted);
    padding: 0 12px;
}

/* ===== TAB ===== */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* ===== BADGE ===== */
.badge {
    background: var(--accent-tiktok);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

/* ===== EMPTY ===== */
.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.empty-state.small {
    padding: 20px;
}

.empty-state a {
    color: var(--accent-tiktok);
    text-decoration: none;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideInRight 0.3s ease;
    min-width: 280px;
}

.toast.success {
    border-left: 3px solid var(--accent-green);
}

.toast.error {
    border-left: 3px solid var(--accent-red);
}

.toast.info {
    border-left: 3px solid var(--accent-blue);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(254, 44, 85, 0.2);
    border-top-color: var(--accent-tiktok);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width:1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width:768px) {

    /* Hamburger menu button — visible only on mobile */
    .mobile-menu-btn {
        display: flex !important;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 201;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: linear-gradient(135deg, #7c3aed, #a855f7);
        border: none;
        color: white;
        font-size: 22px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
        transition: all 0.3s ease;
    }

    .mobile-menu-btn:active {
        transform: scale(0.92);
    }

    /* Dark backdrop overlay when sidebar is open */
    .sidebar-backdrop {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 99;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Sidebar slides in from left */
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 200;
        width: 260px;
        box-shadow: none;
    }

    #sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.5);
    }

    #main-content {
        margin-left: 0;
        padding: 14px;
        padding-top: 68px;
        /* Space for hamburger button */
    }

    /* ★ FIX: Top bar ไม่บังเนื้อหาบนมือถือ */
    .top-bar {
        padding-top: 6px;
        padding-left: 50px; /* เว้นที่ให้ hamburger button */
        flex-wrap: wrap;
        gap: 8px;
    }

    /* ★ FIX: Sidebar nav scroll + footer ไม่ถูกบัง */
    .nav-links {
        max-height: calc(100vh - 180px); /* หักที่ header + footer */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-footer {
        flex-shrink: 0;
    }

    /* ★ FIX: Topbar right items wrap on mobile */
    .top-bar-right {
        flex-wrap: wrap !important;
        gap: 6px !important;
        justify-content: flex-end;
    }

    .top-bar-right .btn {
        font-size: 11px !important;
        min-height: 36px !important;
        padding: 4px 10px !important;
    }

    /* ★ FIX: Page headers stack on mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 6px;
    }

    /* ★ FIX: Inline 2-column grids → stack on mobile */
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* ★ FIX: Card headers wrap on mobile */
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* ★ FIX: Language selector shrink */
    #global-language {
        min-width: 80px !important;
        font-size: 11px !important;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Make cards and inputs more touch-friendly */
    .form-input,
    .form-select,
    select {
        font-size: 16px !important;
        /* Prevents iOS zoom on focus */
        min-height: 44px;
    }

    .btn {
        min-height: 44px;
        font-size: 14px;
    }

    /* AI Video flow diagram — stack on mobile */
    .ai-flow-diagram {
        gap: 4px;
    }

    .flow-step {
        font-size: 10px;
        padding: 6px 8px;
    }

    .flow-arrow {
        font-size: 12px;
    }

    /* Section headers stack */
    .section-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    /* Product grid single column */
    .product-grid {
        grid-template-columns: 1fr !important;
    }

    /* Gallery grid smaller */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .gallery-thumb {
        aspect-ratio: 9/16;
    }

    .gallery-pagination button {
        min-width: 36px;
        height: 36px;
        font-size: 12px;
    }

    /* Pipeline summary stack */
    .pipeline-summary {
        flex-direction: column;
        gap: 12px;
    }

    /* Table scroll hint */
    .table-wrap {
        position: relative;
    }

    .table-wrap::after {
        content: '→ เลื่อนดูเพิ่ม';
        position: absolute;
        top: 8px;
        right: 8px;
        font-size: 10px;
        color: var(--text-muted);
        background: var(--bg-card);
        padding: 2px 8px;
        border-radius: 8px;
        pointer-events: none;
    }

    /* Preview stats 2 columns instead of 4 */
    .preview-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ===== CHANNEL PREVIEW ===== */
.channel-preview-card {
    background: var(--bg-input);
    border: 1px solid rgba(254, 44, 85, 0.2);
    border-radius: var(--radius-lg);
    padding: 20px;
    animation: slideDown 0.4s ease;
}

.channel-preview-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.preview-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-tiktok);
    flex-shrink: 0;
    background: var(--bg-card);
}

.preview-info {
    flex: 1;
    min-width: 0;
}

.preview-name {
    font-size: 18px;
    font-weight: 800;
    background: var(--gradient-tiktok);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.preview-id {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.preview-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.preview-stat {
    text-align: center;
    padding: 10px 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.preview-stat-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

.preview-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Channel card with avatar image */
.channel-avatar-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(254, 44, 85, 0.3);
}

.channel-followers {
    font-size: 12px;
    color: var(--accent-tiktok);
    font-weight: 600;
}

.btn:disabled,
.btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-left: 6px;
}

/* ===== CHANNEL PREVIEW CARD ===== */
.channel-preview-card {
    background: var(--bg-card-hover);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-lg);
    padding: 20px;
    animation: slideDown 0.4s ease, glowGreen 1s ease;
}

@keyframes glowGreen {
    0% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    }

    100% {
        box-shadow: none;
    }
}

.channel-preview-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.preview-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(16, 185, 129, 0.4);
    flex-shrink: 0;
}

.preview-info {
    flex: 1;
    min-width: 0;
}

.preview-name {
    font-size: 17px;
    font-weight: 700;
}

.preview-id {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.preview-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 14px;
}

.preview-stat {
    text-align: center;
}

.preview-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.preview-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.channel-avatar-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}

/* ============================================================
   AI VIDEO GENERATOR STYLES
   ============================================================ */

/* Flow Diagram */
.ai-flow-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.flow-step {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    transition: all 0.4s ease;
}

.flow-step span {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.flow-step.active {
    color: #fff;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    animation: stepPulse 2s infinite;
}

.flow-step.active span {
    background: rgba(255, 255, 255, 0.25);
}

.flow-step.done {
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

.flow-step.done span {
    background: rgba(16, 185, 129, 0.2);
}

.flow-arrow {
    color: var(--text-muted);
    font-size: 18px;
    font-weight: 300;
}

@keyframes stepPulse {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(102, 126, 234, 0.2);
    }

    50% {
        box-shadow: 0 0 25px rgba(102, 126, 234, 0.45);
    }
}

/* Step Cards */
.ai-step {
    transition: all 0.4s ease;
}

.ai-step.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.ai-step.active-step {
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.1);
}

.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    margin-right: 8px;
}

.step-status {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Loading Spinner */
.ai-loading {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.ai-elapsed {
    font-size: 11px;
    color: var(--text-muted);
}

.ai-error {
    padding: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    color: var(--accent-red);
    font-size: 14px;
}

.ai-warning {
    padding: 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-md);
    color: var(--accent-orange);
    font-size: 14px;
}

/* Prompt Result */
.prompt-box {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.prompt-section label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.prompt-text {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.caption-text {
    color: var(--accent-cyan);
    font-weight: 500;
}

.hashtag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hashtag {
    background: rgba(102, 126, 234, 0.12);
    color: #8b9cf7;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Image Result */
.image-result-box {
    text-align: center;
}

.generated-image {
    max-width: 300px;
    max-height: 400px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.generated-image:hover {
    border-color: var(--accent-purple);
    transform: scale(1.02);
}

.image-info {
    margin-top: 10px;
    font-size: 12px;
    color: var(--accent-green);
    font-weight: 600;
}

/* Video Result */
.final-result-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.video-preview {
    text-align: center;
}

.generated-video {
    width: 100%;
    max-width: 320px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: #000;
}

.result-details {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.result-item label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.copyable {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.5;
}

.copyable:hover {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.05);
}

.copyable::after {
    content: ' 📋 คลิกเพื่อ copy';
    font-size: 10px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .final-result-box {
        grid-template-columns: 1fr;
    }

    .ai-flow-diagram {
        gap: 4px;
    }

    .flow-step {
        font-size: 10px;
        padding: 6px 10px;
    }

    .flow-arrow {
        font-size: 14px;
    }
}

/* ===== PRODUCT SELECTION GRID ===== */
.product-grid.selectable .product-card {
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.product-grid.selectable .product-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}

.product-grid.selectable .product-card.selected {
    border-color: var(--accent-green);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.2), inset 0 0 0 1px rgba(16, 185, 129, 0.3);
}

.product-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 2;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}

.product-card.selected .product-checkbox {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #fff;
}

.product-card .product-labels {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.product-card .product-label {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(254, 44, 85, 0.15);
    color: var(--accent-tiktok);
    font-weight: 600;
}

.product-card .product-commission {
    font-size: 11px;
    color: var(--accent-green);
    font-weight: 600;
}

.product-card .product-seller {
    font-size: 10px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stats bar */
.product-stats-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.product-stats-bar .divider {
    color: var(--text-muted);
}

/* ===== PRODUCT SALES INLINE (per-product) ===== */
.product-sales-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 5px 8px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(59, 130, 246, 0.06));
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.product-sales-inline .sales-sold {
    color: #10b981;
    font-weight: 500;
}

.product-sales-inline .sales-sold strong {
    font-weight: 700;
    color: #34d399;
    font-size: 12px;
}

.product-sales-inline .sales-rev {
    color: #f59e0b;
    font-weight: 600;
    font-size: 11px;
}

.product-sales-inline .sales-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.sales-rank.rank-1 {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a2e;
}

.sales-rank.rank-2 {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: #fff;
}

.sales-rank.rank-3 {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
}

/* ===== PRODUCT SALES SUMMARY BAR ===== */
.product-sales-summary-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 18px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(59, 130, 246, 0.06));
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.product-sales-summary-bar .summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-sales-summary-bar .summary-icon {
    font-size: 20px;
}

.product-sales-summary-bar .summary-data {
    display: flex;
    flex-direction: column;
}

.product-sales-summary-bar .summary-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.product-sales-summary-bar .summary-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

.product-sales-summary-bar .summary-note {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* Progress log */
.progress-log {
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 10px;
}

.progress-log .log-entry {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.progress-log .log-entry:last-child {
    border-bottom: none;
    color: var(--accent-green);
    font-weight: 600;
}

.progress-bar-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-tiktok);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Generate Panel */
.generate-panel {
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(59, 130, 246, 0.05));
    position: sticky;
    bottom: 20px;
    z-index: 50;
}

.generate-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.generate-summary .gen-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    font-weight: 500;
}

.generate-summary .gen-stat strong {
    color: var(--text-primary);
}

/* Ghost button variant */
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ===== SCENE INFO BOX ===== */
.scene-info-box {
    background: rgba(102, 126, 234, 0.06);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
}

.scene-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.scene-info-header span:last-child {
    color: #8b9cf7;
    font-size: 11px;
}

.scene-timeline {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.scene-dot {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    color: var(--text-muted);
}

.scene-dot.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: rgba(102, 126, 234, 0.5);
    color: #fff;
    box-shadow: 0 0 12px rgba(102, 126, 234, 0.3);
    animation: stepPulse 2s infinite;
}

.scene-dot.done {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--accent-green);
}

.scene-dot.failed {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.scene-arrow {
    color: var(--text-muted);
    font-size: 14px;
    opacity: 0.5;
}

/* Multi-scene progress in video step */
.multi-scene-progress {
    margin-top: 12px;
    padding: 12px;
    background: rgba(102, 126, 234, 0.06);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(102, 126, 234, 0.15);
}

.multi-scene-progress .scene-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */

.settings-note {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.settings-note span {
    font-size: 18px;
}

.api-key-input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.api-key-input input {
    flex: 1;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.api-key-input .btn {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 16px;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-hint a {
    color: var(--accent-purple);
    text-decoration: none;
}

.form-hint a:hover {
    text-decoration: underline;
}

#settings-save-status {
    font-size: 13px;
    transition: var(--transition);
}

/* ============================================================
   ACTIVITY LOG
   ============================================================ */

.activity-log-container {
    max-height: 600px;
    overflow-y: auto;
    padding: 4px 0;
}

.activity-log-container::-webkit-scrollbar {
    width: 6px;
}

.activity-log-container::-webkit-scrollbar-track {
    background: transparent;
}

.activity-log-container::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    line-height: 1.5;
    transition: background 0.2s ease;
    animation: logSlideIn 0.3s ease-out;
}

@keyframes logSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.02);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.log-content {
    flex: 1;
    min-width: 0;
}

.log-message {
    color: var(--text-primary);
    word-break: break-word;
}

.log-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    font-family: 'Courier New', monospace;
}

.log-entry.log-success .log-message {
    color: var(--accent-green);
}

.log-entry.log-error .log-message {
    color: var(--accent-red);
}

.log-entry.log-warning .log-message {
    color: var(--accent-orange);
}

.log-entry.log-info .log-message {
    color: var(--accent-blue);
}

.log-entry.log-step .log-message {
    color: var(--accent-purple);
}

.log-entry.log-success {
    border-left: 3px solid var(--accent-green);
}

.log-entry.log-error {
    border-left: 3px solid var(--accent-red);
}

.log-entry.log-warning {
    border-left: 3px solid var(--accent-orange);
}

.log-entry.log-info {
    border-left: 3px solid var(--accent-blue);
}

.log-entry.log-step {
    border-left: 3px solid var(--accent-purple);
}

.log-details {
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    max-height: 100px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ============================================================
   TUTORIALS PAGE
   ============================================================ */

.tutorials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.tutorial-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.tutorial-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.tutorial-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-input);
    overflow: hidden;
}

.tutorial-thumbnail video,
.tutorial-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tutorial-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(139, 92, 246, 0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}

.tutorial-card:hover .tutorial-play-btn {
    background: rgba(139, 92, 246, 1);
    transform: translate(-50%, -50%) scale(1.1);
}

.tutorial-ep-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--gradient-purple);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.tutorial-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.tutorial-info {
    padding: 14px 16px;
}

.tutorial-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.tutorial-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tutorial Modal */
.tutorial-modal-video {
    width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-sm);
    background: black;
}

/* ============================================================
   MY PLAN PAGE
   ============================================================ */

.plan-current-card {
    border: 1px solid var(--accent-purple);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(59, 130, 246, 0.05));
}

.plan-current-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.plan-name-big {
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient-purple);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.plan-price-big {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-green);
}

.plan-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.plan-stat {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}

.plan-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.plan-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.plan-usage-section h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 14px;
}

.plan-usage-bar-wrap {
    margin-bottom: 10px;
}

.plan-usage-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.plan-usage-track {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.plan-usage-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--gradient-purple);
    transition: width 0.5s ease;
}

.plan-usage-fill.full {
    background: linear-gradient(90deg, #ef4444, #f97316);
}

/* Plans Grid */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px 24px 24px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.plan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.3), rgba(59, 130, 246, 0.3));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.plan-card:hover {
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.15), 0 0 0 1px rgba(139, 92, 246, 0.1);
}

.plan-card:hover::before {
    opacity: 1;
}

.plan-card.current {
    border-color: rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(16, 185, 129, 0.02));
}

.plan-card.current::before {
    opacity: 1;
    background: linear-gradient(90deg, #10b981, #34d399);
}

.plan-card.popular {
    border-color: rgba(139, 92, 246, 0.5);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(59, 130, 246, 0.04));
}

.plan-card.popular::before {
    opacity: 1;
    background: linear-gradient(90deg, #8b5cf6, #6366f1);
}

.plan-card-badge {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 0 0 0 12px;
}

.plan-card-badge.badge-current {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.plan-card-badge.badge-popular {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4);
    }

    50% {
        box-shadow: 0 0 12px 4px rgba(139, 92, 246, 0.2);
    }
}

.plan-card-icon {
    font-size: 40px;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.plan-card-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.plan-card-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent-green);
    margin-bottom: 6px;
}

.plan-card-price small {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
}

.plan-card-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.4), transparent);
    margin: 12px auto 16px;
    border-radius: 2px;
}

.plan-card-features {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
    font-size: 14px;
    color: var(--text-secondary);
    flex: 1;
}

.plan-card-features li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
}

.plan-card-features li:last-child {
    border-bottom: none;
}

.plan-card-features li.feature-included {
    color: var(--text-primary);
}

.plan-card-features li.feature-excluded {
    color: var(--text-muted);
    opacity: 0.5;
}

.plan-card-features li.feature-highlight {
    color: #a78bfa;
    font-weight: 600;
}

.feature-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.feature-highlight .feature-check {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.feature-cross {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Plan Card Buttons */
.plan-card-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

.plan-card-btn-current {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    cursor: default;
    opacity: 0.6;
}

.plan-card-btn-select {
    background: linear-gradient(135deg, #fe2c55, #25f4ee);
    color: white;
    box-shadow: 0 4px 15px rgba(254, 44, 85, 0.3);
}

.plan-card-btn-select:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(254, 44, 85, 0.4);
}

.plan-card-btn-contact {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.15));
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}

.plan-card-btn-contact:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.25));
}

.plan-contact-box {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

@media (max-width: 768px) {
    .plan-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }
}

/* Promo pulse animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.85;
        transform: scale(1.05);
    }
}

/* =========================== */
/* FB Dashboard CSS */
/* =========================== */

        

        

        

        .dashboard-container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 2rem;
        }

        /* Header Section */
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2.5rem;
        }

        .header-title h1 {
            font-size: 2rem;
            font-weight: 700;
            background: linear-gradient(135deg, #fff, #a5b4fc);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-bottom: 0.5rem;
        }

        .header-title p {
            color: var(--text-muted);
            font-size: 1rem;
        }

        .header-controls {
            display: flex;
            gap: 1rem;
            align-items: center;
        }

        .page-selector {
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid var(--card-border);
            color: #fff;
            padding: 0.75rem 1.5rem;
            border-radius: 12px;
            font-size: 1rem;
            outline: none;
            backdrop-filter: var(--glass-blur);
            transition: all 0.3s ease;
            cursor: pointer;
            min-width: 250px;
        }

        .page-selector:focus, .page-selector:hover {
            border-color: var(--accent-purple);
            box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
        }

        .btn-sync {
            background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
            color: #fff;
            border: none;
            padding: 0.75rem 1.5rem;
            border-radius: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .btn-sync:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 20px rgba(139, 92, 246, 0.3);
        }

        /* KPI Cards */
        .kpi-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1.5rem;
            margin-bottom: 2.5rem;
        }

        .kpi-card {
            background: var(--card-bg);
            border: 1px solid var(--card-border);
            border-radius: 20px;
            padding: 1.5rem;
            backdrop-filter: var(--glass-blur);
            position: relative;
            overflow: hidden;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .kpi-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
            border-color: rgba(255, 255, 255, 0.15);
        }

        .kpi-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 3px;
            background: linear-gradient(90deg, transparent, var(--accent-purple), transparent);
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .kpi-card:hover::before {
            opacity: 1;
        }

        .kpi-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
            color: var(--text-muted);
            font-size: 0.95rem;
            font-weight: 500;
        }

        .kpi-icon {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
        }

        .icon-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
        .icon-purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
        .icon-pink { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
        .icon-green { background: rgba(16, 185, 129, 0.15); color: #34d399; }

        .kpi-value {
            font-size: 2.2rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
            letter-spacing: -0.5px;
        }

        .kpi-trend {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            font-size: 0.85rem;
        }

        .trend-up { color: var(--accent-green); }
        .trend-down { color: #ef4444; }

        /* Chart Section */
        .chart-section {
            background: var(--card-bg);
            border: 1px solid var(--card-border);
            border-radius: 24px;
            padding: 2rem;
            backdrop-filter: var(--glass-blur);
            margin-bottom: 2.5rem;
            position: relative;
        }

        .chart-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
        }

        .chart-title {
            font-size: 1.25rem;
            font-weight: 600;
        }

        .chart-container {
            height: 350px;
            width: 100%;
        }

        /* Recent Videos Table */
        .table-section {
            background: var(--card-bg);
            border: 1px solid var(--card-border);
            border-radius: 24px;
            padding: 2rem;
            backdrop-filter: var(--glass-blur);
        }

        .table-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
        }

        .table-title {
            font-size: 1.25rem;
            font-weight: 600;
        }

        .btn-outline {
            background: transparent;
            border: 1px solid rgba(255,255,255,0.2);
            color: #fff;
            padding: 0.5rem 1rem;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .btn-outline:hover {
            background: rgba(255,255,255,0.05);
            border-color: rgba(255,255,255,0.4);
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th {
            text-align: left;
            padding: 1rem;
            color: var(--text-muted);
            font-weight: 500;
            font-size: 0.9rem;
            border-bottom: 1px solid var(--card-border);
        }

        td {
            padding: 1.2rem 1rem;
            border-bottom: 1px solid rgba(255,255,255,0.03);
            vertical-align: middle;
        }

        tr:last-child td {
            border-bottom: none;
        }

        tr:hover td {
            background: rgba(255,255,255,0.02);
        }

        .video-cell {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .video-thumb {
            width: 60px;
            height: 80px;
            border-radius: 8px;
            background: #1e1e2d;
            object-fit: cover;
            border: 1px solid rgba(255,255,255,0.1);
        }

        .video-info h4 {
            font-size: 0.95rem;
            margin-bottom: 0.3rem;
            font-weight: 500;
        }

        .video-info p {
            font-size: 0.8rem;
            color: var(--text-muted);
        }

        .status-badge {
            padding: 0.3rem 0.8rem;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 600;
        }

        .status-published {
            background: rgba(16, 185, 129, 0.15);
            color: #34d399;
            border: 1px solid rgba(16, 185, 129, 0.3);
        }

        .status-processing {
            background: rgba(245, 158, 11, 0.15);
            color: #fbbf24;
            border: 1px solid rgba(245, 158, 11, 0.3);
        }

        .metrics-cell {
            display: flex;
            gap: 1rem;
            font-size: 0.9rem;
        }

        .metric-item {
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }

        .btn-action {
            background: rgba(139, 92, 246, 0.15);
            color: #c4b5fd;
            border: 1px solid rgba(139, 92, 246, 0.3);
            padding: 0.5rem 1rem;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 0.85rem;
            font-weight: 500;
        }

        .btn-action:hover {
            background: rgba(139, 92, 246, 0.3);
            color: #fff;
        }

        /* Loading Overlay */
        #loading-overlay {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(10, 10, 15, 0.8);
            backdrop-filter: blur(5px);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            display: none;
        }
        
        .spinner {
            width: 50px;
            height: 50px;
            border: 4px solid rgba(139, 92, 246, 0.3);
            border-top-color: var(--accent-purple);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 1rem;
        }
        
        @keyframes spin { 100% { transform: rotate(360deg); } }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    /* Hide sidebar by default, position it off-canvas */
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        width: 280px;
        background: rgba(10, 10, 15, 0.98);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    #sidebar.open {
        transform: translateX(0);
    }
    
    /* Ensure main content takes full width and has padding for mobile */
    #main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 12px 14px !important;
    }
    
    /* Make the mobile menu button visible in top bar */
    .mobile-menu-btn {
        display: flex !important;
        padding: 4px;
        border-radius: 8px;
        background: rgba(255,255,255,0.05) !important;
    }
    
    /* Sidebar backdrop */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
        z-index: 999;
        display: none !important;
    }
    .sidebar-backdrop.active {
        display: block !important;
    }
    
    /* Adjust top bar for mobile */
    .top-bar {
        padding: 10px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        border-radius: 12px;
        margin-bottom: 20px;
    }
    .top-bar-left .update-info {
        display: none; /* Hide update info to save space */
    }
    .top-bar-right {
        gap: 6px !important;
    }
    .top-bar-right .btn-secondary {
        display: none; /* Hide refresh button on mobile, pull-to-refresh is better */
    }
    #topbar-credit-badge {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
    #global-language {
        min-width: unset !important;
        padding: 6px !important;
        font-size: 11px !important;
    }
    
    /* Stats grid: 1 column */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    .stat-card {
        padding: 18px;
    }
    
    /* Metric grids: force 2 columns for shop revenue/clicks etc */
    div[style*="grid-template-columns:repeat(auto-fit,minmax(140px,1fr))"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    
    /* FB KPI Grids: 1 column */
    div[style*="grid-template-columns:repeat(auto-fit,minmax(220px,1fr))"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    /* Cards and Containers */
    .card {
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 16px;
    }
    
    .product-grid, .gallery-grid, .matrix-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    /* Make tables horizontally scrollable */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Improve tap targets and readability */
    input, select, textarea {
        font-size: 16px !important; /* Prevents auto-zoom on iOS */
        padding: 12px !important;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px; /* iOS minimum tap target */
        margin-bottom: 8px;
    }
    
    /* Header layout */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .page-header h2 {
        font-size: 20px;
    }
    
    /* Floating badge */
    .songkran-badge-container {
        bottom: 12px;
        right: 12px;
        padding: 8px 14px;
        font-size: 11px;
    }
    
    /* Reduce large font sizes for KPI numbers */
    div[id^="kpi-"], div[id^="shop-today-revenue"], div[id^="shop-yesterday-revenue"] {
        font-size: 20px !important;
    }
    div[id^="shop-today-"][id$="views"], div[id^="shop-today-"][id$="clicks"], div[id^="shop-today-"][id$="sold"] {
        font-size: 20px !important;
    }
    
    body {
        overflow-x: hidden;
    }
}