/* ===================================
   NOTICONS - MAIN STYLESHEET
   =================================== */

/* ===================================
   0. CUSTOM FONTS
   =================================== */

@font-face {
    font-family: 'TWK Lausanne';
    src: url('../brand/TWKLausanne-300Italic.woff2') format('woff2');
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Lausanne';
    src: url('../brand/TWKLausanne-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Lausanne';
    src: url('../brand/TWKLausanne-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* ===================================
   1. CSS VARIABLES & ROOT STYLES
   =================================== */

:root {
    /* Control Heights */
    --control-height: 45px;
    --control-height-mobile: 45px;
    --control-height-large-mobile: 50px;

    /* Notioneers Primary Colors */
    --depth: #063312;
    --halo: #F2F4F2;
    --bloom: #92EF9A;

    /* Notioneers Neutrals */
    --root: #454F45;
    --sage: #AFCAAF;
    --mist: #DEECDC;
    --stone: #7B847B;
    --veil: #D1E2D1;

    /* Notioneers Accents */
    --shade: #0B1E0F;
    --pulse: #61DB6B;
    --grove: #172D1B;
    --ease: #B5F5B7;

    /* Additional Accents */
    --aeris: #ACD6EF;
    --nimbus: #898AE3;
    --muse: #CBA8E8;
    --coral: #DBB0AF;
    --solea: #F9E8AF;
    --cove: #E5C0A8;

    /* Dynamic text color (will be updated via JS) */
    --text-color: var(--depth);
}

* {
    font-family: 'TWK Lausanne', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    background: var(--halo);
    color: var(--text-color);
    transition: color 0.3s ease, background-color 0.3s ease;
}

/* Smooth transitions for all interactive elements */
button, a, input, select, textarea {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid var(--bloom);
    outline-offset: 2px;
}

/* Prevent layout shift */
img, svg {
    max-width: 100%;
    height: auto;
}

/* ===================================
   2. SCROLLBAR STYLES
   =================================== */

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

::-webkit-scrollbar-track {
    background: var(--mist);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--sage);
    border-radius: 10px;
    transition: background 0.2s;
}

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

/* ===================================
   3. HEADER STYLES
   =================================== */

header {
    backdrop-filter: blur(10px);
    background:var(--halo);
    position: sticky;
    top: 0;
    z-index: 50;
    border-color: var(--mist);
}

.header-container {
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    padding: 16px 20px 10px 20px;
    box-sizing: border-box;
}

/* Responsive padding for header */
@media (min-width: 640px) {
    .header-container {
        padding: 20px 24px 10px 24px;
    }
}

@media (min-width: 1024px) {
    .header-container {
        padding: 24px 32px 10px 32px;
    }
}

@media (min-width: 1536px) {
    .header-container {
        max-width: 1300px;
        padding: 24px 40px 10px 40px;
    }
}

.header-top-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 32px;
}

.header-left {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-right: 24px;
}

.header-logo {
    height: 61px;
    width: auto;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    height: var(--control-height);
    max-width: 100%;
}

/* Direct children that are containers inherit height */
.header-controls > .search-wrapper,
.header-controls > .variant-selector,
.header-controls > .view-mode-toggle-group,
.header-controls > .color-tools-group {
    height: 100%;
}

/* Nested elements in color-tools-group also get full height */
.color-tools-group > .color-mode-toggle-group,
.color-tools-group > #colorPickerContainer {
    height: 100% !important;
}

/* ===================================
   RESPONSIVE LIBRARY & CATEGORY SELECTORS
   Desktop: Always visible horizontal layout
   Mobile: Dropdown/Accordion on click
   =================================== */

/* Selector Wrapper - Base styles for both library and categories */
.library-selector-wrapper,
.categories-selector-wrapper {
    position: relative;
    margin-top: 12px;
}

/* Toggle Button - Shows on mobile, hidden on desktop */
.selector-toggle {
    display: none; /* Hidden by default on desktop */
    width: 100%;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 16px 18px;
    background: white;
    border: 2px solid var(--veil);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--depth);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.selector-toggle:hover {
    background: var(--mist);
    border-color: var(--stone);
}

.selector-toggle:active {
    transform: scale(0.98);
    background: var(--halo);
}

.selector-toggle[aria-expanded="true"] {
    background: var(--mist);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.selector-chevron {
    flex-shrink: 0;
    color: var(--stone);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.selector-toggle[aria-expanded="true"] .selector-chevron {
    transform: rotate(180deg);
    color: var(--depth);
}

/* Dropdown Container */
.selector-dropdown {
    /* Desktop: Always visible */
    display: block;
    background: var(--halo);
    border-radius: 12px;
    border: 1px solid var(--veil);
}

/* Dropdown Content */
.selector-content {
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Categories Grid Layout */
.selector-content.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 110px), 1fr));
    gap: 10px;
}

/* Variant Selector */
.variant-selector {
    position: relative;
    flex-shrink: 0;
    height: 100%;
}

.variant-toggle-btn {
    padding: 0 16px;
    background: white;
    border: 2px solid var(--veil);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 140px;
    height: 100%;
}

.variant-toggle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.variant-toggle-btn:hover {
    border-color: var(--bloom);
    background: var(--ease);
}

.variant-toggle-btn:active {
    transform: scale(0.98);
}

/* Search Field */
/* Search Field - DaisyUI input with brand colors */
.search-wrapper {
    margin-left: auto;
    border: 2px solid var(--veil);
    border-radius: 10px;
    min-height: unset !important;
    height: 100% !important;
    padding: 0 12px !important;
    flex: 1 1 auto !important;
    min-width: 300px !important;
    max-width: 500px !important;
}

