:root {
    /* Brand colors */
    --primary: #F17226;
    --primary-hover: #E8282B;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Dark Mode Defaults */
    --bg-start: #0f172a;
    --bg-end: #1e1b4b;
    --glass-bg: rgba(30, 41, 59, 0.82);
    --glass-border: rgba(255, 255, 255, 0.14);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --sidebar-bg: rgba(11, 17, 32, 0.98);
    --header-bg: rgba(11, 17, 32, 0.92);
    --hover-bg: rgba(255, 255, 255, 0.07);
    --active-bg: rgba(241, 114, 38, 0.12);
    --input-bg: rgba(15, 23, 42, 0.8);
    --input-border: rgba(255, 255, 255, 0.18);
    --btn-secondary-bg: rgba(255, 255, 255, 0.1);
    --btn-secondary-border: rgba(255, 255, 255, 0.22);
    --btn-secondary-color: #e2e8f0;

    /* Premium Sidebar & Header */
    --sidebar-gradient: linear-gradient(180deg, #0c1222 0%, #0f172a 40%, #1a1145 100%);
    --sidebar-glow: rgba(241, 114, 38, 0.06);
    --sidebar-border-glow: rgba(241, 114, 38, 0.15);
    --menu-active-gradient: linear-gradient(90deg, rgba(241, 114, 38, 0.18), rgba(241, 114, 38, 0.05));
    --menu-hover-glow: rgba(241, 114, 38, 0.08);
    --header-glow-line: linear-gradient(90deg, #F17226, #E8282B, #6366f1);

    /* Utils */
    --radius: 14px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-start: #f1f5f9;
    --bg-end: #dde3ee;
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(0, 0, 0, 0.12);
    --text-main: #0f172a;
    --text-muted: #4b5563;
    --sidebar-bg: rgba(248, 250, 252, 0.98);
    --header-bg: rgba(255, 255, 255, 0.98);
    --hover-bg: rgba(0, 0, 0, 0.05);
    --active-bg: rgba(241, 114, 38, 0.08);
    --input-bg: #ffffff;
    --input-border: rgba(0, 0, 0, 0.2);
    --btn-secondary-bg: rgba(0, 0, 0, 0.06);
    --btn-secondary-border: rgba(0, 0, 0, 0.18);
    --btn-secondary-color: #1e293b;

    /* Premium Sidebar & Header (Light) */
    --sidebar-gradient: linear-gradient(180deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
    --sidebar-glow: rgba(241, 114, 38, 0.04);
    --sidebar-border-glow: rgba(241, 114, 38, 0.12);
    --menu-active-gradient: linear-gradient(90deg, rgba(241, 114, 38, 0.1), rgba(241, 114, 38, 0.02));
    --menu-hover-glow: rgba(241, 114, 38, 0.06);
    --header-glow-line: linear-gradient(90deg, #F17226, #E8282B, #6366f1);
}

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

html,
body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden !important;
    max-width: 100%;
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
}

#app-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
    z-index: -1;
}

#app-bg::before,
#app-bg::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    animation: float 22s infinite alternate;
}

#app-bg::before {
    width: 500px;
    height: 500px;
    background: rgba(99, 102, 241, 0.2);
    top: -10%;
    left: -5%;
}

#app-bg::after {
    width: 600px;
    height: 600px;
    background: rgba(16, 185, 129, 0.12);
    bottom: -15%;
    right: -5%;
    animation-delay: -11s;
}

@keyframes float {
    0% {
        transform: translate(0, 0)
    }

    100% {
        transform: translate(40px, 40px)
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* ===== TOP STEPS BAR (ĐÃ XÓA) ===== */
/* Phần tử .top-steps đã được xóa khỏi HTML, CSS dưới đây chỉ để tương thích ngược */
.top-steps {
    display: none !important;
}

.header-woo-config {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.header-woo-config.admin-nav-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-nav {
    display: none;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.admin-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #cbd5e1;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.admin-nav-link i {
    color: #93c5fd;
    font-size: 0.85rem;
}

.admin-nav-link:hover {
    color: #ffffff;
    border-color: rgba(129, 140, 248, 0.45);
    background: rgba(99, 102, 241, 0.15);
}

.admin-nav-link.active {
    color: #ffffff;
    border-color: rgba(129, 140, 248, 0.75);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.34), rgba(79, 70, 229, 0.2));
    box-shadow: 0 10px 26px rgba(79, 70, 229, 0.2), inset 0 0 0 1px rgba(199, 210, 254, 0.15);
}

.admin-nav-link.active i {
    color: #dbeafe;
}

@media (max-width: 1100px) {
    .header-woo-config.admin-nav-wrap {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .admin-nav {
        width: 100%;
        justify-content: stretch;
        gap: 6px;
    }

    .admin-nav-link {
        flex: 1 1 calc(50% - 6px);
        justify-content: center;
        text-align: center;
    }
}

#btn-woo-config {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    border-radius: 8px;
    padding: 0 12px;
    gap: 8px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    cursor: pointer;
    max-width: 280px;
}

#btn-woo-config:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

#btn-woo-config .wp-host-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

#btn-woo-config .wp-icon-wrap {
    position: relative;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#btn-woo-config .wp-icon-wrap i {
    font-size: 1rem;
    line-height: 1;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.offline {
    background: #ef4444;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.6);
}

.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.6);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

.woo-host-badge {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
    pointer-events: none;
    /* Allow clicks to pass through to the button */
    opacity: 0;
    visibility: hidden;
}

.woo-host-badge.active {
    opacity: 1;
    visibility: visible;
}

.woo-config-popup {
    border-radius: 10px;
    z-index: 200;
}

.woo-config-panel {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    width: 360px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease-out;
}

.woo-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.woo-config-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-mini {
    font-weight: 700;
    font-size: 1.1rem;
    color: #818cf8;
    white-space: nowrap;
}

.logo-mini i {
    margin-right: 6px;
}

/* ===== STEPS BAR REDESIGN ===== */
.steps-horizontal {
    list-style: none;
    display: flex;
    gap: 2px;
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    /* wrapper nền mờ */
    border: 1px solid var(--glass-border);
    border-radius: 99px;
    /* bo tròn pill-style */
    padding: 4px;
    margin: 0 12px;
    max-width: 700px;
}

[data-theme="light"] .steps-horizontal {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}

.step-h {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 16px;
    border-radius: 99px;
    /* pill cho từng step */
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: default;
    transition: var(--transition);
    white-space: nowrap;
    flex: 1;
    justify-content: center;
}

.step-h .step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.73rem;
    font-weight: 700;
    background: var(--glass-border);
    /* dùng variable thay vì giá trị cứng */
    color: var(--text-muted);
    transition: var(--transition);
    flex-shrink: 0;
}

.step-h.active {
    background: rgba(99, 102, 241, 0.18);
    color: var(--text-main);
    /* sáng/tối tự động */
    font-weight: 600;
}

/* Light mode override riêng cho active text */
[data-theme="light"] .step-h.active {
    background: rgb(255 242 207);
    /* indigo tối, đọc rõ trên nền sáng */
}

.step-h.active .step-num {
    background: var(--primary);
    color: white;
}

.step-h.completed {
    color: var(--success);
}

[data-theme="light"] .step-h.completed {
    color: #059669;
    /* xanh đậm hơn trong light mode */
}

