:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --primary-color: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --accent-color: #8b5cf6;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(51, 65, 85, 0.5);
    --success: #10b981;
    --danger: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Animation */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 10s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-color);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: var(--success);
    top: 40%;
    left: 40%;
    opacity: 0.2;
    animation-duration: 15s;
}

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

    100% {
        transform: translate(30px, 50px) scale(1.1);
    }
}

/* Layout */
.app-container {
    max-width: 1400px;
    /* Increased width to accommodate sidebar */
    margin: 0 auto;
    padding: 2rem;
}

.glass-header {
    text-align: center;
    margin-bottom: 3rem;
}

.glass-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.accent {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Upload Zone */
.upload-zone {
    padding: 4rem 2rem;
    text-align: center;
    border: 2px dashed var(--glass-border);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

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

.clickable {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

/* Loading Spinner */
#loading {
    margin-top: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

/* Results Area */
.controls-bar {
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

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

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

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    /* Reduced margin */
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    position: relative;
    transition: color 0.3s;
}

.tab-btn.active {
    color: var(--text-color);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--primary-color);
}

/* Results Layout (Sidebar + Content) */
.results-layout {
    display: flex;
    gap: 20px;
    height: 70vh;
    /* Fixed height for scrollable areas */
}

/* Sidebar */
#category-sidebar {
    width: 300px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-item {
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    font-size: 0.9em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

.sidebar-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), transparent);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    font-weight: 600;
}

.sidebar-count {
    font-size: 0.8em;
    opacity: 0.6;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 10px;
}


/* Content Area */
#content-area {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    /* Space for scrollbar */
}

/* Grid Layout for Content */
.category-container {
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease;
}

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

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

.category-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.category-title {
    font-size: 1.5rem;
    color: var(--text-color);
}

.category-toggle {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.category-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    /* Smaller cards */
    gap: 1rem;
}

.item-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.item-card.selected {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.2);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.item-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.1);
}

.card-icon {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
}

.card-title {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
    /* Force height for alignment */
}

.card-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .results-layout {
        flex-direction: column;
        height: auto;
    }

    #category-sidebar {
        width: 100%;
        max-height: 200px;
        margin-bottom: 1rem;
    }
}