.search-wrapper:focus-within {
    border-color: var(--bloom);
    box-shadow: 0 0 0 3px rgba(146, 239, 154, 0.1);
}

.search-icon {
    width: 18px;
    height: 18px;
    color: var(--stone);
    flex-shrink: 0;
}

.search-input {
    border: none;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
}

/* View Mode Toggle - DaisyUI btn-group with brand colors */
.view-mode-toggle-group {
    background: var(--veil);
    border-radius: 10px;
    padding: 4px;
    flex-shrink: 0;
    height: 100%;
    box-sizing: border-box;
}

.view-mode-toggle-group .btn {
    background: transparent;
    border: none;
    color: var(--root);
    border-radius: 8px;
    min-height: unset !important;
    height: 100% !important;
    padding: 0 12px;
}

.view-mode-toggle-group .btn:hover:not(.btn-active) {
    background: rgba(146, 239, 154, 0.2);
}

.view-mode-toggle-group .btn.btn-active {
    background: white;
    color: var(--root);
}

.view-mode-toggle-group .btn svg {
    stroke: currentColor;
}

/* Color Tools Group */
.color-tools-group {
    display: flex;
    gap: 6px;
    align-items: stretch;
    flex-shrink: 0;
}

/* Swap & Magic Wand Buttons */
.icon-tool-btn {
    padding: 0;
    border: 2px solid var(--veil);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--control-height);
    height: 100%;
    aspect-ratio: 1 / 1;
}

.icon-tool-btn:hover {
    background: var(--ease);
    border-color: var(--bloom);
}

.icon-tool-btn:active {
    transform: scale(0.95);
}

/* Main Container */
.main-container {
    max-width: 1300px !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 16px 20px 40px 20px !important;
    display: flex !important;
    gap: 20px !important;
    box-sizing: border-box !important;
}

/* Responsive padding and gap for main container */
@media (min-width: 640px) {
    .main-container {
        padding: 16px 24px 40px 24px !important;
        gap: 20px !important;
    }
}

@media (min-width: 1024px) {
    .main-container {
        padding: 16px 32px 40px 32px !important;
        gap: 24px !important;
    }
}

@media (min-width: 1536px) {
    .main-container {
        max-width: 1300px !important;
        padding: 16px 40px 40px 40px !important;
        gap: 28px !important;
    }
}

.content-wrapper {
    flex: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* Loading & No Results */
.loading-container {
    text-align: center;
    padding: 48px 0;
}

.no-results-container {
    text-align: center;
    padding: 80px 0;
}

.loading-spinner {
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 4px solid var(--veil);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 14px;
    font-weight: 500;
    margin-top: 16px;
    color: var(--stone);
}

.no-results-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    opacity: 0.2;
}

.no-results-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--depth);
}

.no-results-subtitle {
    font-size: 14px;
    margin-top: 8px;
    color: var(--stone);
}

/* Utility Classes */
.hidden {
    display: none;
}

.relative {
    position: relative;
}

.space-y-1 > * + * {
    margin-top: 6px;
}

/* ===================================
   4. ICON CARDS
   =================================== */

.icon-card {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--veil);
}

@media (min-width: 768px) {
    .icon-card {
        will-change: transform;
    }
}

/* Disable hover effects on touch devices for better mobile performance */
@media (hover: hover) and (pointer: fine) {
    .icon-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(6, 51, 18, 0.12);
        border-color: var(--bloom);
    }

    .icon-card:hover .icon-actions {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Delete icon and Apply colors button for recent view */
.icon-delete-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--depth);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.icon-card:hover .icon-delete-btn,
.icon-item:hover .icon-delete-btn {
    opacity: 1;
}

.icon-delete-btn:hover {
    background: var(--bloom);
    transform: scale(1.1);
}

.icon-delete-btn svg {
    width: 12px;
    height: 12px;
    stroke: white;
}

.icon-delete-btn:hover svg {
    stroke: var(--depth);
}

/* Apply colors button for recent view */
.icon-apply-colors-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--depth);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.icon-card:hover .icon-apply-colors-btn,
.icon-item:hover .icon-apply-colors-btn {
    opacity: 1;
}

.icon-apply-colors-btn:hover {
    background: var(--bloom);
    transform: scale(1.1);
}

.icon-apply-colors-btn svg {
    width: 12px;
    height: 12px;
    stroke: white;
}

.icon-apply-colors-btn:hover svg {
    stroke: var(--depth);
}

.icon-card.copied {
    animation: copyPulse 0.5s ease;
}

@keyframes copyPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.icon-preview {
    display: block;
}

.icon-preview svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ===================================
   5. TOOLTIPS
   =================================== */

/* Tooltip for icon cards (only in icon format, not gallery) */
.icon-card-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--depth);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease-out, transform 0.12s ease-out;
    transition-delay: 0.1s;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.icon-card-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--depth);
}

.icon-card:hover .icon-card-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px);
    transition-delay: 0.15s;
}

/* Fast tooltips for buttons with data-tooltip attribute */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--depth);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-out;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--depth);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-out;
    z-index: 1000;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    transition-delay: 0.3s;
}

/* ===================================
   6. ICON ACTION BUTTONS
   =================================== */

.icon-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.icon-action-btn {
    background: var(--bloom);
    border: none;
    color: var(--depth);
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(146, 239, 154, 0.3);
}