.step-h.completed .step-num {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

/* Inactive step - light mode: num rõ hơn */
[data-theme="light"] .step-h:not(.active):not(.completed) .step-num {
    background: rgba(0, 0, 0, 0.08);
    color: #64748b;
}

/* ===== MAIN LAYOUT ===== */
.main-full {
    padding: 0;
}

.step-content {
    animation: fadeIn 0.35s ease-out;
}

.step-content.hidden {
    display: none;
}

.step-inner.narrow {
    max-width: 900px;
    margin: 0 auto;
    padding: 0px 0px 10px 0px;
}

.step-inner.full {
    padding: 16px 20px;
}

/* ===== SHARED COMPONENTS ===== */
.header-area {
    margin-bottom: 24px;
}

.header-area h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-area h1 i {
    margin-right: 8px;
    color: var(--primary);
}

.header-area p {
    color: var(--text-muted);
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-4 {
    margin-top: 16px;
}

.hidden {
    display: none !important;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-info {
    color: #38bdf8;
}

.justify-end {
    display: flex;
    justify-content: flex-end;
}

.space-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.25s ease;
    min-width: 0;
    box-sizing: border-box;
    width: 100%;
}

[data-theme="light"] .card {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.01));
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* ===== GLASS FILL UTILITY CLASSES =====
   Kiểu đổ nền gradient mờ premium — dùng class này cho bất kỳ box nào
   Cách sử dụng: <div class="card glass-fill-orange">...</div>
   ===== */

/* Cam (brand) */
.glass-fill-orange {
    background: linear-gradient(135deg, rgba(241, 114, 38, 0.18), rgba(241, 114, 38, 0.05)) !important;
    border-color: rgba(241, 114, 38, 0.15) !important;
    box-shadow: 0 2px 12px rgba(241, 114, 38, 0.1);
}

/* Đỏ */
.glass-fill-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(239, 68, 68, 0.05)) !important;
    border-color: rgba(239, 68, 68, 0.15) !important;
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.1);
}

/* Xanh lá */
.glass-fill-green {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0.05)) !important;
    border-color: rgba(16, 185, 129, 0.15) !important;
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.1);
}

/* Xanh dương */
.glass-fill-blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.05)) !important;
    border-color: rgba(59, 130, 246, 0.15) !important;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.1);
}

/* Tím */
.glass-fill-purple {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(168, 85, 247, 0.05)) !important;
    border-color: rgba(168, 85, 247, 0.15) !important;
    box-shadow: 0 2px 12px rgba(168, 85, 247, 0.1);
}

/* Indigo */
.glass-fill-indigo {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(99, 102, 241, 0.05)) !important;
    border-color: rgba(99, 102, 241, 0.15) !important;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.1);
}

/* Vàng */
.glass-fill-yellow {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.05)) !important;
    border-color: rgba(245, 158, 11, 0.15) !important;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.1);
}

/* Cyan / Xanh ngọc */
.glass-fill-cyan {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(6, 182, 212, 0.05)) !important;
    border-color: rgba(6, 182, 212, 0.15) !important;
    box-shadow: 0 2px 12px rgba(6, 182, 212, 0.1);
}

/* Light mode: kết hợp nền trắng và gradient màu nhẹ lên trên */
[data-theme="light"] .glass-fill-orange {
    background: linear-gradient(135deg, rgba(241, 114, 38, 0.1), rgba(241, 114, 38, 0.03)), #ffffff !important;
    border-color: rgba(241, 114, 38, 0.18) !important;
    box-shadow: 0 2px 8px rgba(241, 114, 38, 0.06);
}

[data-theme="light"] .glass-fill-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.03)), #ffffff !important;
    border-color: rgba(239, 68, 68, 0.18) !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.06);
}

[data-theme="light"] .glass-fill-green {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.03)), #ffffff !important;
    border-color: rgba(16, 185, 129, 0.18) !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.06);
}

[data-theme="light"] .glass-fill-blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.03)), #ffffff !important;
    border-color: rgba(59, 130, 246, 0.18) !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.06);
}

[data-theme="light"] .glass-fill-purple {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(168, 85, 247, 0.03)), #ffffff !important;
    border-color: rgba(168, 85, 247, 0.18) !important;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.06);
}

[data-theme="light"] .glass-fill-indigo {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.03)), #ffffff !important;
    border-color: rgba(99, 102, 241, 0.18) !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.06);
}

[data-theme="light"] .glass-fill-yellow {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.03)), #ffffff !important;
    border-color: rgba(245, 158, 11, 0.18) !important;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.06);
}

[data-theme="light"] .glass-fill-cyan {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(6, 182, 212, 0.03)), #ffffff !important;
    border-color: rgba(6, 182, 212, 0.18) !important;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.06);
}

/* Base White / Trong suốt trung tính */
.glass-fill-white {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
}

/* Light mode: box trắng thuần hoặc rất nhẹ */
[data-theme="light"] .glass-fill-white {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

/* ============================================================
   KPI TOP ROW RESPONSIVE GRID
   ============================================================ */
.kpi-top-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 991px) {
    .kpi-top-row {
        gap: 16px;
    }
}

@media (max-width: 576px) {
    .kpi-top-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   KPI ICON WRAP (Responsive background based on theme)
   ============================================================ */
.kpi-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.15);
    /* Dark mode base */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.3s ease;
}

/* Light mode icon wrapper backgrounds (colored based on parent box type) */
[data-theme="light"] .glass-fill-orange .kpi-icon-wrap {
    background: rgba(249, 115, 22, 0.15);
}

[data-theme="light"] .glass-fill-green .kpi-icon-wrap {
    background: rgba(16, 185, 129, 0.15);
}

[data-theme="light"] .glass-fill-yellow .kpi-icon-wrap {
    background: rgba(234, 179, 8, 0.15);
}

[data-theme="light"] .glass-fill-indigo .kpi-icon-wrap {
    background: rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .glass-fill-cyan .kpi-icon-wrap {
    background: rgba(6, 182, 212, 0.15);
}

[data-theme="light"] .glass-fill-blue .kpi-icon-wrap {
    background: rgba(59, 130, 246, 0.15);
}

[data-theme="light"] .glass-fill-red .kpi-icon-wrap {
    background: rgba(239, 68, 68, 0.15);
}

[data-theme="light"] .glass-fill-purple .kpi-icon-wrap {
    background: rgba(168, 85, 247, 0.15);
}

.card h3 {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1rem;
}

.input-group {
    margin-bottom: 12px !important;
}

.input-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Input: dùng CSS variable cho đồng bộ giữa dark/light */
.input-group input,
.input-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.input-group input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

.help-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Upload */
.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 48px 32px;
    text-align: center;
    background: rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    margin-bottom: 24px;
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.upload-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.upload-area h3 {
    font-size: 1.15rem;
    margin-bottom: 6px;
}

.upload-area p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 6px;
    letter-spacing: 0.2px;
}

.badge.bg-primary {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge.bg-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.bg-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="light"] .badge.bg-primary {
    background: #e0e7ff;
    color: #4338ca;
    border-color: #c7d2fe;
}

[data-theme="light"] .badge.bg-success {
    background: #d1fae5;
    color: #047857;
    border-color: #a7f3d0;
}

[data-theme="light"] .badge.bg-warning {
    background: #fef3c7;
    color: #b45309;
    border-color: #fde68a;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
    border-radius: 6px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:not(:disabled):hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-create-new {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
    color: white !important;
}

.btn-create-new:not(:disabled):hover {
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4) !important;
    transform: translateY(-1px);
}

/* .btn-secondary: dùng variable để đáp ứng tốt cả dark/light */
.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-color);
    border: 1px solid var(--btn-secondary-border);
}

.btn-secondary:not(:disabled):hover {
    background: var(--hover-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:not(:disabled):hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:not(:disabled):hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:not(:disabled):hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--hover-bg);
}

/* Light mode override cho woo-config-panel: tránh nền đen */
[data-theme="light"] .woo-config-panel {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
    color: #0f172a;
}

