:root {
    --primary: #000000;
    --secondary: #666666;
    --tertiary: #999999;
    --background: #ffffff;
    --surface: #fafafa;
    --border: #e5e5e5;
    --hover: #f5f5f5;
    --sidebar-width: 260px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Funnel Display', serif;
    background: var(--background);
    color: var(--primary);
    font-weight: 300;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--background);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
}

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

.site-title {
    text-decoration: none;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-title:hover {
    opacity: 0.8;
}

.site-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.site-title-text {
    display: flex;
    flex-direction: column;
}

.site-title h1 {
    font-size: 1.125rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.site-subtitle {
    font-size: 0.6875rem;
    color: var(--tertiary);
    font-weight: 300;
    letter-spacing: 0.02em;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 250;
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--primary);
    width: 44px;
    height: 44px;
    border-radius: 4px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-menu-btn:hover {
    background: var(--surface);
    border-color: var(--primary);
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 250;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
    display: none;
    opacity: 0.5;
}

.sidebar-close:hover {
    opacity: 1;
}

.search-box {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
}

.search-box input {
    width: 100%;
    padding: 0.5rem 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--primary);
    font-size: 0.875rem;
    font-family: 'Funnel Display', serif;
    font-weight: 300;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-bottom-color: var(--primary);
}

.search-box input::placeholder {
    color: var(--tertiary);
}

.collections-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
}

.collection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--secondary);
    font-size: 0.875rem;
    font-weight: 300;
    will-change: background-color;
    backface-visibility: hidden;
}

.collection-item:hover {
    background: var(--surface);
    color: var(--primary);
}

.collection-item.active {
    background: var(--surface);
    color: var(--primary);
    font-weight: 400;
}

.collection-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.collection-item-count {
    font-size: 0.75rem;
    color: var(--tertiary);
    margin-left: 0.5rem;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-right: 280px;
    min-height: 100vh;
    padding: 3rem 3rem 6rem;
    transition: var(--transition);
}

.content-header {
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

#collectionTitle {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.collection-meta {
    display: flex;
    gap: 2rem;
    font-size: 0.8125rem;
    color: var(--secondary);
    font-weight: 300;
}

.collection-meta span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.collection-meta strong {
    color: var(--primary);
    font-weight: 400;
}

.download-limit-info {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8125rem;
    color: var(--secondary);
    display: inline-block;
}

.download-limit-info.low {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.download-limit-info.exceeded {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.download-limit-text strong {
    color: var(--primary);
    font-weight: 500;
}

/* Icons Grid */
.icons-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    background: transparent;
    will-change: contents;
    contain: layout;
    grid-auto-rows: min-content;
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
}

/* Override for home page */
.icons-grid.home-page {
    display: block;
    background: transparent;
    border: none;
}

/* Remove grid borders on home page icon cards */
.icons-grid.home-page .icon-card {
    border: 1px solid var(--border);
}

.icon-card {
    aspect-ratio: 1;
    background: var(--background);
    padding: 1.5rem;
    display: flex;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    will-change: background;
    contain: layout style paint;
}

.icon-card:hover {
    background: var(--surface);
}

.icon-card.selected {
    background: var(--surface);
}

/* Checkbox for bulk selection */
.icon-checkbox {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 20px;
    height: 20px;
    border: 1px solid var(--border);
    background: var(--background);
    cursor: pointer;
    opacity: 0.3;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: auto;
}

.icon-card:hover .icon-checkbox {
    opacity: 1;
}

.icon-checkbox.checked {
    opacity: 1 !important;
}

.icon-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
}

.icon-checkbox.checked::after {
    content: '✓';
    color: var(--background);
    font-size: 0.75rem;
}

.icon-card svg {
    width: 100%;
    height: 100%;
    max-width: 32px;
    max-height: 32px;
    color: var(--primary);
}

/* Ensure SVG animations run properly */
.icon-card svg * {
    animation-play-state: running !important;
}

/* Force animation restart for cloned SVGs */
.icon-card svg animate,
.icon-card svg animateTransform {
    animation: none !important;
}

.icon-placeholder {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.4; }
}