.icon-action-btn:hover {
    background: var(--pulse);
    color: var(--depth);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(146, 239, 154, 0.4);
}

.icon-action-btn:active {
    transform: translateY(0);
}

.icon-action-dropdown {
    position: relative;
}

.icon-action-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--veil);
    border-radius: 12px;
    margin-top: 8px;
    min-width: 100px;
    box-shadow: 0 8px 24px rgba(6, 51, 18, 0.12);
    display: none;
    z-index: 100;
    overflow: hidden;
}

.icon-action-dropdown.active .icon-action-menu {
    display: block;
    animation: slideDown 0.2s ease;
}

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

.icon-action-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--depth);
    transition: all 0.2s;
}

.icon-action-menu button:hover {
    background: var(--ease);
    color: var(--grove);
}

/* ===================================
   7. LIBRARY & CATEGORY BUTTONS
   =================================== */

.library-btn, .category-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid var(--veil);
}

.library-btn {
    border-radius:  10px 10px 10px 0!important;
    background: white;
    text-transform: uppercase;
    color: var(--stone);
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    border: 1px solid var(--veil) !important;
    margin-right:3px
}

.library-btn:not(:first-child) {
    margin-left: 0;
}

.library-btn:hover:not(.active) {
    background: var(--mist);
    border-color: var(--sage) !important;
    color: var(--depth);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(6, 51, 18, 0.08);
}

.library-btn.active {
    background: var(--depth);
    color: var(--bloom);
    border-color: var(--depth) !important;
    box-shadow: 0 4px 12px rgba(6, 51, 18, 0.2);
}

.library-btn-recent {
    background: #FFF9E6;
    border-color: #FFE4A0 !important;
}

.library-btn-recent:hover:not(.active) {
    background: #FFF4D0;
    border-color: #FFDB80 !important;
}

.library-btn-recent.active {
    background: var(--depth);
    color: var(--bloom);
    border-color: var(--depth) !important;
}

.category-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--depth);
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    padding: 10px 14px;
    text-align: left;
    width: 100%;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: normal;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-btn::before {
    display: none;
}

.category-btn:hover:not(.active) {
    background: var(--mist);
    border-color: var(--veil);
    color: var(--depth);
    transform: translateX(2px);
}

.category-btn.active {
    background: var(--depth);
    color: var(--bloom);
    font-weight: 600;
    border-color: var(--depth);
    box-shadow: 0 2px 8px rgba(6, 51, 18, 0.15);
}

.category-btn.active::before {
    display: none;
}

/* ===================================
   8. ICONS GRID
   =================================== */

/* Icons grid styles now use Tailwind classes in JavaScript */
/* Keeping only card/cover specific item styles that can't be done with Tailwind */

/* Icon Item - Clean, modern, professional */
.icon-item {
   /* background: white;
    border: 2px solid var(--veil);*/
    border-radius: 16px !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease !important;
    position: relative !important;
    aspect-ratio: 1 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

@media (min-width: 768px) {
    .icon-item {
        will-change: transform;
    }
}

/* Disable hover effects on touch devices */
@media (hover: hover) and (pointer: fine) {
    .icon-item:hover {
        border-color: var(--bloom);
        box-shadow: 0 8px 24px rgba(6, 51, 18, 0.12);
    }
}

.icon-item:active {
    transform: translateY(-2px);
}

/* Icon Name */
.icon-item .icon-name {
    font-size: 12px;
    color: var(--depth);
    text-align: center;
    word-break: break-word;
    font-weight: 500;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Icon Preview Container */
.icon-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-preview svg {
    width: 96px;
    height: 96px;
    transition: transform 0.2s ease;
}

@media (min-width: 768px) {
    .icon-preview svg {
        will-change: transform;
    }
}

@media (hover: hover) and (pointer: fine) {
    .icon-item:hover .icon-preview svg {
        transform: scale(1.08);
    }
}

/* Card Preview (for card format) */
.card-preview {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-preview svg {
    width: 100%;
    height: auto;
}

.cover-preview {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cover-preview svg {
    width: 100%;
    height: auto;
}

/* Card and Cover view specific styles */
.card-preview .icon-item,
.cover-preview .icon-item {
    aspect-ratio: auto !important;
}

/* Icon Actions */
.icon-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 10;
}

.icon-item:hover .icon-actions {
    opacity: 1;
}

.icon-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--depth);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(6, 51, 18, 0.2);
}

.icon-action-btn:hover {
    background: var(--bloom);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(6, 51, 18, 0.3);
}

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

/* Delete Button (for recent icons) */
.icon-delete-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--coral);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    box-shadow: 0 2px 8px rgba(219, 176, 175, 0.3);
    z-index: 10;
}

.icon-item:hover .icon-delete-btn {
    opacity: 1;
}

.icon-delete-btn:hover {
    background: #c9908f;
    transform: scale(1.1);
}

.icon-delete-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

/* Library Section */
.library-section {
    margin-bottom: 56px;
}

.library-section:last-child {
    margin-bottom: 0;
}

.library-header {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--depth);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--veil);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.library-header span:last-child {
    font-size: 11px;
    color: var(--stone);
    font-weight: 500;
}

/* ===================================
   9. SIDEBAR
   =================================== */

.sidebar {
    display: none !important;
    width: 220px !important;
    flex-shrink: 0 !important;
    position: sticky !important;
    top: 200px !important;
    max-height: calc(100vh - 220px) !important;
    overflow-y: auto !important;
    padding: 20px !important;
    background: var(--halo) !important;
    border-radius: 12px !important;
    border: 1px solid var(--veil) !important;
    box-sizing: border-box !important;
}