[data-theme="light"] .woo-config-panel label {
    color: #374151;
}

[data-theme="light"] .woo-advanced-row {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 10px 14px;
}

[data-theme="light"] .woo-advanced-label {
    color: #1e293b;
    font-weight: 600;
}

[data-theme="light"] #btn-woo-config {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
    color: #4f46e5;
}

[data-theme="light"] #btn-woo-config:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
}

.btn-icon-only {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 0.95rem;
}

.btn-icon-only:hover {
    color: var(--text-main);
    background: var(--hover-bg);
}

.btn-icon-only.danger:hover {
    color: var(--danger);
}

.btn-icon-link {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon-link:hover {
    opacity: 0.75;
    transform: scale(1.05);
}

/* ===== MAPPING (Redesigned) ===== */
.mapping-container {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.mapping-header-row {
    display: grid;
    grid-template-columns: 200px 32px 1fr 32px;
    gap: 8px;
    align-items: center;
    padding: 0 8px 12px;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 10px;
}

.mapping-header-row i {
    margin-right: 6px;
}

.mapping-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: calc(100vh - 480px);
    /* Giới hạn chiều cao an toàn trên màn hình */
    min-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
    /* Offset cho scrollbar */
}

/* Tùy chỉnh thanh cuộn cho mapping list đẹp hơn */
.mapping-list::-webkit-scrollbar {
    width: 6px;
}

.mapping-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}

[data-theme="light"] .mapping-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

/* Mapping Row */
.mrow {
    display: grid;
    grid-template-columns: 200px 32px 1fr 32px;
    gap: 8px;
    align-items: center;
    padding: 10px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(15, 23, 42, 0.25);
    transition: var(--transition);
}

.mrow:hover {
    border-color: rgba(99, 102, 241, 0.2);
    background: rgba(15, 23, 42, 0.4);
}

/* Left: WooCommerce label */
.mrow-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
}

.mrow-icon {
    color: var(--primary);
    font-size: 0.8rem;
    width: 18px;
    text-align: center;
}

.mrow-req {
    color: var(--danger);
    font-size: 0.75rem;
    margin-left: 2px;
}

/* Arrow */
.mrow-arrow {
    color: rgba(255, 255, 255, 0.15);
    font-size: 0.7rem;
    text-align: center;
}

/* Right: Excel chips area */
.mrow-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    position: relative;
}

.mrow-chips {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
    min-height: 30px;
    align-items: center;
}

.mrow-empty {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.82rem;
    font-style: italic;
}

/* Excel column chip */
.excel-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: default;
    transition: var(--transition);
}

.excel-chip:hover {
    background: rgba(16, 185, 129, 0.2);
}

.chip-remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-size: 0.65rem;
    padding: 1px;
    border-radius: 3px;
    transition: var(--transition);
}

