:root {
    --color-dynamic: #111827;
    --color-muted: #6b7280;
    --color-card: #ffffff;
    --color-sidebar: #f3f4f6;
    --color-border: #d1d5db;
}

.dark {
    --color-dynamic: #f9fafb;
    --color-muted: #9ca3af;
    --color-card: #1f2937;
    --color-sidebar: #0f172a;
    --color-border: #4b5563;
}

/* Button Base Styles */
.btn-base {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s, color 0.2s;
}

.btn-full {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--color-dynamic);
}

.btn-outline {
    border: 1px solid #d1d5db; /* gray-300 */
}

.dark .btn-outline {
    border-color: #4b5563; /* gray-600 */
}

/* Button Hover States */
.btn-hover-gray:hover {
    background-color: #f3f4f6; /* gray-100 */
}

.dark .btn-hover-gray:hover {
    background-color: #374151; /* gray-800 */
}

.btn-hover-green:hover {
    background-color: #16a34a; /* green-600 */
    color: white;
}

.btn-hover-purple:hover {
    background-color: #9333ea; /* purple-600 */
    color: white;
}

.btn-hover-blue:hover {
    background-color: #2563eb; /* blue-600 */
    color: white;
}

/* Form Controls */
.form-input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db; /* gray-300 */
    border-radius: 0.5rem;
    background-color: var(--color-card);
    color: var(--color-dynamic);
}

.dark .form-input {
    border-color: #4b5563; /* gray-600 */
}

.form-input:focus {
    outline: none;
    ring: 2px solid #3b82f6; /* blue-500 */
    border-color: transparent;
}

.search-input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 2.5rem; /* pl-10 pr-10 */
    border: 1px solid #d1d5db; /* gray-300 */
    border-radius: 0.5rem;
    background-color: var(--color-card);
    color: var(--color-dynamic);
}

.dark .search-input {
    border-color: #4b5563; /* gray-600 */
}

.search-input:focus {
    outline: none;
    ring: 2px solid #3b82f6; /* blue-500 */
    border-color: transparent;
}

.search-input::placeholder {
    color: var(--color-muted);
}

/* Clear search button */
.clear-search-btn {
    width: 1.25rem;
    height: 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    right: 0.75rem !important;
    top: 0.75rem !important;
    position: absolute !important;
}

.clear-search-btn svg {
    width: 100%;
    height: 100%;
}

.clear-search-btn:hover {
    color: var(--color-dynamic);
}

/* Layout Components */
.card-gradient {
    background: linear-gradient(to right, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.section-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.border-theme {
    border-color: #d1d5db; /* gray-300 */
}

.dark .border-theme {
    border-color: #4b5563; /* gray-600 */
}

.gradient-bg {
    background: linear-gradient(to bottom right, #3b82f6, #9333ea); /* blue-500 to purple-600 */
}

/* Stats & Metrics */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-dynamic);
}

.stat-value {
    font-size: 0.875rem;
    font-weight: 700;
}

.progress-bar {
    width: 100%;
    background-color: #e5e7eb; /* gray-200 */
    border-radius: 9999px;
    height: 0.5rem;
    margin-top: 0.5rem;
}

.dark .progress-bar {
    background-color: #374151; /* gray-700 */
}

/* Icon Sizes */
.icon-sm {
    width: 1.25rem;
    height: 1.25rem;
}

.icon-md {
    width: 1.5rem;
    height: 1.5rem;
}

.icon-lg {
    width: 6rem;
    height: 6rem;
}

.icon-xl {
    width: 1.5rem;
    height: 1.5rem;
}

/* Mobile Menu */
.mobile-menu-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 50;
    padding: 0.5rem;
    background-color: var(--color-card);
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    .mobile-menu-btn {
        display: none;
    }
}

/* Common Flex Patterns */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-start {
    display: flex;
    align-items: center;
}

/* Grid Patterns */
.paint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

