:root {
    --color-primary: #6366f1;
    --color-primary-light: #818cf8;
    --color-secondary: #06b6d4;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-bg-primary: #0a0a0f;
    --color-bg-secondary: #12121a;
    --color-bg-tertiary: #1a1a25;
    --color-text-primary: #ffffff;
    --color-text-secondary: #a1a1aa;
    --color-text-muted: #71717a;
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-hover: rgba(255, 255, 255, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden
}

.app-container {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column
}

.bg-gradient {
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%), radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -2
}

.bg-pattern {
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: -1
}

@keyframes bgFloat {

    0%,
    100% {
        transform: translate(0, 0)
    }

    50% {
        transform: translate(2%, 2%)
    }
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow)
}

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

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

.logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    color: #fff
}

.logo-icon svg {
    width: 22px;
    height: 22px
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--color-success)
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: var(--color-success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite
}

@keyframes pulse {

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

    50% {
        opacity: 0.5;
        transform: scale(1.5)
    }
}

.main-content {
    flex: 1;
    padding: 3rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%
}

.input-section {
    padding: 2rem;
    margin-bottom: 2rem
}

.section-header {
    text-align: center;
    margin-bottom: 2rem
}

.section-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent
}

.section-header p {
    color: var(--color-text-secondary);
    max-width: 500px;
    margin: 0 auto
}

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center
}

.input-icon {
    position: absolute;
    left: 1.5rem;
    width: 20px;
    height: 20px;
    color: var(--color-text-muted);
    pointer-events: none
}

.url-input {
    width: 100%;
    padding: 1rem 3rem 1rem 3.5rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-normal)
}

.url-input::placeholder {
    color: var(--color-text-muted)
}

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

.clear-btn {
    position: absolute;
    right: 1rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    opacity: 0;
    pointer-events: none
}

.input-wrapper:has(.url-input:not(:placeholder-shown)) .clear-btn {
    opacity: 1;
    pointer-events: auto
}

.clear-btn:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary)
}

.clear-btn svg {
    width: 16px;
    height: 16px
}

.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-lg);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap
}

.primary-btn svg {
    width: 18px;
    height: 18px
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow)
}

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

.secondary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap
}

.secondary-btn svg {
    width: 16px;
    height: 16px
}

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

.options-row {
    display: flex;
    align-items: center;
    gap: 1.5rem
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem;
    color: var(--color-text-secondary)
}

.checkbox-wrapper input[type="checkbox"] {
    display: none
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast)
}

.checkbox-wrapper input:checked+.checkmark {
    background: var(--gradient-primary);
    border-color: var(--color-primary)
}

.checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform var(--transition-fast)
}

.checkbox-wrapper input:checked+.checkmark::after {
    transform: rotate(45deg) scale(1)
}

.loading-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem
}

.loader {
    position: relative;
    width: 80px;
    height: 80px
}

.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite
}

.loader-ring:nth-child(2) {
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-top-color: var(--color-secondary);
    animation-delay: -0.3s
}

.loader-ring:nth-child(3) {
    width: 40%;
    height: 40%;
    top: 30%;
    left: 30%;
    border-top-color: #f472b6;
    animation-delay: -0.15s
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

.loading-text {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600
}

.loading-subtext {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    animation: pulse 1.5s ease-in-out infinite
}

.stats-section {
    margin-bottom: 2rem
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem
}

.stats-grid-2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 600px;
    margin: 0 auto;
}

@media(max-width:900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr)
    }
}

@media(max-width:500px) {
    .stats-grid {
        grid-template-columns: 1fr
    }
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all var(--transition-normal)
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow), var(--shadow-glow)
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0
}

.stat-icon svg {
    width: 24px;
    height: 24px
}

.stat-icon.blue {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8
}

.stat-icon.purple {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24
}

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

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2
}

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

.products-section {
    margin-bottom: 2rem
}

.section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem
}

.toolbar-left h2 {
    font-size: 1.25rem;
    font-weight: 700
}

.product-count {
    padding: 0.25rem 1rem;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--color-text-secondary)
}

.toolbar-right {
    display: flex;
    gap: 1rem
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem
}

.product-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-normal)
}

.product-card:hover {
    border-color: var(--color-border-hover);
    transform: translateY(-2px)
}

.product-card.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2)
}

.product-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border)
}

.product-code {
    font-weight: 600;
    font-size: 0.95rem
}

.product-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast)
}

.product-card.selected .product-checkbox {
    background: var(--gradient-primary);
    border-color: var(--color-primary)
}

.product-checkbox::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform var(--transition-fast)
}

.product-card.selected .product-checkbox::after {
    transform: rotate(45deg) scale(1)
}

.product-images {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    padding: 2px
}

.product-image-wrapper {
    aspect-ratio: 1;
    position: relative;
    overflow: hidden;
    background: var(--color-bg-secondary)
}

.product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal)
}

.product-image-wrapper:hover img {
    transform: scale(1.1)
}