.chip-remove:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Add column button */
.mrow-add-col {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.mrow-add-col:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

/* Separator input */
.mrow-sep {
    width: 40px;
    padding: 4px 6px;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
    border-radius: 6px;
    font-family: monospace;
    transition: var(--transition);
}

.mrow-sep:focus {
    outline: none;
    border-color: #fbbf24;
    background: rgba(245, 158, 11, 0.25);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

[data-theme="light"] .mrow-sep {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #d97706;
}

/* Remove button */
.mrow-remove {
    flex-shrink: 0;
}

/* Excel dropdown */
.excel-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 50;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 6px;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.15s ease-out;
}

.excel-dd-item {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    color: white;
}

.excel-dd-item:hover {
    background: rgba(99, 102, 241, 0.12);
}

.excel-dd-item.used {
    color: rgba(255, 255, 255, 0.25);
    cursor: default;
    text-decoration: line-through;
}

.excel-dd-item.used:hover {
    background: transparent;
}

/* Column preview popup */
.col-preview-popup {
    position: fixed;
    z-index: 200;
    background: #0f172a;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    padding: 10px;
    min-width: 200px;
    max-width: 320px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.12s ease-out;
    pointer-events: none;
}

.cpop-header {
    font-size: 0.82rem;
    font-weight: 600;
    color: #818cf8;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 4px;
}

.cpop-row {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cpop-idx {
    display: inline-block;
    width: 18px;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.7rem;
    margin-right: 4px;
}

/* Light mode override cho column preview popup */
[data-theme="light"] .col-preview-popup {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .cpop-header {
    color: #4f46e5;
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .cpop-row {
    color: #475569;
}

[data-theme="light"] .cpop-idx {
    color: rgba(0, 0, 0, 0.35);
}

/* Variation Management Box */
.var-mng-box {
    margin-top: 22px;
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 12px;
    overflow: hidden;
}

.var-mng-header {
    padding: 12px 18px;
    background: rgba(99, 102, 241, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.var-mng-title {
    font-weight: 700;
    color: #818cf8;
    font-size: 14px;
}

.var-mng-count {
    font-weight: 400;
    color: #94a3b8;
    font-size: 12px;
    margin-left: 8px;
}

.var-mng-th {
    background: rgba(15, 23, 42, 0.5);
    font-size: 0.82rem;
    color: #64748b;
}

.var-mng-tr {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.88rem;
}

.var-mng-tr.even {
    background: rgba(15, 23, 42, 0.2);
}

.var-mng-tr.odd {
    background: transparent;
}

.var-attr-name {
    font-weight: 600;
    color: #e2e8f0;
}

.var-code-chip {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: 500;
}

.var-sample-chip {
    display: inline-block;
    background: rgba(15, 23, 42, 0.6);
    color: #cbd5e1;
    font-size: 0.75rem;
    border-radius: 6px;
    padding: 3px 8px;
    margin: 2px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.var-note-box {
    padding: 10px 16px 12px;
    font-size: 12px;
    color: #64748b;
    background: rgba(15, 23, 42, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Light mode for Variation Management Box */
[data-theme="light"] .var-mng-box {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .var-mng-header {
    background: rgba(99, 102, 241, 0.08);
}

[data-theme="light"] .var-mng-title {
    color: #4f46e5;
}

[data-theme="light"] .var-mng-count {
    color: #64748b;
}

[data-theme="light"] .var-mng-th {
    background: #f8fafc;
    color: #475569;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .var-mng-tr {
    border-top-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .var-mng-tr.even {
    background: #f1f5f9;
}

[data-theme="light"] .var-mng-tr.odd {
    background: transparent;
}

[data-theme="light"] .var-attr-name {
    color: #1e293b;
}

[data-theme="light"] .var-code-chip {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    font-weight: 600;
}

[data-theme="light"] .var-sample-chip {
    background: #ffffff;
    color: #64748b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .var-note-box {
    background: #f8fafc;
    border-top-color: rgba(0, 0, 0, 0.05);
    color: #475569;
}

/* Add hidden field row */
.mapping-add-hidden {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    margin-top: 6px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.mapping-add-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

.mapping-add-label i {
    margin-right: 4px;
    color: var(--primary);
}

.mapping-hidden-select {
    flex: 1;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
}

/* ===== GRID TOOLBAR ===== */
.grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.toolbar-left h2 {
    font-size: 1.15rem;
    font-weight: 600;
    white-space: nowrap;
}

.toolbar-left h2 i {
    color: var(--primary);
    margin-right: 6px;
}

#grid-summary {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

#grid-summary .sum-badge {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.toolbar-select {
    padding: 7px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
}

/* ===== BULK ACTION BAR ===== */
.bulk-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.bulk-bar span {
    font-weight: 600;
    font-size: 0.9rem;
    color: #818cf8;
}

/* ===== DATA TABLE (Compact) ===== */
.table-container {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    max-height: calc(100vh - 280px);
    overflow: auto;
}

.data-grid.compact {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    font-size: 0.85rem;
    table-layout: fixed;
}

.data-grid.compact th,
.data-grid.compact td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.data-grid.compact td.actions-cell {
    overflow: visible;
}

.data-grid.compact th {
    background: rgba(0, 0, 0, 0.4);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 10;
    resize: horizontal;
}

.data-grid.compact th:first-child,
.data-grid.compact th:last-child {
    resize: none;
}

/* Header action button (e.g. discount icon) */
.th-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #f59e0b;
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: var(--transition);
    vertical-align: middle;
    margin-left: 2px;
}

.th-action-btn:hover {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

/* Radio card for discount modal */
.radio-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.88rem;
    color: var(--text-muted);
    transition: var(--transition);
    flex: 1;
}

.radio-card:has(input:checked) {
    border-color: var(--primary);
    color: white;
    background: rgba(99, 102, 241, 0.1);
}

.radio-card input {
    accent-color: var(--primary);
}

.data-grid.compact tbody tr {
    transition: background 0.15s;
}

.data-grid.compact tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.data-grid.compact tbody tr.selected {
    background: rgba(99, 102, 241, 0.08) !important;
}

.data-grid.compact tbody tr.drag-over {
    border-top: 2px solid var(--primary);
}

/* Thumbnail & Image cell */
.img-cell {
    padding: 4px !important;
}

.img-wrapper {
    width: 40px;
    height: 40px;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
}

.thumb-img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.3);
    display: block;
}

.thumb-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.15);
    font-size: 0.9rem;
}

/* Click to open popup overlay */
.img-wrapper:hover {
    opacity: 0.85;
    transition: opacity 0.15s;
}

/* Editable cells */
.editable-cell {
    cursor: pointer;
    border-radius: 3px;
    transition: var(--transition);
    position: relative;
}

.editable-cell:hover {
    background: rgba(99, 102, 241, 0.06);
}

.editable-cell.locked {
    cursor: default;
}

.editable-cell.locked:hover {
    background: transparent;
}

.editing input {
    width: 100%;
    min-width: 60px;
    background: #0f172a;
    color: white;
    border: 1px solid var(--primary);
    padding: 3px 6px;
    border-radius: 4px;
    outline: none;
    font-size: 0.85rem;
}

#btn-woo-config #woo-status-dot {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 11px;
    height: 11px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.grid-html-preview {
    white-space: normal;
    line-height: 1.45;
    font-size: 0.8rem;
    max-height: 94px;
    overflow: auto;
    padding-right: 2px;
}

.grid-html-preview.short {
    max-height: 70px;
}

.grid-html-preview.long {
    max-height: 100px;
}

.grid-html-preview p,
.grid-html-preview ul,
.grid-html-preview ol,
.grid-html-preview blockquote,
.grid-html-preview table {
    margin: 0 0 6px 0;
}

.grid-html-preview p:last-child,
.grid-html-preview ul:last-child,
.grid-html-preview ol:last-child,
.grid-html-preview blockquote:last-child,
.grid-html-preview table:last-child {
    margin-bottom: 0;
}

.grid-html-preview ul,
.grid-html-preview ol {
    padding-left: 18px;
}

.grid-html-preview table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.grid-html-preview th,
.grid-html-preview td {
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 3px 5px;
    font-size: 0.75rem;
    white-space: normal;
}

.edit-product-modal-panel {
    width: 780px;
    max-width: 94vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.edit-product-form-grid {
    display: grid;
    gap: 12px;
    overflow-y: auto;
    padding: 0;
    padding-right: 8px;
}

.edit-field-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.edit-field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
    color: #94a3b8;
}

.edit-ai-btn {
    padding: 3px 10px !important;
    font-size: 0.72rem !important;
}

.edit-field-input {
    width: 100%;
    padding: 9px 10px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    font-family: inherit;
}

.edit-field-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.7);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.rich-editor-box {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.35);
}

.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(2, 6, 23, 0.55);
}

.rich-tool-btn {
    min-width: 30px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.75);
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.rich-tool-btn:hover {
    border-color: rgba(129, 140, 248, 0.7);
    color: #eef2ff;
    background: rgba(99, 102, 241, 0.22);
}

.rich-editor-area {
    min-height: 120px;
    max-height: 260px;
    overflow-y: auto;
    padding: 10px 12px;
    color: #f8fafc;
    font-size: 0.86rem;
    line-height: 1.55;
    outline: none;
    white-space: normal;
}

.rich-editor-area:focus {
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.65);
}

.rich-editor-area p,
.rich-editor-area ul,
.rich-editor-area ol,
.rich-editor-area blockquote,
.rich-editor-area table {
    margin: 0 0 10px 0;
}

.rich-editor-area ul,
.rich-editor-area ol {
    padding-left: 18px;
}

.rich-editor-area table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.rich-editor-area th,
.rich-editor-area td {
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 6px 8px;
    vertical-align: top;
}

/* Cell clear btn */
.cell-clear {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 3px;
    display: none;
}

.editable-cell:hover .cell-clear {
    display: block;
}

.cell-clear:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Action column */
.actions-cell {
    text-align: right;
    white-space: nowrap;
}

/* Drag handle */
.drag-handle {
    cursor: grab;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
    padding: 4px;
}

.drag-handle:hover {
    color: rgba(255, 255, 255, 0.5);
}

.drag-handle:active {
    cursor: grabbing;
}

/* Type badges */
.type-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.type-simple {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
}

.type-variable {
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
}

.type-variation {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
}

/* Row styles */
.row-variable {
    border-left: 3px solid #6366f1;
}

.row-variation {
    border-left: 3px solid rgba(16, 185, 129, 0.4);
}

/* Checkbox */
.row-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ===== IMPORT TERMINAL ===== */
.progress-box {
    margin-bottom: 20px;
}

.progress-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
    font-weight: 500;
}

.progress-bar-container {
    height: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a78bfa);
    border-radius: 5px;
    transition: width 0.3s;
}

.progress-text {
    text-align: right;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.terminal-container {
    background: #000;
    border-radius: 8px;
    border: 1px solid #222;
    overflow: hidden;
    font-family: 'Courier New', monospace;
}

.terminal-header {
    background: #111;
    padding: 6px 14px;
    font-size: 0.8rem;
    color: #666;
    border-bottom: 1px solid #222;
}

.terminal-body {
    padding: 12px;
    height: 280px;
    overflow-y: auto;
}

.log-line {
    margin-bottom: 3px;
    font-size: 0.82rem;
    line-height: 1.3;
}

/* Image count badge */
.img-count-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    line-height: 1.2;
}

/* ===== MODAL / POPUP ===== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-panel {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    padding: 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.modal-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    background: rgba(99, 102, 241, 0.08);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.modal-hint i {
    margin-right: 4px;
    color: var(--primary);
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Image Gallery */
.img-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
    min-height: 40px;
}

.img-empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 24px;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
}

.img-empty i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 6px;
}

.gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: var(--transition);
}

.gallery-item.featured {
    border-color: #f59e0b;
}

.gallery-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

.gallery-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 6px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
}

.gallery-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.85);
    color: #fff;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    white-space: nowrap;
}

.gallery-badge.album {
    background: rgba(99, 102, 241, 0.85);
    color: #fff;
}

.gallery-remove {
    font-size: 0.7rem !important;
    padding: 2px !important;
}