.icon-name {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    font-size: 0.625rem;
    color: var(--tertiary);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0;
    transition: var(--transition);
}

.icon-card:hover .icon-name {
    opacity: 1;
}

/* Load More Wrapper (outside grid) */
.load-more-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: transparent;
}

.load-more-btn {
    padding: 0.75rem 2rem;
    background: var(--primary);
    color: var(--background);
    border: none;
    font-family: 'Funnel Display', serif;
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: -0.01em;
}

.load-more-btn:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

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

/* Collection Content (SEO) */
.collection-content {
    max-width: 900px;
    margin: 4rem auto 2rem;
    padding: 0 2rem;
}

.content-section h2 {
    font-size: 1.75rem;
    font-weight: 500;
    margin: 2.5rem 0 1.25rem 0;
    letter-spacing: -0.02em;
    color: var(--primary);
}

.content-section h2:first-of-type {
    margin-top: 1.5rem;
}

.content-section h3 {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 2rem 0 1rem 0;
    letter-spacing: -0.01em;
    color: var(--primary);
}

.content-section p {
    font-size: 0.9375rem;
    line-height: 1.8;
    color: var(--secondary);
    font-weight: 300;
    margin-bottom: 1.25rem;
}

.content-section ul {
    list-style: none;
    padding-left: 0;
    margin: 1.25rem 0;
}

.content-section ul li {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--secondary);
    font-weight: 300;
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.content-section ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 500;
}

.content-section pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1.25rem 0;
}

.content-section code {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--primary);
}

.content-section strong {
    font-weight: 500;
    color: var(--primary);
}

.content-section a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.content-section a:hover {
    border-bottom-color: var(--primary);
}

/* Related Terms/Collections Grid */
.related-terms-grid,
.related-collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.related-term-link,
.related-collection-link {
    display: block;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 400;
    transition: var(--transition);
    text-align: center;
}

.related-term-link:hover,
.related-collection-link:hover {
    background: var(--hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

/* Browse Topics */
.browse-topics {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 3rem;
}

.browse-topics h3 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--primary);
    text-align: center;
}

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

.topic-card {
    background: var(--background);
    border: 1px solid var(--border);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--primary);
}

.topic-card:hover {
    background: var(--surface);
    border-color: var(--primary);
}

.topic-card-title {
    font-size: 0.9375rem;
    font-weight: 300;
    line-height: 1.4;
}

/* Welcome Message */
.welcome-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 6rem 2rem;
    background: var(--background);
}

.welcome-message h2 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.welcome-message p {
    color: var(--secondary);
    font-size: 0.9375rem;
    font-weight: 300;
}

.icon-count {
    margin-top: 1.5rem;
    font-size: 0.875rem !important;
    color: var(--primary) !important;
    font-weight: 300 !important;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.loading-spinner.active {
    display: block;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-top: 1px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Toolbar */
.toolbar {
    position: fixed;
    bottom: -100%;
    left: var(--sidebar-width);
    right: 280px;
    background: var(--background);
    border-top: 1px solid var(--border);
    padding: 1.5rem 3rem;
    z-index: 200;
    transition: var(--transition);
    transform: translateZ(0);
    will-change: bottom;
}

.toolbar.active {
    bottom: 0;
}

/* Bulk Selection Toolbar */
.bulk-toolbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 280px;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    padding: 1rem 3rem;
    z-index: 150;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.bulk-toolbar.active {
    display: flex;
}

/* Adjust main content when bulk toolbar is active */
body:has(.bulk-toolbar.active) .main-content {
    padding-top: calc(3rem + 60px);
}

@media (max-width: 768px) {
    body:has(.bulk-toolbar.active) .main-content {
        padding-top: calc(2rem + 60px);
    }
}

.bulk-toolbar-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bulk-toolbar-count {
    font-size: 0.875rem;
    font-weight: 300;
    color: var(--primary);
}

.bulk-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bulk-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary);
    font-size: 0.8125rem;
    font-weight: 300;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Funnel Display', serif;
}

.bulk-btn:hover {
    background: var(--surface);
}

