/* Global Styles and Variables - White/Light Theme */
:root {
    --bg-primary: #f8fafc; /* Light slate */
    --bg-secondary: #ffffff; /* Crisp white */
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    
    --border-color: #e2e8f0; /* slate-200 */
    --border-hover: #cbd5e1; /* slate-300 */
    
    /* Harmonious HSL Palette */
    --color-primary: #2563eb; /* Blue */
    --color-primary-hover: #1d4ed8;
    
    --color-success: #16a34a; /* Emerald Green */
    --color-warning: #d97706; /* Amber/Orange */
    --color-danger: #dc2626; /* Rose Red */
    
    --text-main: #0f172a; /* Slate 900 */
    --text-muted: #64748b; /* Slate 500 */
    --text-sub: #334155; /* Slate 700 */
    
    --font-outfit: 'Outfit', 'Noto Sans Thai', sans-serif;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 10px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-outfit);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(at 10% 20%, rgba(37, 99, 235, 0.02) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(22, 163, 74, 0.02) 0px, transparent 50%);
    background-attachment: fixed;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header Styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-premium);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo i {
    font-size: 2.2rem;
    color: var(--color-primary);
    text-shadow: 0 0 10px rgba(37, 99, 235, 0.15);
}

.logo-text h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-main);
}

.logo-text span.logo-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.update-date-text {
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 600;
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.15);
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Button UI */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-outfit);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background-color: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

/* Stat Cards Panel */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: 0 15px 30px -5px rgba(15, 23, 42, 0.08);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.icon-blue {
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-primary);
}

.icon-green {
    background: rgba(22, 163, 74, 0.08);
    color: var(--color-success);
}

.icon-orange {
    background: rgba(217, 119, 6, 0.08);
    color: var(--color-warning);
}

.icon-red {
    background: rgba(220, 38, 38, 0.08);
    color: var(--color-danger);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 2px 0;
}

.stat-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Layout Wrapper */
.layout-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    position: relative;
    margin-bottom: 24px;
}

/* Left Sidebar */
.sidebar-left {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.sidebar-section h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    cursor: pointer;
    user-select: none;
    transition: var(--transition-smooth);
}

.sidebar-section.collapsed h3 {
    border-bottom-color: transparent;
    padding-bottom: 0;
    margin-bottom: 0;
}

.sidebar-section.collapsed .sidebar-menu {
    display: none;
}

.sidebar-section h3 .toggle-arrow {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.sidebar-section.collapsed h3 .toggle-arrow {
    transform: rotate(-90deg);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 450px;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-right: 4px;
}

.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background-color: var(--border-hover);
}

.sidebar-menu-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius-md);
    color: var(--text-sub);
    font-family: var(--font-outfit);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
    width: 100%;
}

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

.sidebar-menu-btn.active {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.15);
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-menu-btn .count-badge {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    transition: var(--transition-smooth);
}

.sidebar-menu-btn.active .count-badge {
    background: var(--color-primary);
    color: #ffffff;
}

.search-filter-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 300px;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-main);
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #ffffff;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.08);
}

/* Toolbar Styling */
.toolbar-row {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-premium);
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-row .search-box {
    flex: 1.5;
    min-width: 250px;
}

.toolbar-row .deepdive-search-wrapper {
    flex: 1.2;
    min-width: 220px;
}

.toolbar-row .view-switches {
    flex-shrink: 0;
}

.deepdive-search-wrapper {
    position: relative;
    width: 100%;
    cursor: pointer;
}

.deepdive-search-wrapper input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-main);
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.deepdive-search-wrapper input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #ffffff;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.08);
}

.deepdive-dropdown-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.deepdive-search-wrapper:hover .deepdive-dropdown-icon {
    color: var(--text-main);
}

.deepdive-results-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    max-height: 250px;
    overflow-y: auto;
    box-shadow: var(--shadow-premium);
    margin-top: 4px;
}

.deepdive-result-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-sub);
    transition: var(--transition-smooth);
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
}

.deepdive-result-item:last-child {
    border-bottom: none;
}

.deepdive-result-item:hover {
    background: #f1f5f9;
    color: var(--color-primary);
    font-weight: 600;
}