/* Add image area */
.img-add-area {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.img-url-input {
    flex: 1;
    padding: 9px 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.88rem;
    transition: var(--transition);
}

.img-url-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.img-url-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.img-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

/* Search results */
.popup-search-result {
    margin-bottom: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.search-loading {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 10px;
}

.search-loading i {
    margin-right: 6px;
}

.search-found {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-preview {
    width: 120px;
    height: 80px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.search-found-actions p {
    color: var(--success);
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.search-notfound {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.search-notfound i {
    margin-right: 4px;
}

.search-notfound button {
    margin: 8px 0;
}

.search-tip {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 6px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* ===== STEP 4 IMPORT UI ===== */
.progress-box {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    text-align: center;
}

.progress-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 20px;
}

.progress-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 1.8rem;
    font-weight: 700;
}

.progress-stats .stat i {
    font-size: 1.4rem;
}

.progress-stats .stat span {
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
}

.progress-stats .stat:nth-child(1) span {
    color: var(--success);
}

.progress-stats .stat:nth-child(2) span {
    color: var(--danger);
}

.progress-stats .stat:nth-child(3) span {
    color: var(--primary);
}

.progress-bar-container {
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    border-radius: 10px;
    transition: width 0.4s ease-out;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progress-shine 1.5s infinite;
}

@keyframes progress-shine {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-base);
}

.terminal-container {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 24px;
}

.terminal-header {
    background: #1e293b;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-header::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 16px 0 0 #f59e0b, 32px 0 0 #10b981;
    margin-right: 28px;
}

.terminal-body {
    height: 350px;
    overflow-y: auto;
    padding: 16px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

.log-line {
    margin-bottom: 4px;
    word-break: break-all;
}

.log-line.text-info {
    color: #38bdf8;
}

.log-line.text-success {
    color: #34d399;
}

.log-line.text-danger {
    color: #f87171;
}

.log-line.text-warning {
    color: #fbbf24;
}

/* Error Row */
tr.row-error td {
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-bottom: 1px solid rgba(239, 68, 68, 0.4) !important;
}

tr.row-error input.edit-input {
    border: 1px solid rgba(239, 68, 68, 0.8) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Custom Alert Modal - Redesigned */
.custom-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease-out;
}

.custom-alert-overlay.show {
    opacity: 1;
    visibility: visible;
}

.custom-alert-box {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-top: 3px solid #f59e0b;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    padding: 0;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    position: relative;
    transform: translateY(20px) scale(0.95);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.custom-alert-overlay.show .custom-alert-box {
    transform: translateY(0) scale(1);
}

.custom-alert-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.custom-alert-close:hover {
    color: var(--text-main);
    background: rgba(239, 68, 68, 0.2);
}

.custom-alert-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 24px 0;
}

.custom-alert-header i {
    font-size: 1.5rem;
    color: #f59e0b;
}

.custom-alert-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.custom-alert-body {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-muted);
    padding: 16px 24px;
}

.custom-alert-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0 24px 20px;
}

.custom-alert-footer .btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 10px 24px;
}

/* Scroll wrap in datagrid */
.val-scroll-wrap {
    display: inline-block;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    vertical-align: middle;
}

.val-scroll-txt {
    display: inline-block;
}

/* ===== Modal System ===== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-panel {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.modal-hint {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.82rem;
    color: #94a3b8;
    margin-bottom: 12px;
}

.modal-hint i {
    color: #6366f1;
    margin-right: 4px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===== Image Gallery in Popup ===== */
.img-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 80px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 12px;
}

.img-empty {
    width: 100%;
    text-align: center;
    padding: 24px;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
}

.img-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.gallery-item {
    position: relative;
    width: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: grab;
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.3);
}

.gallery-item:active {
    cursor: grabbing;
}

.gallery-item.featured {
    border-color: #f59e0b;
}

.gallery-item.drag-over {
    border-color: #6366f1;
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    display: block;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.gallery-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.5);
}

.gallery-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.85);
    color: #fff;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    white-space: nowrap;
}

.gallery-badge.album {
    background: rgba(99, 102, 241, 0.85);
    color: #fff;
}

.gallery-remove {
    font-size: 0.65rem !important;
    padding: 2px !important;
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-item:hover .gallery-remove {
    opacity: 1;
}

/* Image add area */
.img-add-area {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.img-url-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    font-size: 0.85rem;
}

.img-url-input:focus {
    border-color: var(--primary);
    outline: none;
}

.img-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

/* Search result */
.popup-search-result {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.search-loading {
    color: #94a3b8;
    font-size: 0.85rem;
}

.search-loading i {
    margin-right: 6px;
}

.search-found {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-preview {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.search-found-actions p {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 6px;
}

.search-notfound {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #94a3b8;
}

.search-tip {
    width: 100%;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 4px;
}

/* ===== Lightbox ===== */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
    animation: fadeIn 0.2s ease-out;
}

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ===== Resize Modal (Enhanced) ===== */
.resize-tabs {
    display: flex;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 16px;
}

.resize-tab {
    flex: 1;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.resize-tab:hover {
    background: rgba(99, 102, 241, 0.08);
    color: #c7d2fe;
}

.resize-tab.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.15));
    color: white;
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--primary);
}

.resize-tab-content {
    display: none;
}

.resize-tab-content.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

/* Template Cards */
.resize-templates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 6px;
}

.resize-tpl-card {
    background: rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.25s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.resize-tpl-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}

.resize-tpl-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.resize-tpl-card:hover::before {
    opacity: 1;
}

.resize-tpl-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3), 0 4px 16px rgba(99, 102, 241, 0.15);
}

.resize-tpl-card.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 10px;
    color: var(--primary);
    font-size: 0.75rem;
    background: rgba(99, 102, 241, 0.2);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resize-tpl-icon {
    font-size: 1.6rem;
    margin-bottom: 8px;
    display: block;
    position: relative;
    z-index: 1;
}

.resize-tpl-name {
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 3px;
    color: white;
    position: relative;
    z-index: 1;
}

.resize-tpl-size {
    font-size: 0.75rem;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

/* Custom Dimension Controls */
.resize-dim-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.resize-dim-field {
    flex: 1;
}

.resize-dim-field label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.resize-dim-field input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.resize-dim-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.resize-link-btn {
    margin-top: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.resize-link-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.resize-link-btn.linked {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.2);
}

/* Padding Slider */
.resize-padding-row {
    margin-bottom: 16px;
}

.resize-padding-row label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.resize-padding-row label span {
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.resize-slider {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
    transition: background 0.2s;
}

.resize-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
    transition: transform 0.15s;
}

.resize-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.resize-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

/* Background Section */
.resize-bg-section {
    margin-bottom: 16px;
}

.resize-bg-section>label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.resize-bg-options {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.resize-bg-opt {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.78rem;
    font-family: inherit;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.resize-bg-opt:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.resize-bg-opt.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
    color: white;
}

.resize-bg-config {
    padding: 10px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.resize-bg-config .color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.resize-bg-config .color-picker-row input[type="color"] {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    padding: 2px;
    background: transparent;
    flex-shrink: 0;
}

.resize-bg-config .hex-input {
    width: 100px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 7px 10px;
    color: white;
    font-size: 0.82rem;
    font-family: 'Consolas', monospace;
}

.resize-bg-config .hex-input:focus {
    outline: none;
    border-color: var(--primary);
}

.resize-bg-config .color-swatch-row {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.resize-bg-config .color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.resize-bg-config .color-swatch:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.resize-bg-config .color-swatch.active {
    border-color: white;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

/* Gradient controls */
.resize-gradient-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.resize-gradient-row input[type="color"] {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    background: transparent;
    flex-shrink: 0;
}

.resize-gradient-row select {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 7px 10px;
    color: white;
    font-size: 0.82rem;
    font-family: inherit;
}

.resize-gradient-preview {
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 6px;
}

/* Preview Area */
.resize-preview-area {
    margin-top: 14px;
    text-align: center;
}

.resize-preview-area .preview-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.resize-preview-area .preview-label .preview-dims {
    background: rgba(99, 102, 241, 0.15);
    color: #a78bfa;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.resize-preview-area canvas {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    max-width: 100%;
    max-height: 240px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Result View */
.resize-result-view {
    text-align: center;
    padding: 10px 0;
}

.resize-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin: 14px 0;
    max-height: 360px;
    overflow-y: auto;
    padding: 4px;
}

.resize-result-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
}

.resize-result-item:hover {
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateY(-1px);
}

.resize-result-item canvas {
    width: 100%;
    aspect-ratio: var(--result-ratio, 1);
    display: block;
    cursor: pointer;
}

.resize-result-item .result-name {
    padding: 6px 8px;
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.resize-result-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 0.88rem;
    font-weight: 500;
}

.resize-result-status.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.resize-result-status.processing {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #a78bfa;
}

/* Resize field general */
.resize-field label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.resize-field input,
.resize-field select {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    font-size: 0.85rem;
}

.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker-wrap input[type="color"] {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: transparent;
}

.color-picker-wrap span {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* WP Domain Config Button */
#btn-woo-config {
    transition: all 0.2s ease;
}

#btn-woo-config.has-domain {
    width: auto;
    padding: 8px 14px 8px 12px;
    gap: 8px;
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(99, 102, 241, 0.34);
}

#btn-woo-config #woo-status-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
}

/* Template Download Dropdown */
.template-dropdown {
    position: relative;
}

.template-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--sidebar-bg);
    /* dùng variable thay vì #1e293b cứng */
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    width: 240px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: fadeIn 0.2s ease-out;
}