/* Show sidebar on desktop */
@media (min-width: 1024px) {
    .sidebar {
        display: block !important;
    }
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: var(--sage);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--bloom);
}

.library-section {
    margin-bottom: 48px;
}

.library-header {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--stone);
    margin-bottom: 16px;
    padding-bottom: 0;
    border-bottom: none;
}

/* ===================================
   9. COLOR PICKERS
   =================================== */

/* Color Picker Button - DaisyUI with brand colors only */
#colorPickerContainer {
    position: relative;
}

.color-picker-btn {
    border: 2px solid var(--veil);
    background: transparent;
    height: 100% !important;
    aspect-ratio: 1 / 1;
    min-height: unset !important;
    padding: 0 !important;
}

.color-picker-btn:hover {
    border-color: var(--root);
    background: transparent;
}

/* Color Mode Toggle - DaisyUI btn-group with brand colors */
.color-mode-toggle-group {
    background: var(--veil);
    border-radius: 10px;
    padding: 4px;
    flex-shrink: 0;
    height: 100%;
    box-sizing: border-box;
}

.color-mode-toggle-group .btn {
    background: transparent;
    border: none;
    color: var(--root);
    border-radius: 8px;
    min-height: unset !important;
    height: 100% !important;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    gap: 6px;
}

.color-mode-toggle-group .btn svg {
    flex-shrink: 0;
}

.color-mode-toggle-group .btn:hover:not(.btn-active) {
    background: rgba(146, 239, 154, 0.2);
}

.color-mode-toggle-group .btn.btn-active {
    background: white;
    color: var(--root);
}

.color-text-display {
    font-family: 'Inter', monospace;
    font-size: 13px;
    font-weight: 600;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    position: relative;
    z-index: 1;
}

.color-picker-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 2px solid var(--veil);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 100;
    padding: 16px;
    width: 300px;
}

.color-picker-dropdown.hidden {
    display: none;
}

.color-picker-dropdown h4 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--stone);
    margin-bottom: 12px;
}

.hex-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.hex-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--veil);
    border-radius: 8px;
    font-family: 'Inter', monospace;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.hex-input:focus {
    outline: none;
    border-color: var(--bloom);
    box-shadow: 0 0 0 3px rgba(146, 239, 154, 0.1);
}

.color-preview-large {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--veil);
    flex-shrink: 0;
}

.color-picker-dropdown h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--depth);
    margin: 16px 0 0 0;
}

.color-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 2px solid var(--veil);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 100;
    padding: 16px;
    width: 480px;
    max-height: 80vh;
    overflow-y: auto;
}

.color-dropdown.hidden {
    display: none;
}

/* Mode Toggle */
.color-mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--veil);
    border-radius: 8px;
}

.mode-toggle-btn {
    flex: 1;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--root);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.mode-toggle-btn.active {
    background: white;
    color: var(--root);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Two-column picker grid */
.color-pickers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--veil);
}

/* Gradient Controls */
.gradient-controls {
    margin-bottom: 16px;
    padding-top: 56px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--veil);
    position: relative;
}

.gradient-controls.hidden {
    display: none;
}

/* Dropdown Header */
.dropdown-header {
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 5;
}

.dropdown-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--root);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-preview-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--veil);
    background: white;
}

/* Mode Action Buttons Container */
.mode-action-buttons {
    display: flex;
    gap: 8px;
}

/* Action Tool Buttons - DaisyUI with brand colors only */
.action-tool-btn {
    background: white;
    border: 2px solid var(--veil);
    color: var(--root);
}

.action-tool-btn:hover {
    background: var(--veil);
    border-color: var(--root);
}

/* Solid Color Fields - Two Column Layout */
.solid-color-fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.solid-color-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Solid Opacity Fields - Two Column Layout */
.solid-opacity-fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.solid-opacity-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.opacity-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Gradient Colors Row - Two Column Layout */
.gradient-colors-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.gradient-color-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gradient-color-section {
    margin-bottom: 16px;
}

.gradient-section-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--root);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.gradient-color-row {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.gradient-color-picker {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    box-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.gradient-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 4px;
}

.gradient-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
    box-shadow: none;
}

.gradient-color-picker::-moz-color-swatch {
    border: none;
    border-radius: 4px;
    box-shadow: none;
}


.gradient-hex-input-simple {
    flex: 1;
    height: 44px;
    padding-left: 48px;
    padding-right: 10px;
    border: 2px solid var(--veil);
    border-radius: 8px;
    font-family: 'Inter', monospace;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    background: white;
    box-sizing: border-box;
    transition: all 0.2s;
}

.gradient-hex-input-simple:focus {
    outline: none;
    border-color: var(--bloom);
}

.gradient-control-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.gradient-control-row:last-child {
    margin-bottom: 0;
}

.gradient-label {
    min-width: 60px;
    font-size: 12px;
    font-weight: 600;
    color: var(--root);
    text-transform: uppercase;
}

.gradient-type-buttons {
    flex: 1;
    display: flex;
    gap: 8px;
}

.gradient-type-btn {
    flex: 1;
    padding: 8px 12px;
    background: var(--veil);
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--root);
    cursor: pointer;
    transition: all 0.2s;
}

.gradient-type-btn:hover {
    background: var(--mist);
}

.gradient-type-btn.active {
    background: white;
    border-color: var(--root);
}

.gradient-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--veil);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.gradient-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--root);
    cursor: pointer;
    transition: all 0.2s;
}

