/* ========================================
   CSS Variables & Base Styles
======================================== */
:root {
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #252540;
    --accent-primary: #00d4ff;
    --accent-secondary: #7b2cbf;
    --accent-gradient: linear-gradient(135deg, #00d4ff 0%, #7b2cbf 100%);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6a6a7a;
    --success: #00e676;
    --warning: #ffab00;
    --error: #ff5252;
    --border-radius: 16px;
    --border-radius-sm: 10px;
    --shadow-glow: 0 0 30px rgba(0, 212, 255, 0.2);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IBM Plex Sans Arabic', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* ========================================
   App Container & Layout
======================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   Sidebar
======================================== */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16162c 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 30px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-icon {
    font-size: 2.2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.logo span {
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo small {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-secondary);
    -webkit-text-fill-color: var(--text-secondary);
}

.nav-menu {
    flex: 1;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    transition: var(--transition);
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.nav-icon {
    font-size: 1.3rem;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--error);
}

.dot.online {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ========================================
   Main Content
======================================== */
.main-content {
    flex: 1;
    margin-right: 260px;
    padding: 30px 40px;
    position: relative;
}

/* ========================================
   Views
======================================== */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    margin-bottom: 30px;
}

.view-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.view-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.header-actions {
    display: flex;
    gap: 15px;
}

/* ========================================
   Control Grid
======================================== */
.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.control-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.control-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 212, 255, 0.2);
}

.control-card.wide {
    grid-column: span 2;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    cursor: pointer;
    user-select: none;
}

.card-header:hover .card-toggle {
    color: var(--accent-primary);
}

.card-icon {
    font-size: 1.5rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

/* Card Toggle Button */
.card-toggle {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: var(--transition);
    margin-left: auto;
}

.control-card.collapsed .card-toggle {
    transform: rotate(-90deg);
}

/* Card Body - Collapsible */
.card-body {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

.control-card.collapsed .card-body {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
}

.control-card.collapsed .card-header {
    margin-bottom: 0;
}

/* Category Selector in Cards */
.card-category-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px dashed rgba(0, 212, 255, 0.3);
    border-radius: var(--border-radius-sm);
    margin-bottom: 15px;
}

.card-category-selector label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.card-category-selector select {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-card);
    /* Solid dark background */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.card-category-selector select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ========================================
   Profiles Section
======================================== */
.profiles-section {
    background: linear-gradient(135deg, rgba(123, 44, 191, 0.1) 0%, rgba(0, 212, 255, 0.1) 100%);
    border: 1px solid rgba(123, 44, 191, 0.3);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 30px;
}

.profiles-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.profiles-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.profiles-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.profiles-controls select {
    min-width: 180px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.profiles-controls .btn-profile {
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-profile.save {
    background: var(--accent-gradient);
    color: white;
}

.btn-profile.load {
    background: rgba(0, 230, 118, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.btn-profile.delete {
    background: rgba(255, 82, 82, 0.2);
    color: var(--error);
    border: 1px solid var(--error);
}

.btn-profile:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* ========================================
   Form Elements
======================================== */
.form-select,
.form-input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.08);
    /* Increased opacity */
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Increased contrast */
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    cursor: pointer;
}

.form-select:hover,
.form-input:hover {
    border-color: var(--accent-primary);
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.form-select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* ========================================
   Checkbox Group
======================================== */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.05);
    /* Brighter base */
    border: 1px solid rgba(255, 255, 255, 0.15);
    /* More visible border */
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
}

.checkbox-item:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-primary);
}

.checkbox-item input {
    display: none;
}

.checkmark {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    position: relative;
    transition: var(--transition);
}

.checkbox-item input:checked+.checkmark {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
}

.checkbox-item input:checked+.checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: white;
}

/* ========================================
   Settings Grid
======================================== */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-item label {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.setting-item .form-input {
    width: 80px;
    text-align: center;
    padding: 10px;
}

/* ========================================
   Toggle Switch
======================================== */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 56px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    position: relative;
    transition: var(--transition);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--accent-gradient);
}

.toggle-switch input:checked+.toggle-slider::after {
    transform: translateX(-26px);
}

.toggle-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ========================================
   Start Button
======================================== */
.btn-start {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px 40px;
    font-size: 1.3rem;
    font-weight: 700;
    font-family: inherit;
    color: white;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 40px rgba(0, 212, 255, 0.3);
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 50px rgba(0, 212, 255, 0.4);
}

.btn-start:active {
    transform: translateY(0);
}

.btn-start:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.5rem;
}

.btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   Jobs Container
======================================== */
.jobs-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.job-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.job-card:hover {
    background: var(--bg-card-hover);
}

.job-info h4 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.job-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.job-status {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.job-status.running {
    background: rgba(255, 171, 0, 0.2);
    color: var(--warning);
}

.job-status.completed {
    background: rgba(0, 230, 118, 0.2);
    color: var(--success);
}

.job-status.error {
    background: rgba(255, 82, 82, 0.2);
    color: var(--error);
}

/* ========================================
   Empty State
======================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.empty-state small {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* ========================================
   Log Panel
======================================== */
.log-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 260px;
    background: var(--bg-card);
    border-top: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    transition: var(--transition);
    z-index: 200;
}

.log-panel.hidden {
    transform: translateY(100%);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-header h4 {
    font-size: 1rem;
    color: var(--accent-primary);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-close:hover {
    color: var(--error);
}

.log-content {
    height: 200px;
    overflow-y: auto;
    padding: 15px 25px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    direction: ltr;
    text-align: left;
}

.log-content::-webkit-scrollbar {
    width: 8px;
}

.log-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.log-content::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.log-line {
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.log-line.success {
    color: var(--success);
}

.log-line.error {
    color: var(--error);
}

.log-footer {
    padding: 15px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 20px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.5s ease;
}

#status-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

/* ========================================
   Results Grid
======================================== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-7px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(0, 212, 255, 0.3);
}

/* Badges */
.rank-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(15, 15, 26, 0.85);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--accent-gradient);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.discount-badge {
    position: absolute;
    top: 40px;
    left: 10px;
    background: var(--error);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 10;
}

.product-image {
    width: 100%;
    height: 220px;
    object-fit: contain;
    background: white;
    padding: 20px;
    transition: var(--transition);
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-info {
    padding: 20px;
    background: var(--bg-card);
    position: relative;
    z-index: 5;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.product-tag {
    font-size: 0.65rem;
    padding: 2px 8px;
    background: rgba(123, 44, 191, 0.2);
    color: #c084fc;
    border: 1px solid rgba(123, 44, 191, 0.3);
    border-radius: 4px;
}

.product-asin {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
    margin-bottom: 5px;
    opacity: 0.7;
}

.product-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em;
}

.product-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 5px;
}

.product-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0;
}

.product-original-price {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-amazon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: auto;
    padding: 12px;
    text-align: center;
    background: linear-gradient(to bottom, #f7dfa5, #f0c14b);
    color: #111;
    border: 1px solid #a88734;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-amazon:hover {
    background: linear-gradient(to bottom, #f5d78e, #eeb933);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(240, 193, 75, 0.2);
}

/* ========================================
   Product Category Badges
======================================== */
.product-category-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.cat-badge {
    font-size: 0.75rem;
    color: #c0c0d0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: default;
}

.cat-badge:hover {
    color: white;
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 212, 255, 0.15);
}

.cat-sep {
    color: var(--text-muted);
    font-size: 0.8rem;
    opacity: 0.4;
}

/* ========================================
   Responsive
======================================== */
@media (max-width: 1024px) {
    .control-card.wide {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-right: 0;
        padding: 20px;
    }

    .log-panel {
        right: 0;
    }
}

/* ========================================
   Modal Styles
======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ========================================
   Category Tree Styles
======================================== */
.category-tree {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-sm);
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.tree-node {
    margin: 4px 0;
}

.tree-node-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.tree-node-content:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tree-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-toggle.empty {
    visibility: hidden;
}

.tree-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.tree-label {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tree-children {
    margin-right: 20px;
    padding-right: 15px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.tree-children.collapsed {
    display: none;
}

/* ========================================
   Automation Styles
======================================== */
.automations-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.automation-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    cursor: pointer;
}

.automation-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 212, 255, 0.2);
}

.automation-info h4 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.automation-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.automation-schedule {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--accent-primary);
    margin-top: 8px;
}

.automation-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.automation-toggle {
    width: 50px;
    height: 26px;
}

.btn-icon-only {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.btn-icon-only:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-primary);
}

.btn-icon-only.danger:hover {
    background: rgba(255, 82, 82, 0.2);
    border-color: var(--error);
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.3);
}

.subcategory-summary {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--accent-primary);
}

/* ========================================
   Multi-Category Selection
======================================== */
.categories-multi-select {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-sm);
}

.category-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    user-select: none;
}

.category-checkbox-item:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-primary);
}