/* Light mode: nền trắng, shadow nhẹ */
[data-theme="light"] .template-menu {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.template-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.template-menu a:hover {
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
}

[data-theme="light"] .template-menu a:hover {
    background: rgba(99, 102, 241, 0.08);
    color: #4f46e5;
}

.template-menu a i {
    color: var(--success);
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

/* ===== PATH INPUT GROUP ===== */
.path-input-group {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0 12px;
    min-height: 48px;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 0.95rem;
    color: #94a3b8;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.path-input-group:focus-within {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.path-input-group span {
    white-space: nowrap;
    user-select: none;
}

.path-input-group .path-segment-input {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.5);
    border-radius: 4px;
    color: #fff;
    padding: 2px 6px;
    margin: 0 2px;
    min-width: 30px;
    width: auto;
    max-width: 150px;
    text-align: center;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-weight: 600;
    outline: none;
    transition: all 0.2s;
}

.path-input-group .path-segment-input:focus {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.path-input-group .path-segment-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.woo-advanced-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.woo-advanced-switch.active {
    background: rgba(16, 185, 129, 0.7);
}

.woo-advanced-switch.active::after {
    transform: translateX(20px);
}

.woo-advanced-row {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.woo-advanced-switch {
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: var(--border);
    position: relative;
    transition: background 0.2s ease;
    background-color: #cfd3d9;
}

.woo-advanced-row .woo-advanced-label {
    font-size: 0.95rem;
    font-weight: 600;
}

.woo-advanced-toggle {
    background: transparent;
    border-radius: 99px;
    padding: 0;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

/* =========================================================
   LIGHT MODE SPECIFIC OVERRIDES 
   (Sửa lỗi chữ bị ẩn do hardcode color: white)
   ========================================================= */

[data-theme="light"] .admin-card-header h2 {
    color: var(--text-main) !important;
}

[data-theme="light"] .admin-table th {
    color: var(--text-muted) !important;
}

[data-theme="light"] .admin-table td {
    color: var(--text-main) !important;
}

[data-theme="light"] .service-card h1,
[data-theme="light"] .service-card h2,
[data-theme="light"] .detail-item strong {
    color: var(--text-main) !important;
}

[data-theme="light"] .service-subtitle,
[data-theme="light"] .detail-item label {
    color: var(--text-muted) !important;
}

[data-theme="light"] .search-row input,
[data-theme="light"] .expiry-editor input[type="date"] {
    color: var(--text-main) !important;
}

[data-theme="light"] .qcard-title {
    color: var(--text-main) !important;
}

[data-theme="light"] .post-card h3 {
    color: var(--text-main) !important;
}

[data-theme="light"] .post-excerpt {
    color: var(--text-muted) !important;
}

[data-theme="light"] .qcard-actions {
    color: var(--text-muted) !important;
}

[data-theme="light"] .idea-title {
    color: var(--text-main) !important;
}

[data-theme="light"] .idea-desc {
    color: var(--text-muted) !important;
}

[data-theme="light"] .modal-body {
    background: var(--glass-bg) !important;
}

/* Modal popup hỗ trợ chế độ sáng */
[data-theme="light"] .modal-panel {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%) !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15) !important;
    color: #1e293b !important;
}

[data-theme="light"] .modal-panel h3,
[data-theme="light"] .modal-panel h2,
[data-theme="light"] .modal-header h3 {
    color: #1e293b !important;
}

[data-theme="light"] .modal-panel .modal-subtitle {
    color: #64748b !important;
}

[data-theme="light"] .modal-panel .modal-hint {
    color: #64748b !important;
    background: #f1f5f9 !important;
}

[data-theme="light"] .modal-panel input[type="text"],
[data-theme="light"] .modal-panel input[type="url"],
[data-theme="light"] .modal-panel input[type="number"],
[data-theme="light"] .modal-panel input[type="password"],
[data-theme="light"] .modal-panel textarea,
[data-theme="light"] .modal-panel select {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
}

[data-theme="light"] .modal-panel .modal-footer {
    border-top-color: #e2e8f0 !important;
}

[data-theme="light"] .modal-panel label {
    color: #475569 !important;
}

/* Rich editor trong modal cũng cần light mode */
[data-theme="light"] .modal-panel .rich-editor-area {
    background: #ffffff !important;
    color: #1e293b !important;
}

[data-theme="light"] .modal-panel .rich-editor-box {
    border-color: #e2e8f0 !important;
    background: #f8fafc !important;
}

[data-theme="light"] .modal-panel .rich-editor-toolbar {
    background: #f1f5f9 !important;
    border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .modal-panel .rich-tool-btn {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    color: #475569 !important;
}

[data-theme="light"] .modal-panel .rich-tool-btn:hover {
    background: rgba(99, 102, 241, 0.08) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
    color: #4f46e5 !important;
}

[data-theme="light"] .modal-panel .edit-field-label {
    color: #64748b !important;
}

[data-theme="light"] .modal-panel .edit-field-input {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
}

/* Gallery item trong modal ảnh */
[data-theme="light"] .modal-panel .gallery-item {
    background: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .modal-panel .img-empty {
    color: #94a3b8 !important;
}

/* Resize/Sharpen modal panels */
[data-theme="light"] .modal-panel .resize-option,
[data-theme="light"] .modal-panel .sharpen-item {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
}

[data-theme="light"] .modal-body h3,
[data-theme="light"] .modal-header h2 {
    color: var(--text-main) !important;
}

[data-theme="light"] .settings-title {
    color: var(--text-main) !important;
}

[data-theme="light"] .page-message {
    color: var(--text-main) !important;
    border-color: var(--glass-border) !important;
}

/* Sửa lỗi 2 thanh Scrollbar bị chèn lên nhau do code layout cũ có fixed height calc(100vh - 56px) */
.seo-layout,
.layout-main {
    height: 100% !important;
}

/* Sửa text WP Button và User Menu */
[data-theme="light"] #woo-status-text {
    color: var(--text-main) !important;
}

[data-theme="light"] #btn-user-menu,
[data-theme="light"] #btn-woo-config {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] #btn-woo-config .wp-host-text {
    color: var(--text-main) !important;
}

[data-theme="light"] #btn-user-menu:hover,
[data-theme="light"] #btn-woo-config:hover {
    background: #f8fafc !important;
}

/* ===================================================================
   LIGHT MODE OVERRIDES FOR IMPORT MODULE
   =================================================================== */
[data-theme="light"] #sheet-selector-container {
    background: rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] #sheet-selector {
    background: #ffffff !important;
    color: var(--text-main) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .mrow {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .mrow-label {
    border-right-color: rgba(0, 0, 0, 0.1) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] .excel-chip {
    background: rgb(247 244 236) !important;
    border-color: rgb(241 114 38) !important;
    color: var(--primary) !important;
}

[data-theme="light"] .excel-chip .chip-name {
    color: var(--primary) !important;
}

[data-theme="light"] .excel-chip .chip-remove {
    color: var(--text-main) !important;
    padding: 3px 5px;
}

[data-theme="light"] .mrow-add-col {
    background: #f1f5f9 !important;
    color: var(--text-muted) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .mrow-add-col:hover {
    background: #e2e8f0 !important;
}

[data-theme="light"] .excel-dropdown {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .excel-dd-item {
    color: var(--text-main) !important;
}

[data-theme="light"] .excel-dd-item:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .excel-dd-item.used {
    background: rgba(0, 0, 0, 0.02) !important;
    color: var(--text-muted) !important;
}

[data-theme="light"] .mapping-container {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .mapping-header-row {
    border-bottom-color: rgba(0, 0, 0, 0.1) !important;
    color: var(--text-main) !important;
}


/* EXTENDED LIGHT MODE OVERRIDES (Mở rộng cho Nút và Trang Tool) */
[data-theme="light"] .seo-main,
[data-theme="light"] .main-canvas,
[data-theme="light"] .ideas-modal-panel {
    background: var(--bg-start) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] .banner-img-wrap {
    background: #f1f5f9 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .ideas-modal-side {
    border-right-color: rgba(0, 0, 0, 0.1) !important;
}

/* ===================================================================
   LIGHT MODE OVERRIDES FOR IMPORT TABLE & PROGRESS
   =================================================================== */
[data-theme="light"] .table-container {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .data-grid.compact th {
    background: #f8fafc !important;
    color: var(--text-main) !important;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .data-grid.compact td {
    border-bottom-color: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .data-grid.compact tbody tr:hover {
    background: rgba(0, 0, 0, 0.02) !important;
}

[data-theme="light"] .row-variation {
    background: rgba(0, 0, 0, 0.02) !important;
}

[data-theme="light"] .data-grid.compact tbody tr.selected {
    background: rgba(99, 102, 241, 0.08) !important;
}

[data-theme="light"] .thumb-placeholder,
[data-theme="light"] .thumb-img {
    background: rgba(0, 0, 0, 0.05) !important;
    color: rgba(0, 0, 0, 0.3) !important;
}

/* Progress Box */
[data-theme="light"] .progress-box {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .progress-bar-container {
    background: rgba(0, 0, 0, 0.08) !important;
}

/* Variation Hint (Inline styles override) */
[data-theme="light"] .mapping-add-hidden {
    border-color: rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .mapping-hidden-select {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] #mapping-variation-hint>div {
    background: #ffffff !important;
    border-color: rgba(99, 102, 241, 0.2) !important;
}

[data-theme="light"] #mapping-variation-hint>div>div:first-child {
    background: rgba(99, 102, 241, 0.05) !important;
}

[data-theme="light"] #mapping-variation-hint table thead tr {
    background: #f8fafc !important;
    color: var(--text-main) !important;
}

[data-theme="light"] #mapping-variation-hint table tbody tr {
    background: #ffffff !important;
    color: var(--text-main) !important;
    border-top-color: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] #mapping-variation-hint table tbody tr:nth-child(even) {
    background: #f8fafc !important;
}

[data-theme="light"] #mapping-variation-hint code {
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] #mapping-variation-hint .attr-display-name {
    color: var(--text-main) !important;
}

[data-theme="light"] #mapping-variation-hint table tbody td:nth-child(4) span {
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] #mapping-variation-hint>div>div:last-child {
    background: #f8fafc !important;
    border-top-color: rgba(0, 0, 0, 0.05) !important;
    color: var(--text-muted) !important;
}