.bulk-btn.primary {
    background: var(--primary);
    color: var(--background);
    border-color: var(--primary);
}

.bulk-btn.primary:hover {
    opacity: 0.9;
}

.toolbar-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.selected-icon-preview {
    min-width: 48px;
    height: 48px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 1rem;
}

.selected-icon-preview svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

/* Bulk Preview Styling */
.bulk-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.bulk-preview-count {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--primary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.bulk-preview-text {
    font-size: 0.6875rem;
    color: var(--tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 300;
}

.toolbar-actions {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary);
    font-size: 0.8125rem;
    font-weight: 300;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Funnel Display', serif;
}

.toolbar-btn:hover {
    background: var(--surface);
}

.toolbar-btn.close-btn {
    margin-left: auto;
    color: var(--secondary);
}

.toolbar-btn.close-btn:hover {
    background: var(--primary);
    color: var(--background);
    border-color: var(--primary);
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border);
    padding: 0.25rem 0.5rem;
}

#colorPicker {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
}

#colorInput {
    width: 70px;
    padding: 0.25rem;
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.8125rem;
    font-family: 'Funnel Display', serif;
    font-weight: 300;
}

#colorInput:focus {
    outline: none;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary);
    color: var(--background);
    padding: 0.75rem 1.25rem;
    font-size: 0.8125rem;
    font-weight: 300;
    transform: translateY(150%);
    transition: var(--transition);
    z-index: 300;
}

.toast.show {
    transform: translateY(0);
}

/* Right Sidebar */
.right-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--background);
    border-left: 1px solid var(--border);
    padding: 2rem 1.5rem;
    overflow-y: auto;
    z-index: 50;
}

.ad-section {
    margin-bottom: 2rem;
}

.ad-section h3 {
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tertiary);
    margin-bottom: 1rem;
}