.gradient-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.gradient-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--root);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.gradient-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.gradient-value {
    min-width: 40px;
    font-size: 13px;
    font-weight: 600;
    color: var(--root);
    text-align: right;
}

.color-picker-column {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.color-picker-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--stone);
    margin-bottom: 12px;
    align-self: flex-start;
}

/* iro.js Color Picker Container */
#strokeColorPicker,
#bgColorPicker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

/* iro.js Box (SV Palette) */
.IroBox {
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* iro.js Slider Styling */
.IroSlider {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* iro.js Handle - Circle with black and white strokes */
.IroHandle {
    border-radius: 50%;
    box-sizing: border-box;
}

/* Style the SVG circles */
.IroHandle svg {
    display: block;
}

.IroHandle svg circle {
    stroke-width: 2;
}

.IroHandle svg circle:first-child {
    stroke: #000;
    fill: none;
}

.IroHandle svg circle:last-child {
    stroke: #fff;
    fill: none;
}

/* Hex Input */
.color-hex-input {
    width: 100%;
    max-width: 180px;
    padding: 10px 12px;
    border: 2px solid var(--veil);
    border-radius: 8px;
    font-family: 'Inter', monospace;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
    box-sizing: border-box;
}

.color-hex-input:focus {
    outline: none;
    border-color: var(--bloom);
    box-shadow: 0 0 0 3px rgba(146, 239, 154, 0.1);
}

/* Recent Colors Container */
.recent-colors-container {
    padding-top: 0;
    margin-top: 0;
    border-top: none;
}

.recent-colors-label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--stone);
}

/* Recent colors grid now uses Tailwind classes in HTML */

.recent-color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* First item in each row (1, 10, 19, etc.) - left border-radius */
.recent-color-swatch:nth-child(9n+1) {
    border-radius: 18px 0 0 18px;
}

/* Last item in each row (9, 18, 27, etc.) - right border-radius */
.recent-color-swatch:nth-child(9n) {
    border-radius: 0 18px 18px 0;
}

/* Last child overall - always gets right border-radius */
.recent-color-swatch:last-child {
    border-radius: 0 18px 18px 0;
}

/* If it's both first in row AND last overall (only one item) */
.recent-color-swatch:nth-child(9n+1):last-child {
    border-radius: 18px;
}

.recent-color-swatch:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Remove button for recent colors */
.recent-color-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 2;
}

.recent-color-swatch:hover .recent-color-remove {
    opacity: 1;
    pointer-events: auto;
}

.recent-color-remove:hover {
    background: rgba(0, 0, 0, 0.9);
}

.recent-color-icon-preview {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    inset: 0;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.recent-color-swatch:hover .recent-color-icon-preview {
    opacity: 1;
}

.recent-color-icon-preview svg {
    width: 45%;
    height: 45%;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    pointer-events: none;
}

/* Apply overlay for recent colors */
.recent-color-apply-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(6, 51, 18, 0.95);
    color: white;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 4px;
    text-align: center;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.2s ease;
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
}

.recent-color-swatch:hover .recent-color-apply-overlay {
    opacity: 1;
    background: var(--bloom);
    color: var(--depth);
}

.recent-color-apply-overlay:hover {
    background: var(--bloom);
    color: var(--depth);
}

@media (hover: none) {
    /* On touch devices, show overlay on tap */
    .recent-color-apply-overlay {
        opacity: 0.9;
    }
}

/* Color History Dropdown & Variant Dropdown */
.color-history-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: white;
    border: 2px solid var(--veil);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(6, 51, 18, 0.08), 0 2px 8px rgba(6, 51, 18, 0.04);
    z-index: 100;
    min-width: 240px;
    padding: 8px;
    animation: dropdownFadeIn 0.2s ease-out;
}

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

.color-history-dropdown.hidden {
    display: none;
}

/* Variant Options */
.variant-option {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: var(--depth);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.variant-option:hover {
    background: #F5F5F5;
    color: var(--depth);
}

.variant-option.active {
    background: #E8E8E8;
    color: var(--depth);
    font-weight: 600;
}

.variant-option.active::after {
    content: '✓';
    font-size: 16px;
    font-weight: 600;
    color: var(--depth);
}

.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-swatch:hover {
    transform: scale(1.15);
    border-color: var(--bloom);
    box-shadow: 0 4px 12px rgba(146, 239, 154, 0.4);
}

/* Stroke Width Options */
.stroke-width-option {
    color: var(--depth);
}

.stroke-width-option.active {
    background: var(--bloom) !important;
    font-weight: 600;
}

.stroke-width-option:first-child {
    border-radius: 10px 10px 0 0;
}

.stroke-width-option:last-child {
    border-radius: 0 0 10px 10px;
}

input[type="color"] {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 4px;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
    box-shadow: none;
}

input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 4px;
    box-shadow: none;
}

/* ===================================
   10. VIEW MODE BUTTONS
   =================================== */

.format-toggle-btn {
    background: white;
    color: var(--depth);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid var(--veil);
}

.format-toggle-btn.active {
    background: white;
    color: var(--depth);
}

.format-toggle-btn:hover {
    background: var(--mist);
}

/* ===================================
   11. SEARCH FIELD
   =================================== */


#searchInput::placeholder {
    color: var(--stone);
    opacity: 0.6;
}

/* ===================================
   12. VARIANT SELECTOR
   =================================== */

#variantToggleBtn {
    border: 2px solid var(--veil);
    color: var(--depth);
}

#variantDropdown {
    min-width: 160px;
}