[data-theme="light"] .toolbar-select {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] #grid-summary .sum-badge:nth-child(1) {
    background: #ffffff !important;
    color: var(--text-main) !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] #grid-summary .sum-badge:nth-child(2) {
    background: #f1f5f9 !important;
    color: var(--text-muted) !important;
}

[data-theme="light"] #grid-summary .sum-badge:nth-child(3) {
    background: rgba(99, 102, 241, 0.1) !important;
    color: var(--primary) !important;
}

[data-theme="light"] #grid-summary .sum-badge:nth-child(4) {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #059669 !important;
}

[data-theme="light"] #grid-summary .sum-badge[style*="#f59e0b"] {
    background: #fef3c7 !important;
    color: #d97706 !important;
}

[data-theme="light"] #grid-summary .sum-badge[style*="#ef4444"] {
    background: #fee2e2 !important;
    color: #b91c1c !important;
}

[data-theme="light"] #ideas-modal-action-bar {
    background: rgba(255, 255, 255, 0.95) !important;
    border-top-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4:not([style*="color"]),
[data-theme="light"] .form-label,
[data-theme="light"] .qcard-title,
[data-theme="light"] .post-card h3,
[data-theme="light"] .page-card h3,
[data-theme="light"] .idea-title,
[data-theme="light"] .mapping-title,
[data-theme="light"] .field-header,
[data-theme="light"] .step-text,
[data-theme="light"] .empty-state h2 {
    color: var(--text-main) !important;
}

[data-theme="light"] .form-control {
    background: rgba(255, 255, 255, 0.7) !important;
    color: var(--text-main) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .seo-input {
    background: #fff !important;
    color: var(--text-main) !important;
    border-color: var(--glass-border) !important;
}

[data-theme="light"] .idea-card,
[data-theme="light"] .mapping-card {
    background: #fff !important;
    border-color: var(--glass-border) !important;
}

[data-theme="light"] .mapping-header {
    background: #f1f5f9 !important;
}

/* ===================================================================
   LIGHT MODE OVERRIDES — CUSTOM ALERT POPUP
   =================================================================== */
[data-theme="light"] .custom-alert-box {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%) !important;
    border-color: rgba(99, 102, 241, 0.15) !important;
    border-top-color: #f59e0b !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.04) inset !important;
    color: #1e293b !important;
}

[data-theme="light"] .custom-alert-header h3 {
    color: #1e293b !important;
}

[data-theme="light"] .custom-alert-body {
    color: #475569 !important;
}

[data-theme="light"] .custom-alert-close {
    background: rgba(0, 0, 0, 0.06) !important;
    color: #64748b !important;
}

[data-theme="light"] .custom-alert-close:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #b91c1c !important;
}

/* ===================================================================
   LIGHT MODE OVERRIDES — IMAGE POPUP ELEMENTS
   =================================================================== */
[data-theme="light"] .modal-panel .img-url-input {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
}

[data-theme="light"] .modal-panel .img-url-input::placeholder {
    color: #94a3b8 !important;
}