.ad-space {
    background: var(--surface);
    border: 1px solid var(--border);
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder {
    text-align: center;
    padding: 2rem;
}

.ad-placeholder svg {
    color: var(--tertiary);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.ad-placeholder p {
    font-size: 0.875rem;
    color: var(--secondary);
    margin-bottom: 1rem;
    font-weight: 300;
}

.ad-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 400;
    transition: var(--transition);
    letter-spacing: -0.01em;
}

.ad-link:hover {
    background: var(--primary);
    color: var(--background);
    border-color: var(--primary);
}


/* Home Search */
.search-home {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
    padding: 8rem 2rem 3rem;
}

.search-home h2 {
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.search-home p {
    font-size: 0.9375rem;
    color: var(--secondary);
    font-weight: 300;
    margin-bottom: 2.5rem;
}

.search-home-box {
    margin: 0 auto 2rem;
    max-width: 600px;
}

.search-home-box input {
    width: 100%;
    padding: 1rem 1.5rem;
    background: transparent;
    border: 1px solid var(--border);
    font-family: 'Funnel Display', serif;
    font-size: 1rem;
    font-weight: 300;
    color: var(--primary);
    transition: var(--transition);
    text-align: center;
}

.search-home-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-home-box input::placeholder {
    color: var(--tertiary);
}

.search-loading {
    text-align: center;
    padding: 2rem;
    color: var(--secondary);
    font-size: 0.875rem;
}

.search-no-results {
    text-align: center;
    padding: 3rem 2rem;
}

.search-no-results p {
    color: var(--secondary);
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

.search-hint {
    font-size: 0.8125rem !important;
    color: var(--tertiary) !important;
}

.search-hint-text {
    text-align: center;
    padding: 2rem;
    color: var(--tertiary);
    font-size: 0.875rem;
    font-weight: 300;
}

.search-results-header {
    text-align: center;
    padding: 1rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-top: 2rem;
}

.search-results-header p {
    font-size: 0.875rem;
    color: var(--secondary);
    font-weight: 300;
}

#searchResults .icons-grid {
    margin-top: 0;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--tertiary);
}

/* Responsive */
@media (max-width: 1600px) {
    .icons-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (max-width: 1200px) {
    .icons-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .main-content {
        padding: 2rem 2rem 6rem;
    }
}

@media (max-width: 1200px) {
    .right-sidebar {
        display: none;
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .toolbar {
        right: 0;
    }
    
    .bulk-toolbar {
        right: 0;
    }
}

@media (max-width: 768px) {
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex;
    }
    
    /* Hide sidebar by default on mobile */
    .sidebar {
        transform: translateX(-100%);
        z-index: 300;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Show close button in sidebar on mobile */
    .sidebar-close {
        display: block;
    }
    
    /* Logo adjustments for mobile */
    .site-logo {
        width: 32px;
        height: 32px;
    }
    
    .site-title h1 {
        font-size: 1rem;
    }
    
    /* Adjust main content for mobile */
    .main-content {
        margin-left: 0;
        padding-top: 5rem;
    }
    
    .browse-topics {
        margin: 2rem auto;
        padding: 0 1.5rem;
    }
    
    .browse-topics h3 {
        font-size: 1.25rem;
    }
    
    .topics-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .topic-card {
        padding: 1rem 0.75rem;
    }
    
    .topic-card-title {
        font-size: 0.875rem;
    }
    
    .collection-content {
        margin: 3rem auto 1rem;
        padding: 0 1.5rem;
    }
    
    .content-section h2 {
        font-size: 1.5rem;
    }
    
    .content-section p {
        font-size: 0.875rem;
    }
    
    .related-terms-grid,
    .related-collections-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 0.75rem;
    }
    
    .related-term-link,
    .related-collection-link {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .main-content {
        margin-left: 0;
        padding: 2rem 1.5rem 6rem;
    }
    
    .bulk-toolbar {
        left: 0;
        right: 0;
        padding: 1rem 1.5rem;
        gap: 1rem;
    }
    
    .bulk-toolbar-actions {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .bulk-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }
    
    .search-home {
        margin: 3rem auto 2rem;
    }
    
    .search-home h2 {
        font-size: 1.5rem;
    }
    
    .search-home-box input {
        font-size: 0.9375rem;
        padding: 0.875rem 1rem;
    }
    
    .toolbar {
        left: 0;
    }
    
    .icons-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .toolbar {
        padding: 1.5rem 1.5rem;
    }
    
    .toolbar-content {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .toolbar-actions {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .icons-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .icon-card {
        padding: 1rem;
    }
    
    .icon-card svg {
        max-width: 24px;
        max-height: 24px;
    }
    
    .site-logo {
        width: 28px;
        height: 28px;
    }
    
    .site-title h1 {
        font-size: 0.9375rem;
    }
    
    .main-content {
        padding: 1.5rem 1rem 6rem;
    }
}

/* Footer */
.site-footer {
    background: var(--background);
    border-top: 1px solid var(--border);
    padding: 3rem 2rem 1.5rem;
    margin-top: 4rem;
    font-size: 0.9rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-section p {
    color: var(--secondary);
    line-height: 1.8;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: var(--primary);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--secondary);
    font-size: 0.85rem;
}

/* Cookie Consent Banner */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--background);
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.cookie-content p {
    flex: 1;
    min-width: 300px;
    color: var(--primary);
    line-height: 1.6;
}

.cookie-content a {
    color: var(--primary);
    text-decoration: underline;
}

.cookie-actions {
    display: flex;
    gap: 1rem;
}

.cookie-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--primary);
    font-family: 'Funnel Display', serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cookie-btn:hover {
    background: var(--hover);
}

.cookie-btn.accept {
    background: var(--primary);
    color: var(--background);
    border-color: var(--primary);
}

.cookie-btn.accept:hover {
    background: var(--secondary);
}

/* Legal Pages */
.legal-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.legal-page h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.legal-page h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.legal-page h3 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.legal-page p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: var(--secondary);
}

.legal-page ul, .legal-page ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
    color: var(--secondary);
}

.legal-page li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.legal-page a {
    color: var(--primary);
    text-decoration: underline;
}

.legal-page a:hover {
    color: var(--secondary);
}

@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cookie-actions {
        width: 100%;
    }
    
    .cookie-btn {
        flex: 1;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}