/* ===================================
   13. LOADING & NO RESULTS
   =================================== */

.spinner {
    border-color: var(--veil);
    border-top-color: var(--bloom);
}

.loading-text {
    color: var(--stone);
}

.no-results-icon {
    stroke: var(--depth);
}

.no-results-title {
    color: var(--stone);
}

.no-results-subtitle {
    color: var(--stone);
    opacity: 0.7;
}

/* ===================================
   14. ICON ACTION POPUP
   =================================== */

.icon-action-popup {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    max-width: calc(100vw - 32px);
}

.icon-action-popup.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.popup-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(6, 51, 18, 0.15), 0 0 0 1px var(--veil);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    min-width: 300px;
    max-width: 800px;
}

/* Desktop: larger padding and gap */
@media (min-width: 640px) {
    .popup-content {
        padding: 32px;
        gap: 24px;
        min-width: 600px;
    }
}

.popup-top-section {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-direction: column;
}

@media (min-width: 640px) {
    .popup-top-section {
        flex-direction: row;
        gap: 24px;
    }
}

.popup-icon-preview {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    border: 2px solid var(--veil);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: white;
    padding: 0;
    box-shadow: 0 4px 12px rgba(6, 51, 18, 0.08);
}

@media (min-width: 640px) {
    .popup-icon-preview {
        width: 100px;
        height: 100px;
        border-radius: 16px;
    }
}

/* Card format: wider preview with 990:600 aspect ratio */
.popup-icon-preview.card-format {
    width: 132px;
    height: 80px;
}

@media (min-width: 640px) {
    .popup-icon-preview.card-format {
        width: 165px;
        height: 100px;
    }
}

.popup-icon-preview.cover-format {
    width: 100%;
    max-width: 256px;
    height: 100%;
}

@media (min-width: 640px) {
    .popup-icon-preview.cover-format {
        width: 320px;
        height: 100%;
    }
}

.popup-icon-preview > div {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-icon-preview svg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.popup-help-text {
    margin-top: 12px;
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--stone);
    background: var(--mist);
    border-radius: 8px;
    border-left: 3px solid var(--bloom);
}

.popup-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 640px) {
    .popup-info {
        gap: 16px;
    }
}

.popup-icon-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--depth);
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

@media (min-width: 640px) {
    .popup-icon-name {
        font-size: 24px;
        margin: 0 0 8px 0;
    }
}

.popup-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.popup-library {
    display: inline-block!important;
    font-size: 11px;
    font-weight: 600;
    color: var(--stone);
    background: var(--veil);
    padding: 6px 12px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    cursor: pointer;
}

.popup-library:hover {
    background: var(--sage);
    color: var(--depth);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(6, 51, 18, 0.1);
}

.popup-library:active {
    transform: translateY(0);
}

.popup-category {
    font-size: 14px;
    font-weight: 500;
    color: var(--stone);
    letter-spacing: -0.01em;
}

.popup-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding-top: 4px;
}

@media (min-width: 640px) {
    .popup-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 8px;
    }
}

.popup-tags-section {
    padding-top: 20px;
    border-top: 2px solid var(--veil);
}

.popup-tags-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--stone);
    margin-bottom: 12px;
}

.popup-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.popup-tag {
    display: inline-block;
    padding: 8px 14px;
    background: var(--mist);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--depth);
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
}

.popup-tag:hover {
    background: var(--sage);
    transform: translateY(-1px);
    border-color: var(--bloom);
    box-shadow: 0 4px 8px rgba(6, 51, 18, 0.1);
}

.popup-tag:active {
    transform: translateY(0);
}

.popup-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 10px;
    background: white;
    border: 1px solid var(--veil);
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 300;
    color: var(--depth);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(6, 51, 18, 0.05);
}

@media (min-width: 640px) {
    .popup-action-btn {
        gap: 6px;
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 0.75rem;
    }
}

.popup-action-btn:hover {
    background: var(--halo);
    border-color: var(--bloom);
    color: var(--depth);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(6, 51, 18, 0.1);
}

.popup-action-btn:active {
    transform: translateY(0);
}

.popup-action-btn svg {
    stroke: currentColor;
    opacity: 0.8;
}

.popup-action-btn:hover svg {
    opacity: 1;
}

.popup-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    color: var(--stone);
    transition: all 0.2s;
}

.popup-close-btn:hover {
    background: var(--veil);
    border-color: var(--sage);
    color: var(--depth);
}

/* Animation for popup success state */
.popup-action-btn.success {
    background: var(--bloom);
    border-color: var(--pulse);
}