.category-checkbox-item.selected {
    background: rgba(0, 212, 255, 0.25);
    /* More vibrant selection */
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
    color: white;
    font-weight: 600;
}

.category-checkbox-item input[type="checkbox"] {
    display: none;
}

.category-checkbox-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 12px;
}

.category-checkbox-item.selected .category-checkbox-indicator {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
}

.category-checkbox-item.selected .category-checkbox-indicator::after {
    content: '✓';
    color: white;
}

/* Selected Categories Summary */
.selected-categories-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selected-category-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 15px;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: var(--border-radius-sm);
}

.selected-category-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.selected-category-name {
    font-weight: 600;
    color: var(--text-primary);
}

.selected-category-filter {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.selected-category-actions {
    display: flex;
    gap: 8px;
}

.btn-subcategory-mini {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-subcategory-mini:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-primary);
    color: white;
}

/* Per-Category Settings */
.per-category-settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.per-category-settings-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.per-category-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: rgba(0, 212, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: var(--transition);
}

.per-category-settings-header:hover {
    background: rgba(0, 212, 255, 0.12);
}

.per-category-settings-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.per-category-settings-toggle {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.per-category-settings-header.expanded .per-category-settings-toggle {
    transform: rotate(180deg);
}

.per-category-settings-body {
    padding: 15px;
    display: block;
}

.per-category-settings-body.collapsed {
    display: none;
}

.per-category-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

/* ========================================
   Flash Deals Widget
======================================== */
.flash-deals-widget {
    margin: 15px;
    background: rgba(255, 171, 0, 0.08);
    border: 1px solid rgba(255, 171, 0, 0.2);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.flash-deals-widget .widget-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: rgba(255, 171, 0, 0.1);
    border-bottom: 1px solid rgba(255, 171, 0, 0.15);
}

.flash-deals-widget .widget-icon {
    font-size: 1.1rem;
    animation: flash 1.5s infinite;
}

@keyframes flash {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.flash-deals-widget .widget-title {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--warning);
}

.flash-deals-widget .widget-body {
    padding: 12px 15px;
    max-height: 150px;
    overflow-y: auto;
}

.flash-deals-widget .text-muted.small {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.flash-deals-widget .widget-settings {
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.flash-deals-widget .setting-item.compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.flash-deals-widget .setting-item.compact:last-child {
    margin-bottom: 0;
}

.flash-deals-widget .setting-item.compact label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.flash-deals-widget .form-input.small {
    width: 70px;
    padding: 6px 8px;
    font-size: 0.8rem;
    text-align: center;
}

/* Mini Toggle Switch */
.toggle-switch.mini {
    gap: 0;
}

.toggle-switch.mini .toggle-slider {
    width: 36px;
    height: 20px;
}

.toggle-switch.mini .toggle-slider::after {
    width: 16px;
    height: 16px;
    top: 2px;
    right: 2px;
}

.toggle-switch.mini input:checked+.toggle-slider::after {
    transform: translateX(-16px);
}

/* Flash Deal Item */
.flash-deal-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.flash-deal-item:hover {
    background: rgba(255, 171, 0, 0.15);
}

.flash-deal-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    background: white;
    border-radius: 4px;
}

.flash-deal-item .deal-info {
    flex: 1;
    overflow: hidden;
}

.flash-deal-item .deal-title {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.flash-deal-item .deal-discount {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--success);
}

/* ========================================
   Range Slider
======================================== */
.range-slider {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-gradient);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.4);
    transition: var(--transition);
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.6);
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-gradient);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.4);
}

/* ========================================
   Deal Badges on Product Cards
======================================== */
.deal-badge {
    position: absolute;
    top: 70px;
    left: 10px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
}

.deal-badge.lightning {
    background: linear-gradient(135deg, #ffd93d 0%, #ff6b35 100%);
}

.deal-badge.limited-time {
    background: linear-gradient(135deg, #6c5ce7 0%, #a55eea 100%);
}

.deal-badge.best-deal {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
}

/* Claimed Progress Bar */
.claimed-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.claimed-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--warning) 0%, var(--error) 100%);
    transition: width 0.5s ease;
}

.claimed-text {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 0.65rem;
    color: var(--warning);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Deals Option Highlight */
.checkbox-item.deals-option {
    background: rgba(255, 107, 53, 0.1);
    border-color: rgba(255, 107, 53, 0.3);
}

.checkbox-item.deals-option:hover {
    background: rgba(255, 107, 53, 0.2);
    border-color: rgba(255, 107, 53, 0.5);
}