/* Deep Dive Panel - Circle Chart UI styling */
/* Right Detail Drawer */
.detail-drawer {
    position: fixed;
    top: 0;
    right: -480px; /* Hidden state */
    width: 480px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(15, 23, 42, 0.06);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.detail-drawer.open {
    right: 0; /* Open state */
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.drawer-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-close-drawer {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-close-drawer:hover {
    color: var(--color-danger);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.deepdive-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 200px;
    border-right: 1px solid var(--border-color);
    padding-right: 16px;
}

.deepdive-right {
    flex: 2.5;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.circle-chart-container {
    position: relative;
    width: 140px;
    height: 140px;
}

.circle-chart-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.circle-chart-text .percent {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.circle-chart-text .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.circle-progress {
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.6s ease-out;
}

.deepdive-summary-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

.deepdive-summary-text span.highlight {
    font-size: 1.1rem;
    color: var(--color-primary);
    font-weight: 700;
}

.deepdive-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.deepdive-title-row h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
}

.deepdive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.deepdive-size-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--transition-smooth);
}

.deepdive-size-card:hover {
    border-color: var(--border-hover);
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.deepdive-size-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.size-name-col {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    width: 100%;
}

.reserve-indicator {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.reserve-indicator strong {
    color: var(--color-warning);
    font-weight: 700;
}

.size-controls-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.sub-control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.sub-control-label {
    font-size: 0.8rem;
    color: var(--text-sub);
    font-weight: 600;
}

.text-avail {
    color: var(--color-primary);
    font-weight: 700;
}

.text-qty {
    color: var(--text-main);
    font-weight: 700;
}

/* View Switch buttons */
.view-level-container {
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    flex-wrap: wrap;
}

.control-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-sub);
    min-width: 120px;
}

.view-switches {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
}

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-outfit);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.view-btn:hover {
    color: var(--text-main);
}

.view-btn.active {
    background-color: #ffffff;
    color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

/* Tag Chips */
.tags-filter-container {
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    flex-wrap: wrap;
}

.tag-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-chip {
    padding: 6px 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-muted);
    font-family: var(--font-outfit);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tag-chip:hover {
    background: var(--bg-hover);
    color: var(--text-main);
    border-color: var(--border-hover);
}

.tag-chip.active {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.3);
    color: var(--color-primary);
}

/* Dashboard Content & View Renderers */
.dashboard-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 400px;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 0;
    color: var(--text-muted);
}

.loading-spinner i {
    font-size: 2.5rem;
    color: var(--color-primary);
}

/* Product Groups View Card Layout */
.group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.group-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
}

.group-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(15, 23, 42, 0.08);
}

.group-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.group-title-area {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    padding-right: 12px;
}

.group-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    word-break: break-word;
}

.group-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.badge-tag {
    background-color: rgba(37, 99, 235, 0.08);
    color: var(--color-primary);
    border: 1px solid rgba(37, 99, 235, 0.15);
}

.badge-category {
    background-color: rgba(22, 163, 74, 0.08);
    color: var(--color-success);
    border: 1px solid rgba(22, 163, 74, 0.15);
}

.badge-color {
    background-color: #f1f5f9;
    color: var(--text-sub);
    border: 1px solid var(--border-color);
}

/* Caret toggle arrow */
.group-card {
    cursor: pointer;
}

.group-summary-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}

.summary-qty-box {
    display: flex;
    flex-direction: column;
}

.summary-qty-box .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.summary-qty-box .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.summary-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Removed group-breakdown accordion rules */

.breakdown-list {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    gap: 8px;
}

.size-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    transition: var(--transition-smooth);
}

.size-row:hover {
    background: #f1f5f9;
    border-color: var(--border-hover);
}