/* Paint Card Consistency */
.paint-card {
    min-height: 85px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .filter-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Rainbow animation for 100% completion */
@keyframes rainbow {
    0% { background-position: 200% 0%; }
    100% { background-position: 0% 0%; }
}

.bg-rainbow-animated {
    background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    background-size: 200% 100%;
    animation: rainbow 3s linear infinite;
}

.text-rainbow-animated {
    background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbow 3s linear infinite;
    font-weight: 700; /* Ensure rainbow text is bold for visibility */
}

/* Confetti Animation */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ff0000;
    left: 50%;
    top: 50%;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

@keyframes confetti-burst-1 {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1.5);
        opacity: 1;
    }
    20% {
        transform: translate(calc(var(--end-x) * 0.3), calc(var(--end-y) * 0.3)) rotate(180deg) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(var(--end-x), var(--end-y)) rotate(1080deg) scale(0.2);
        opacity: 0;
    }
}

@keyframes confetti-burst-2 {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1.8);
        opacity: 1;
    }
    30% {
        opacity: 1;
        transform: translate(calc(var(--end-x) * 0.4), calc(var(--end-y) * 0.4)) rotate(360deg) scale(1.4);
    }
    100% {
        transform: translate(var(--end-x), var(--end-y)) rotate(1440deg) scale(0.1);
        opacity: 0;
    }
}

@keyframes confetti-burst-3 {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(2);
        opacity: 1;
    }
    15% {
        opacity: 1;
        transform: translate(calc(var(--end-x) * 0.2), calc(var(--end-y) * 0.2)) rotate(90deg) scale(1.6);
    }
    40% {
        opacity: 1;
        transform: translate(calc(var(--end-x) * 0.6), calc(var(--end-y) * 0.6)) rotate(540deg) scale(1);
    }
    100% {
        transform: translate(var(--end-x), var(--end-y)) rotate(1800deg) scale(0.1);
        opacity: 0;
    }
}

/* Progress color utilities */
.bg-red-500 { background-color: #ef4444; }
.bg-orange-500 { background-color: #f97316; }
.bg-yellow-500 { background-color: #eab308; }
.bg-green-500 { background-color: #22c55e; }

.text-red-500 { color: #ef4444; }
.text-orange-500 { color: #f97316; }
.text-yellow-500 { color: #eab308; }
.text-green-500 { color: #22c55e; }

/* Simplified Mobile Sidebar Styles - Let Tailwind handle transforms */
.sidebar {
    transition: transform 0.3s ease-in-out;
    z-index: 40;
}

.sidebar-overlay {
    z-index: 30;
    transition: opacity 0.3s ease-in-out;
}

.main-content {
    transition: margin-left 0.3s ease-in-out;
}

@media (min-width: 768px) {
    .main-content {
        margin-left: 16rem; /* 256px for w-64 sidebar */
    }
    
}

/* Active navigation states */
.nav-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 3px solid rgb(59, 130, 246);
    font-weight: 600;
}

.nav-item.active svg {
    color: rgb(59, 130, 246);
}

/* Improved focus states for accessibility */
.nav-item:focus,
.series-btn:focus {
    outline: 2px solid rgb(59, 130, 246);
    outline-offset: 2px;
}

/* Smooth transitions for interactive elements */
.nav-item,
.series-btn {
    transition: all 0.2s ease-in-out;
}

/* Better mobile touch targets */
@media (max-width: 767px) {
    .nav-item,
    .series-btn {
        min-height: 44px; /* Minimum touch target size */
    }
}

/* Toggle All button styling */
#toggleAllBtn {
    background-color: #ea580c; /* orange-600 */
}

#toggleAllBtn:hover {
    background-color: #c2410c; /* orange-700 */
}

#toggleAllBtn:focus {
    outline: 2px solid rgb(59, 130, 246);
    outline-offset: 2px;
}

/* Critical CLS Fixes */
#sidebarTotal { min-width: 3ch; display: inline-block; text-align: right; }
.mt-auto.pt-4.border-t { min-height: 200px; flex-shrink: 0; }
#app { min-height: calc(100vh - 4rem); }
footer.text-center.py-8.mt-12 { margin-top: auto !important; flex-shrink: 0; }
#paintGrid { min-height: 60vh; contain: layout; }
.sidebar { transform: translateZ(0); will-change: transform; }