.image-index {
    position: absolute;
    bottom: 4px;
    right: 4px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600
}

.product-footer {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--color-border)
}

.image-count {
    font-size: 0.85rem;
    color: var(--color-text-secondary)
}

.image-count strong {
    color: var(--color-text-primary)
}

.download-section {
    margin-bottom: 2rem
}

.download-card {
    padding: 2rem
}

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

.download-header h3 {
    font-size: 1.1rem;
    font-weight: 600
}

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

#downloadPercent {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent
}

.cancel-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-error);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.cancel-btn svg {
    width: 16px;
    height: 16px;
}

.cancel-btn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
    border-color: var(--color-error);
}

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

.progress-bar {
    height: 8px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 1rem
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal)
}

.download-stats {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem
}

.download-log {
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: 1rem
}

.download-log:empty {
    display: none
}

.log-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--color-border)
}

.log-entry:last-child {
    border-bottom: none
}

.log-entry.success {
    color: var(--color-success)
}

.log-entry.error {
    color: var(--color-error)
}

.footer {
    padding: 1.5rem 2rem;
    text-align: center;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.85rem
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--color-bg-secondary)
}

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

.upload-area.drag-over {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.01)
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--color-primary);
    opacity: 0.8
}

.upload-icon svg {
    width: 100%;
    height: 100%
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem
}

.upload-subtext {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem
}

.upload-formats {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--color-text-muted)
}

/* File Info */
.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.15);
    border-radius: var(--radius-md);
    color: #34d399
}

.file-icon svg {
    width: 20px;
    height: 20px
}

.file-details {
    flex: 1
}

.file-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem
}

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

.remove-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast)
}

.remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--color-error);
    color: var(--color-error)
}

.remove-btn svg {
    width: 16px;
    height: 16px
}

/* Column Config */
.column-config {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border)
}

.column-config h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem
}

.config-grid:has(.config-item:nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr);
}

.config-subtitle {
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

.optional-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-secondary);
    letter-spacing: 0.02em;
}

.config-hint {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

@media(max-width:768px) {
    .config-grid {
        grid-template-columns: 1fr
    }
}

.config-item label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem
}

.label-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

/* Product badges (category & color) */
.product-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.product-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
}

.product-badge svg {
    flex-shrink: 0;
}

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

.color-badge {
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

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

.config-grid-3 {
    grid-template-columns: repeat(3, 1fr) !important;
}

@media(max-width:768px) {
    .config-grid-3 {
        grid-template-columns: 1fr !important;
    }
}

/* Brand Filter Section */
.brand-filter-section {
    margin-bottom: 2rem;
}

.brand-filter-card {
    padding: 1.5rem 2rem;
}

.brand-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.brand-filter-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-filter-title svg {
    width: 22px;
    height: 22px;
    color: #34d399;
}

.brand-filter-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.brand-count-badge {
    padding: 0.2rem 0.75rem;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: #34d399;
    font-weight: 500;
}

.brand-toggle-btn {
    padding: 0.6rem 1.2rem !important;
    font-size: 0.85rem !important;
}

.brand-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.brand-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
    user-select: none;
}

.brand-chip:hover {
    border-color: var(--color-border-hover);
    background: var(--color-bg-tertiary);
    transform: translateY(-1px);
}

.brand-chip.active {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
}

.chip-check {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.chip-check svg {
    width: 10px;
    height: 10px;
    opacity: 0;
    transform: scale(0);
    transition: all var(--transition-fast);
}

.brand-chip.active .chip-check {
    background: #10b981;
    border-color: #10b981;
}

.brand-chip.active .chip-check svg {
    opacity: 1;
    transform: scale(1);
    color: #fff;
}

.chip-label {
    white-space: nowrap;
}

.chip-count {
    padding: 0.1rem 0.45rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    color: var(--color-text-muted);
    min-width: 20px;
    text-align: center;
}

.brand-chip.active .chip-count {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.brand-filter-info {
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.config-item select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal)
}

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

.config-item select option {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary)
}

/* Variant Badge */
.variant-badge {
    padding: 0.2rem 0.6rem;
    background: rgba(139, 92, 246, 0.15);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: #c084fc
}

/* Image Error */
.img-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--color-bg-tertiary);
    color: var(--color-error);
    font-size: 1.2rem
}

.hidden {
    display: none !important
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-full)
}

::-webkit-scrollbar-thumb {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full)
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted)
}

@media(max-width:768px) {
    .main-content {
        padding: 1.5rem
    }

    .input-group {
        flex-direction: column
    }

    .section-header h1 {
        font-size: 1.5rem
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: center
    }

    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center
    }
}

/* Full Screen Download Overlay */
.download-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayFadeIn 0.3s ease;
}

.download-overlay.hidden {
    display: none !important;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.overlay-content {
    width: 100%;
    max-width: 600px;
    padding: 3rem;
    text-align: center;
}

.overlay-header {
    margin-bottom: 3rem;
}

.overlay-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    animation: iconPulse 2s ease-in-out infinite;
}