[data-theme="light"] .modal-panel .img-gallery {
    background: rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .modal-panel .gallery-item img {
    background: #e2e8f0 !important;
}

[data-theme="light"] .modal-panel .gallery-item-info {
    background: rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .modal-panel .popup-search-result {
    background: rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .modal-panel .search-loading {
    color: #64748b !important;
}

[data-theme="light"] .modal-panel .search-found-actions p {
    color: #64748b !important;
}

[data-theme="light"] .idea-desc,
[data-theme="light"] .mapping-desc,
[data-theme="light"] .upload-text,
[data-theme="light"] .upload-subtext,
[data-theme="light"] .qcard-actions i {
    color: var(--text-muted) !important;
}

[data-theme="light"] .upload-area {
    background: #fff !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .step-number {
    background: #f1f5f9 !important;
    color: var(--text-muted) !important;
    border-color: #cbd5e1 !important;
}

[data-theme="light"] .step-item.active .step-number {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

[data-theme="light"] .step-item.completed .step-number {
    background: var(--success) !important;
    color: #fff !important;
    border-color: var(--success) !important;
}

[data-theme="light"] .view-btn.active {
    color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.1) !important;
}

/* CÁC NÚT BẤM TRONG LIGHT MODE */
[data-theme="light"] .btn-secondary,
[data-theme="light"] .btn-icon-only {
    color: var(--text-main) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .btn-secondary:hover,
[data-theme="light"] .btn-icon-only:hover {
    background: #f1f5f9 !important;
}

/* Các icon hoặc text bên trong btn-secondary phải đổi màu tối */
[data-theme="light"] .btn-secondary i,
[data-theme="light"] .btn-icon-only i,
[data-theme="light"] .btn-secondary .wp-icon-wrap,
[data-theme="light"] .btn-secondary .wp-icon-wrap i {
    color: var(--text-main) !important;
}

[data-theme="light"] .qcard-header {
    background: #f1f5f9 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .post-card-thumb {
    background: rgba(0, 0, 0, 0.05) !important;
}

/* HOVER & VIEW SWITCH FIXES cho Light Mode */
[data-theme="light"] .post-card,
[data-theme="light"] .page-card {
    background: #ffffff !important;
    border-color: var(--glass-border) !important;
}

[data-theme="light"] .post-card:hover,
[data-theme="light"] .page-card:hover {
    background: var(--hover-bg) !important;
    /* Nền nhạt chuyên biệt cho hover thay vì nền đen sậm */
    border-color: var(--primary) !important;
}

[data-theme="light"] .view-switch {
    background: #e2e8f0 !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .view-btn {
    color: var(--text-muted) !important;
}

[data-theme="light"] .view-btn.active {
    background: var(--primary) !important;
    color: #fff !important;
}

[data-theme="light"] .toggle-row {
    border-color: var(--glass-border) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] .toggle-btn {
    background: #cbd5e1 !important;
}

[data-theme="light"] .toggle-row.active .toggle-btn {
    background: var(--primary) !important;
}

/* Light Mode cho Profile Button và WOO Config Modal */
[data-theme="light"] .user-menu-btn {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] .user-menu-btn .smart-auth-caret {
    color: var(--text-main) !important;
}

[data-theme="light"] .woo-config-panel {
    background: #ffffff !important;
    color: var(--text-main) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .woo-config-popup {
    background: rgba(248, 250, 252, 0.85) !important;

}

[data-theme="light"] .woo-config-panel label,
[data-theme="light"] .woo-config-panel h3 {
    color: var(--text-main) !important;
}

[data-theme="light"] .woo-config-panel input {
    background: #f8fafc !important;
    color: var(--text-main) !important;
    border: 1px solid #cbd5e1 !important;
}

[data-theme="light"] .woo-config-panel input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
}

[data-theme="light"] .smart-auth-dropdown {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .smart-auth-dropdown a,
[data-theme="light"] .smart-auth-dropdown button {
    color: var(--text-main) !important;
}

[data-theme="light"] .smart-auth-dropdown a:hover,
[data-theme="light"] .smart-auth-dropdown button:hover {
    background: rgba(99, 102, 241, 0.08) !important;
    color: var(--primary) !important;
}

[data-theme="light"] .smart-auth-divider {
    background: rgba(0, 0, 0, 0.08) !important;
}

/* Feature App Integrated Styling */
/* Feature App Integrated Styling */
.dash-body .layout-main,
.dash-body .import-main,
.dash-body .seo-layout,
.dash-body .banner-main,
.dash-body .main-full,
.dash-body .app-wrap {
    border-radius: 12px;
    background: var(--sidebar-bg);
    /* Use dashboard theme background */
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    min-height: 700px;
    /* Force flexible height inside the scrollable dash-body */
    height: auto !important;
}

#dash-body-content {
    flex-direction: column;
}

/* ===============================================================
   RESPONSIVE GLOBAL: TABLET (≤991px)
   =============================================================== */
@media (max-width: 991px) {

    /* Config grid: 1 cột trên tablet */
    .config-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Upload area: giảm padding */
    .upload-area {
        padding: 30px 18px;
    }

    /* Steps horizontal: cho cuộn ngang */
    .steps-horizontal {
        max-width: 100%;
        margin: 0 8px;
        overflow-x: auto;
    }

    .step-h {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    /* Woo config panel: responsive */
    .woo-config-panel {
        width: 320px;
    }

    /* Feature app containers: giảm min-height */
    .dash-body .layout-main,
    .dash-body .import-main,
    .dash-body .seo-main,
    .dash-body .seo-layout,
    .dash-body .banner-main,
    .dash-body .main-full,
    .dash-body .app-wrap {
        min-height: 500px;
    }
}

/* ===============================================================
   RESPONSIVE GLOBAL: MOBILE (≤576px)
   =============================================================== */
@media (max-width: 576px) {

    /* Config grid: 1 cột full width */
    .config-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 16px;
    }

    /* Card: giảm padding */
    .card {
        padding: 14px;
    }

    .card h3 {
        font-size: 0.9rem;
    }

    /* Input group: gọn hơn */
    .input-group input,
    .input-group select {
        padding: 8px 10px;
        font-size: 0.88rem;
    }

    .input-group label {
        font-size: 0.78rem;
    }

    /* Upload area: gọn tối đa */
    .upload-area {
        padding: 20px 12px;
        border-radius: 10px;
    }

    .upload-icon {
        font-size: 1.8rem;
    }

    .upload-area h3 {
        font-size: 1rem;
    }

    .upload-area p {
        font-size: 0.82rem;
    }

    /* Buttons: nhỏ hơn */
    .btn {
        padding: 8px 14px;
        font-size: 0.82rem;
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: 0.78rem;
    }

    /* Header area: gọn */
    .header-area h1 {
        font-size: 1.15rem;
    }

    .header-area p {
        font-size: 0.82rem;
    }

    /* Steps horizontal: nhỏ hơn cho mobile */
    .steps-horizontal {
        margin: 0 4px;
        padding: 3px;
    }

    .step-h {
        padding: 4px 10px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .step-h .step-num {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
    }

    /* Woo config panel: full width trên mobile */
    .woo-config-panel {
        width: calc(100vw - 24px);
        max-width: 360px;
    }

    /* Badge: nhỏ hơn */
    .badge {
        padding: 2px 8px;
        font-size: 0.75rem;
    }

    /* Feature app containers: giảm min-height */
    .dash-body .layout-main,
    .dash-body .import-main,
    .dash-body .seo-main,
    .dash-body .seo-layout,
    .dash-body .banner-main,
    .dash-body .main-full,
    .dash-body .app-wrap {
        min-height: 400px;
        border-radius: 8px;
    }

    /* Toast stack: gọn hơn */
    .smart-toast-stack {
        right: 8px;
        left: 8px;
        bottom: 8px;
        width: auto;
    }
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .btn-create-new {
        justify-content: center !important;
        padding: 0 !important;
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
    }

    .btn-create-new i {
        margin: 0 !important;
    }
}