@keyframes popupSlideUp {
    from {
        transform: translateX(-50%) translateY(120%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* ===================================
   15. RESPONSIVE STYLES - MOBILE OPTIMIERUNG
   =================================== */

/* Tablet and Mobile (max-width: 768px) */
@media (max-width: 768px) {
    /* Header */
    .header-container {
        padding: 12px;
    }

    .header-top-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 12px;
    }

    .header-logo {
        height: 28px;
        margin-left: 0 !important;
    }

    .header-controls {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        height: auto;
    }

    .search-wrapper {
        width: 100%;
        margin: 0;
        max-width: none !important;
    }

    .variant-selector {
        width: 100% !important;
        order: 2;
        display: flex !important;
    }

    .variant-selector.hidden {
        display: none !important;
    }

    .variant-toggle-btn {
        width: 100%;
        justify-content: space-between;
        height: var(--control-height-mobile);
        padding: 0 16px;
        font-size: 14px;
    }

    .color-tools-group {
        width: 100%;
        order: 3;
    }

    .color-picker-btn {
        width: var(--control-height-mobile) !important;
        min-height: unset !important;
    }

    .color-picker-button {
        flex: 1 !important;
        min-width: 0 !important;
        font-size: 11px !important;
        padding: 8px !important;
    }

    .color-text-display {
        font-size: 11px !important;
    }

    .view-mode-buttons {
        order: 4;
        display: flex !important;
        gap: 4px;
        flex-shrink: 0;
    }

    .format-toggle-btn {
        min-width: 44px !important;
        width: 44px !important;
        padding: 10px !important;
    }

    .format-toggle-btn svg {
        width: 20px !important;
        height: 20px !important;
    }

    /* Library buttons horizontal scroll */
    .library-buttons-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 12px !important;
        margin: 0 -12px !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        gap: 6px !important;
        border-bottom: 2px solid var(--mist) !important;
    }

    .library-buttons-row::-webkit-scrollbar {
        display: none;
    }

    .library-btn {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        font-size: 11px !important;
        padding: 6px 12px !important;
        min-height: auto !important;
    }

    .library-btn:not(:first-child) {
        margin-left: 0 !important;
    }

    /* Mobile filter button visible */
    .mobile-filter-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    /* Main content */
    .main-container {
        padding: 12px;
        flex-direction: column;
        gap: 0;
    }

    /* Hide sidebar on mobile */
    .sidebar {
        display: none !important;
    }

    /* Icons grid - 3 columns */
    .icons-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px;
    }

    /* Card view - 1 column on mobile */
    .icons-grid.card-view {
        grid-template-columns: 1fr !important;
    }

    .icon-card {
        min-height: 80px;
    }

    .icon-item {
        padding: 12px;
        gap: 8px;
        border-radius: 12px;
    }

    /* Icon actions visible */
    .icon-actions {
        opacity: 1 !important;
    }

    /*适当的 icons 大小 */
    .icon-item svg {
        width: 32px;
        height: 32px;
    }

    .icon-name {
        font-size: 11px;
    }

    /* Touch targets */
    button,
    .library-btn,
    .category-btn,
    .format-toggle-btn,
    .icon-tool-btn {
        min-height: 44px;
    }

    /* Popup mobile */
    .popup-content {
        min-width: calc(100vw - 32px);
        max-width: calc(100vw - 32px);
        flex-direction: column;
        align-items: flex-start;
    }

    .popup-actions {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .popup-action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Tablet specific (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .icons-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 16px;
    }

    .icons-grid.card-view {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Small phones (max 480px) */
@media (max-width: 480px) {
    .header-container {
        padding: 12px;
    }

    .main-container {
        padding: 12px;
    }

    /* 2 columns on small phones */
    .icons-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }

    .header-subtitle {
        font-size: 11px;
        margin-top: 4px;
    }

    .header-count {
        font-size: 11px;
    }

    .library-btn {
        font-size: 12px;
        padding: 8px 12px;
    }

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

/* ===================================
   16. MOBILE DRAWER & FILTERS
   =================================== */

/* Mobile Filter Button - only visible on mobile */
.mobile-filter-btn {
    display: none;
    padding: 12px;
    border: 2px solid var(--veil);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-filter-btn:hover {
    background: var(--ease);
    border-color: var(--bloom);
}

@media (max-width: 768px) {
    .mobile-filter-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }
}

/* Mobile Drawer */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    pointer-events: none;
}

.mobile-drawer:not(.hidden) {
    pointer-events: auto;
}

.mobile-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-drawer:not(.hidden) .mobile-drawer-overlay {
    opacity: 1;
}

.mobile-drawer-content {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background: white;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.mobile-drawer:not(.hidden) .mobile-drawer-content {
    transform: translateX(0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    border-bottom: 2px solid var(--veil);
}

.mobile-drawer-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--stone);
}

.mobile-drawer-close {
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--stone);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-drawer-close:hover {
    color: var(--depth);
}

.mobile-drawer-categories {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.mobile-drawer-categories .category-btn {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    margin-bottom: 4px;
}

/* ===================================
   17. MOBILE COLOR PICKER MODAL
   =================================== */

@media (max-width: 768px) {
    /* Make color dropdown full screen on mobile */
    .color-dropdown {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        z-index: 10000 !important;
        overflow-y: auto;
        padding: 20px;
    }

    /* Stack color pickers vertically */
    .color-pickers-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 24px;
    }

    .color-picker-column {
        width: 100%;
    }

    /* Adjust picker size for mobile */
    .IroBox {
        width: 100% !important;
        max-width: 280px !important;
        height: 200px !important;
        margin: 0 auto;
    }

    .IroSlider {
        margin: 0 auto;
    }

    /* Add close button to color picker on mobile */
    .color-dropdown::before {
        content: '×';
        position: absolute;
        top: 12px;
        right: 12px;
        font-size: 40px;
        line-height: 1;
        color: var(--stone);
        cursor: pointer;
        z-index: 10001;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: var(--halo);
    }

    /* Show palettes but in compact mode on mobile */
    #myPalettesContainer {
        display: block !important;
    }

    .generate-palettes-link {
        display: block !important;
        font-size: 12px;
        padding: 8px 12px;
    }

    /* Recent colors - adjust border radius for 6 columns on mobile */
    .recent-color-swatch:nth-child(9n+1),
    .recent-color-swatch:nth-child(9n) {
        border-radius: 0;
    }

    /* Adjust for 6 columns */
    .recent-color-swatch:nth-child(6n+1) {
        border-radius: 18px 0 0 18px;
    }

    .recent-color-swatch:nth-child(6n) {
        border-radius: 0 18px 18px 0;
    }

    .recent-color-swatch:last-child {
        border-radius: 0 18px 18px 0;
    }

    .recent-color-swatch:nth-child(6n+1):last-child {
        border-radius: 18px;
    }
}

/* Copy Notification - Center of screen */
.copy-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    padding: 16px 24px;
    background: #F9E7B0;
    color: var(--root);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    font-size: 16px;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.copy-notification.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.copy-notification.error {
    background: var(--crimson);
    color: white;
}

/* ===================================
   MOBILE RESPONSIVE LAYOUT
   Optimized for touch devices < 1024px
   =================================== */

@media (max-width: 1023px) {
    
    /* Hide desktop-only elements */
    .header-left,
    .mobile-filter-btn,
    .variant-selector {
        display: none !important;
    }
    
    /* Header structure */
    .header-container {
        padding: 16px 20px 12px 20px;
    }
    
    .header-top-row {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    /* ===================
       ROW 1: SEARCH BAR
       =================== */
    .header-controls {
        order: -10;
        flex-wrap: wrap;
        gap: 8px;
        height: auto;
    }

    .search-wrapper {
        width: 100%;
        height: var(--control-height-large-mobile) !important;
        margin: 0;
        border-radius: 14px;
        box-shadow: 0 2px 10px rgba(6, 51, 18, 0.08);
    }

    .search-wrapper:focus-within {
        box-shadow: 0 4px 16px rgba(181, 245, 183, 0.25);
        transform: translateY(-1px);
    }

    .search-icon {
        width: 22px;
        height: 22px;
    }

    .search-input {
        font-size: 16px;
    }

    /* ===================
       ROW 2: ACTION BUTTONS
       =================== */

    .view-mode-toggle-group {
        flex: 0 0 auto;
        height: var(--control-height-large-mobile) !important;
    }

    .view-mode-toggle-group .btn {
        padding: 10px;
    }

    .color-mode-toggle-group {
        flex: 1 1 auto;
        min-width: 0;
        height: var(--control-height-large-mobile) !important;
    }

    .color-mode-toggle-group .btn {
        flex: 1;
        padding: 0 12px;
    }

    /* On small mobile, show only icons */
    @media (max-width: 639px) {
        .color-mode-toggle-group .btn {
            padding: 0 10px;
        }
    }

    /* Color tools group - mobile */
    .color-tools-group {
        flex: 1 1 auto;
        gap: 6px;
        height: var(--control-height-large-mobile) !important;
    }

    .color-picker-btn {
        width: var(--control-height-large-mobile) !important;
    }

    .icon-tool-btn {
        width: var(--control-height-large-mobile) !important;
        height: var(--control-height-large-mobile) !important;
    }

    
    /* ===================
       ROW 3 & 4: RESPONSIVE SELECTORS (MOBILE)
       =================== */

    /* Show toggle buttons on mobile */
    .selector-toggle {
        display: flex !important;
    }

    /* Hide selector dropdown by default on mobile */
    .selector-dropdown {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        border: none;
        background: transparent;
        transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.25s ease;
    }

    /* Show dropdown when expanded */
    .selector-dropdown.open {
        max-height: 1500px;
        opacity: 1;
        background: white;
        border: 2px solid var(--veil);
        border-top: none;
        border-radius: 0 0 12px 12px;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.3s ease 0.1s;
    }

    /* Mobile selector content adjustments */
    .selector-dropdown.open .selector-content {
        padding: 16px;
        gap: 8px;
    }

    /* Library selector - vertical stacking on mobile */
    .library-selector-wrapper .selector-content {
        flex-direction: column;
    }

    /* Library buttons on mobile - full width, one per row, touch optimized */
    .library-selector-wrapper .library-btn {
        margin: 0 !important;
        width: 100%;
        white-space: nowrap;
        font-size: 14px;
        min-height: 48px;
        padding: 14px 16px;
        text-align: left;
        display: flex;
        align-items: center;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .library-selector-wrapper .library-btn:active {
        transform: scale(0.98);
        background: var(--mist);
    }

    /* Categories grid on mobile - touch optimized */
    .selector-content.categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 90px), 1fr));
        gap: 10px;
    }

    .categories-grid .category-btn {
        font-size: 13px;
        text-align: center;
        min-height: 48px;
        padding: 14px 10px;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .categories-grid .category-btn:active {
        transform: scale(0.97);
        background: var(--mist);
    }

}

/* ===================================
   EXTRA MOBILE OPTIMIZATION
   For smaller devices (max-width: 768px)
   =================================== */

@media (max-width: 768px) {

    /* Larger toggle buttons for small screens */
    .selector-toggle {
        min-height: 56px;
        padding: 18px 20px;
        font-size: 16px;
    }

    .selector-chevron {
        width: 20px;
        height: 20px;
    }

    /* Larger library buttons for better touch */
    .library-selector-wrapper .library-btn {
        min-height: 52px;
        padding: 16px 18px;
        font-size: 15px;
    }

    /* Larger category buttons */
    .selector-content.categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 100px), 1fr));
        gap: 12px;
    }

    .categories-grid .category-btn {
        min-height: 52px;
        padding: 16px 12px;
        font-size: 14px;
    }

    /* More padding in dropdown content */
    .selector-dropdown.open .selector-content {
        padding: 18px;
        gap: 10px;
    }

}