.size-badge {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    background: #f1f5f9;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.size-qty-info {
    flex: 1;
    margin-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.qty-numbers {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.qty-numbers span.avail {
    color: var(--color-primary);
    font-size: 1rem;
    font-weight: 700;
}

.qty-numbers span.buffer-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 6px;
    background: #e2e8f0;
    padding: 1px 6px;
    border-radius: 4px;
}

/* Progress bar inside lists */
.progress-container {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
    position: relative;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease-out;
}

.progress-bar.high {
    background: linear-gradient(90deg, #16a34a, #4ade80);
}

.progress-bar.medium {
    background: linear-gradient(90deg, #d97706, #fbbf24);
}

.progress-bar.low {
    background: linear-gradient(90deg, #dc2626, #f87171);
}

/* Adjust Stock controls (+ / - buttons) */
.stock-adjust-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-adjust {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-main);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

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

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

.btn-adjust.btn-minus:hover,
.btn-adjust.btn-avail-minus:hover,
.btn-adjust.btn-qty-minus:hover {
    background: rgba(220, 38, 38, 0.08);
    color: var(--color-danger);
    border-color: rgba(220, 38, 38, 0.2);
}

.btn-adjust.btn-plus:hover,
.btn-adjust.btn-avail-plus:hover,
.btn-adjust.btn-qty-plus:hover {
    background: rgba(22, 163, 74, 0.08);
    color: var(--color-success);
    border-color: rgba(22, 163, 74, 0.2);
}

/* Individual SKU View (Table-like List) */
.individual-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.individual-row {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
    gap: 16px;
}

.individual-row:hover {
    border-color: var(--border-hover);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.item-sku-details {
    display: flex;
    flex-direction: column;
    flex: 2;
    min-width: 250px;
}

.item-name {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.95rem;
}

.item-sku-code {
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.item-meta-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 150px;
    flex-wrap: wrap;
}

.item-stock-status {
    flex: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.item-price-box {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    min-width: 90px;
    text-align: right;
}

/* Categories View Layout */
.category-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.category-section {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-premium);
}

.category-section-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid var(--color-primary);
    padding-left: 12px;
}

.category-section-title span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: auto;
}

/* Footer Styling */
.app-footer {
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 20px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-premium);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h4 {
    color: var(--text-main);
    font-size: 1.15rem;
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
        padding: 16px 20px;
    }
    
    .header-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .btn {
        flex: 1;
        justify-content: center;
    }

    .layout-wrapper {
        flex-direction: column;
        gap: 20px;
    }

    .sidebar-left {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
        overflow-y: visible;
        padding: 16px;
    }
    
    .toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .view-switches {
        width: 100%;
    }
    
    .view-btn {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    
    .individual-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .item-sku-details {
        min-width: auto;
    }
    
    .item-meta-info {
        min-width: auto;
        justify-content: space-between;
    }
    
    .item-stock-status {
        min-width: auto;
        justify-content: space-between;
    }
    
    .item-price-box {
        text-align: left;
    }

    .detail-drawer {
        width: 100%;
        right: -100%;
    }

    .app-tabs {
        margin-left: 0;
        width: 100%;
    }
    .tab-btn {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

/* App Navigation Tabs */
.app-tabs {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    margin-left: 24px;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-outfit);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background-color: #ffffff;
    color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.tab-btn[data-tab="shopee"].active {
    color: #ee4d2d;
    font-weight: 700;
}

.tab-btn[data-tab="analysis"].active {
    color: #0284c7;
    font-weight: 700;
}

/* Shopee Analysis Styles */
.shopee-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .shopee-grid {
        grid-template-columns: 1fr;
    }
}

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

.shopee-table th {
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    padding: 14px 10px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shopee-table td {
    padding: 14px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-sub);
    vertical-align: middle;
}

.shopee-table tr:hover td {
    background: #f8fafc;
    color: var(--text-main);
}

.tag-performance-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 12px 14px;
    transition: var(--transition-smooth);
}

.tag-performance-row:hover {
    border-color: var(--border-hover);
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

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

.tag-performance-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-main);
    word-break: break-all;
}

.tag-performance-revenue {
    font-weight: 700;
    font-size: 0.95rem;
    color: #ee4d2d;
}

.tag-performance-bar-wrap {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.tag-performance-bar {
    height: 100%;
    background: linear-gradient(90deg, #ee4d2d, #ff6b35);
    border-radius: 3px;
    transition: width 0.4s ease-out;
}

.tag-performance-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Traffic Dashboard Side-by-Side */
.shopee-traffic-dashboard {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.traffic-charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .traffic-charts-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.traffic-chart-panel {
    border-radius: var(--border-radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transition: var(--transition-smooth);
}

/* Stacked bar for campaign tag splits */
.tag-split-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.tag-split-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    font-weight: 600;
}

.tag-split-label-early {
    color: var(--color-primary);
}

.tag-split-label-late {
    color: #b45309; /* Darker amber for readability */
}

.tag-split-bar-wrap {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    display: flex;
    overflow: hidden;
}

.tag-split-bar-early {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    transition: width 0.4s ease-out;
}

.tag-split-bar-late {
    height: 100%;
    background: linear-gradient(90deg, #d97706, #f59e0b);
    transition: width 0.4s ease-out;
}

/* Printing styling for Production Recommendation Report */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .app-container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    .app-header, .sidebar-left, .app-footer, .header-actions, .app-tabs {
        display: none !important;
    }
    #analysis-layout-wrapper {
        display: flex !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .stats-container {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 10px !important;
    }
    .stat-card {
        padding: 10px !important;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    .shopee-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    #btn-print-analysis, #analysis-product-select, .app-tabs, footer {
        display: none !important;
    }
    .shopee-table-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        padding: 10px !important;
    }
    .matrix-row {
        background: #ffffff !important;
        border: 1px solid #ddd !important;
        margin-bottom: 4px !important;
        padding: 8px 12px !important;
    }
    .matrix-row * {
        color: #000000 !important;
    }
}