.overlay-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

@keyframes iconPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 40px 10px rgba(99, 102, 241, 0.2);
    }
}

.overlay-header h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.overlay-subtitle {
    color: var(--color-text-muted);
    font-size: 1rem;
}

.overlay-progress-container {
    margin-bottom: 2.5rem;
}

.overlay-progress-bar {
    height: 16px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.overlay-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
    position: relative;
}

.overlay-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.3) 50%,
            transparent 100%);
    animation: shimmer 2s infinite;
}

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

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

.overlay-percent {
    font-size: 4rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.overlay-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.stat-box-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.stat-box-total {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.digital-timer {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    letter-spacing: 2px;
    color: var(--color-secondary) !important;
}

.overlay-current-file {
    margin-bottom: 2.5rem;
    padding: 1rem;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.current-file-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.current-file-name {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    font-family: 'Monaco', 'Menlo', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.overlay-cancel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-lg);
    color: var(--color-error);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.overlay-cancel-btn svg {
    width: 20px;
    height: 20px;
}

.overlay-cancel-btn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
    border-color: var(--color-error);
    transform: scale(1.02);
}

.overlay-cancel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .overlay-content {
        padding: 2rem 1.5rem;
    }

    .overlay-percent {
        font-size: 3rem;
    }

    .overlay-stats {
        grid-template-columns: 1fr;
    }

    .stat-box-value {
        font-size: 1.5rem;
    }
}

/* ==================== Admin Login Styles ==================== */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--color-bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayFadeIn 0.5s ease;
}

.login-overlay.hidden {
    display: none !important;
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 2rem;
}

.login-card {
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.login-logo-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    color: #fff;
}

.login-logo-icon svg {
    width: 20px;
    height: 20px;
}

.login-logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-lock-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.12);
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    color: var(--color-primary-light);
    animation: lockPulse 3s ease-in-out infinite;
}

.login-lock-icon svg {
    width: 32px;
    height: 32px;
}

@keyframes lockPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.25);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 30px 8px rgba(99, 102, 241, 0.15);
        transform: scale(1.03);
    }
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-input-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.login-input-group label svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.login-input-group input {
    width: 100%;
    padding: 0.85rem 1.25rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-normal);
}

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

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

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 3rem;
}

.toggle-password-btn {
    position: absolute;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.toggle-password-btn:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-password-btn svg {
    width: 18px;
    height: 18px;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    color: var(--color-error);
    font-size: 0.85rem;
    animation: slideDown 0.3s ease;
}

.login-error svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

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

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

.login-submit-btn {
    margin-top: 0.5rem;
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
}

.login-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.login-footer svg {
    color: var(--color-success);
    opacity: 0.7;
}

/* Shake animation */
@keyframes shake {

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

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-4px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(4px);
    }
}

.shake {
    animation: shake 0.5s ease;
}

/* Fade out animation */
@keyframes overlayFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Header right section with logout */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-full);
    color: var(--color-error);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.logout-btn svg {
    width: 16px;
    height: 16px;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .login-container {
        padding: 1rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }

    .login-header h2 {
        font-size: 1.4rem;
    }

    .login-lock-icon {
        width: 60px;
        height: 60px;
    }

    .login-lock-icon svg {
        width: 26px;
        height: 26px;
    }

    .header-right {
        gap: 0.5rem;
    }

    .logout-btn span {
        display: none;
    }

    .logout-btn {
        padding: 0.5rem;
    }
}

/* ==================== Plan Badge ==================== */
.plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.plan-badge-free {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
}

.plan-badge-basic {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.plan-badge-pro {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.plan-badge-enterprise {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.usage-info {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.usage-item {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.usage-item strong {
    color: rgba(255, 255, 255, 0.9);
}

/* ==================== Admin Panel ==================== */
.admin-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem auto;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    color: #fbbf24;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-toggle-btn:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(245, 158, 11, 0.1));
    transform: translateY(-1px);
}

.admin-panel {
    margin: 0 1rem 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-panel-header h2 {
    font-size: 1.2rem;
    color: #fbbf24;
    margin: 0;
}

.add-user-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.add-user-form input,
.add-user-form select {
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.85rem;
}

.add-user-form input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.btn-add-user {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-add-user:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.admin-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.admin-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #e2e8f0;
}

.admin-stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th {
    text-align: left;
    padding: 0.75rem 0.5rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-table td {
    padding: 0.75rem 0.5rem;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.admin-row-admin td {
    background: rgba(245, 158, 11, 0.05);
}

.admin-plan-select {
    padding: 0.35rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-admin-delete {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.btn-admin-delete:hover {
    opacity: 1;
}

.text-danger {
    color: #ef4444 !important;
    font-weight: 700;
}

@media (max-width: 768px) {
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-table {
        font-size: 0.75rem;
    }

    .admin-panel-header {
        flex-direction: column;
    }

    .add-user-form {
        width: 100%;
    }

    .add-user-form input,
    .add-user-form select {
        flex: 1;
        min-width: 0;
    }
}