/* Color Picker Addon Styles - Оригинальные стили */

.yan-tools-color-picker {
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    position: relative;
    font-size: calc(3vmax + .3em);
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}


/* Заголовок внутри */
.yan-tools-header {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    color: var(--foreground, #fff);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.yan-tools-header h2 {
    margin: 0;
    font-size: 2em;
    font-weight: 300;
    color: inherit;
}

.yan-tools-header p {
    margin: 5px 0 0 0;
    color: inherit;
    font-size: 1em;
    opacity: 0.8;
}

/* CSS Variables */
:root {
    --scale: scale(1);
    --chip-size: 42vmax; /* Увеличено на 20% (35 * 1.2 = 42) */
    --background: #287365; /* Default color */
    --foreground: #fff; /* Default foreground */
    --palette-width: 200px; /* Динамическая ширина палитры */
    --palette-height: 200px; /* Динамическая высота палитры */
    --palette-width-mobile: 160px; /* Динамическая ширина палитры на мобильных */
    --palette-height-mobile: 160px; /* Динамическая высота палитры на мобильных */
    --palette-width-mobile-small: 176px; /* Динамическая ширина палитры на маленьких мобильных */
    --palette-height-mobile-small: 140px; /* Динамическая высота палитры на маленьких мобильных */
}

/* Main container */
.yan-tools-main {
    flex: 1;
    color: var(--foreground, #fff);
    background: var(--background, #333);
    overflow: hidden;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.yan-tools-main::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--chip-size);
    height: var(--chip-size);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: .5em 2em 2em -2em #000;
    background: transparent;
    transition: all 0.5s ease-in-out;
}

.yan-tools-main::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--chip-size);
    height: var(--chip-size);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    background: radial-gradient(circle at 43% 0%, var(--background) 65%, #fff 100%);
    opacity: .3;
    transition: all 0.5s ease-in-out;
}

/* Квадратное состояние (ромб) */
.yan-tools-main.square-shape::before {
    border-radius: 0;
    transform: translate(-50%, -50%) rotate(45deg);
    box-shadow: 0.5em 2em 2em -2em #000, 
                0.3em 1em 1em -1em rgba(0,0,0,0.3);
}

.yan-tools-main.square-shape::after {
    border-radius: 0;
    transform: translate(-50%, -50%) rotate(45deg);
    background: radial-gradient(circle at 43% 0%, var(--background) 65%, #fff 100%);
    opacity: .3;
}

/* Стеклянный эффект с перспективой */
.yan-tools-main.cube3d-shape::before {
    border-radius: 0;
    transform: translate(-50%, -50%) rotateX(15deg) rotateY(-25deg) rotateZ(0deg);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        /* Основная тень стекла */
        0.8em 1.5em 1em -0.5em rgba(0,0,0,0.2),
        /* Отражение света на стекле */
        inset 0.1em 0.1em 0.3em rgba(255,255,255,0.3),
        /* Преломление света */
        inset -0.1em -0.1em 0.2em rgba(255,255,255,0.05),
        /* Блик на краю */
        0 0 0.5em rgba(255,255,255,0.2),
        /* Размытые края */
        inset 0 0 0.3em rgba(255,255,255,0.1);
    animation: glassSway 3s ease-in-out infinite;
}

.yan-tools-main.cube3d-shape::after {
    border-radius: 0;
    transform: translate(-50%, -50%) rotateX(15deg) rotateY(-25deg) rotateZ(0deg);
    background: 
        linear-gradient(135deg, 
            rgba(255,255,255,0.08) 0%, 
            rgba(255,255,255,0.02) 30%, 
            rgba(255,255,255,0.04) 70%, 
            rgba(255,255,255,0.06) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: .4;
    animation: glassSway 3s ease-in-out infinite;
}

/* Круг как закат (больше в 2 раза, наполовину вниз, тень сверху) */
.yan-tools-main.sunset-shape::before {
    width: calc(var(--chip-size) * 2);
    height: calc(var(--chip-size) * 2);
    top: 95%; /* Еще сильно ниже */
    left: 50%;
    box-shadow: 
        -0.5em -2em 2em -2em #000,
        -0.3em -1em 1em -1em rgba(0,0,0,0.3);
}

.yan-tools-main.sunset-shape::after {
    width: calc(var(--chip-size) * 2);
    height: calc(var(--chip-size) * 2);
    top: 95%; /* Еще сильно ниже */
    left: 50%;
    background: radial-gradient(circle at 43% 0%, var(--background) 65%, #fff 100%);
    opacity: .3;
}

/* Анимация перехода от квадрата к стеклу */
@keyframes squareToGlass {
    0% { 
        transform: translate(-50%, -50%) rotate(45deg);
        background: var(--background);
        box-shadow: .5em 2em 2em -2em #000, 
                    0.3em 1em 1em -1em rgba(0,0,0,0.3);
        border-radius: 0;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none;
    }
    50% { 
        transform: translate(-50%, -50%) rotate(22deg) rotateX(7deg) rotateY(-12deg);
        background: rgba(255, 255, 255, 0.05);
        box-shadow: 
            0.6em 1.7em 1.5em -1em rgba(0,0,0,0.35),
            inset 0.05em 0.05em 0.15em rgba(255,255,255,0.2);
        border-radius: 0;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    100% { 
        transform: translate(-50%, -50%) rotateX(15deg) rotateY(-25deg) rotateZ(0deg);
        background: rgba(255, 255, 255, 0.05);
        box-shadow: 
            0.8em 1.5em 1em -0.5em rgba(0,0,0,0.2),
            inset 0.1em 0.1em 0.3em rgba(255,255,255,0.3),
            inset -0.1em -0.1em 0.2em rgba(255,255,255,0.05),
            0 0 0.5em rgba(255,255,255,0.2),
            inset 0 0 0.3em rgba(255,255,255,0.1);
        border-radius: 0;
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Анимация перехода от стекла к закату */
@keyframes glassToSunset {
    0% { 
        transform: translate(-50%, -50%) rotateX(15deg) rotateY(-25deg) rotateZ(0deg);
        width: var(--chip-size);
        height: var(--chip-size);
        top: 50%;
        left: 50%;
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0;
    }
    50% { 
        transform: translate(-50%, -50%) rotateX(7deg) rotateY(-12deg) rotateZ(0deg);
        width: calc(var(--chip-size) * 1.5);
        height: calc(var(--chip-size) * 1.5);
        top: 62.5%;
        left: 50%;
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 50%;
    }
    100% { 
        transform: translate(-50%, -50%) rotate(0deg);
        width: calc(var(--chip-size) * 2);
        height: calc(var(--chip-size) * 2);
        top: 95%;
        left: 50%;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none;
        border-radius: 50%;
        box-shadow: 
            -0.5em -2em 2em -2em #000,
            -0.3em -1em 1em -1em rgba(0,0,0,0.3);
    }
}

/* Анимация покачивания стекла с блеском */
@keyframes glassSway {
    0% { 
        transform: translate(-50%, -50%) rotateX(15deg) rotateY(-25deg) rotateZ(0deg);
        box-shadow: 
            0.8em 1.5em 1em -0.5em rgba(0,0,0,0.3),
            inset 0.1em 0.1em 0.3em rgba(255,255,255,0.4),
            inset -0.1em -0.1em 0.2em rgba(255,255,255,0.1),
            0 0 0.5em rgba(255,255,255,0.3);
    }
    25% { 
        transform: translate(-50%, -50%) rotateX(20deg) rotateY(-20deg) rotateZ(2deg);
        box-shadow: 
            0.8em 1.5em 1em -0.5em rgba(0,0,0,0.3),
            inset 0.15em 0.15em 0.4em rgba(255,255,255,0.5),
            inset -0.1em -0.1em 0.2em rgba(255,255,255,0.1),
            0 0 0.7em rgba(255,255,255,0.4);
    }
    50% { 
        transform: translate(-50%, -50%) rotateX(15deg) rotateY(-25deg) rotateZ(0deg);
        box-shadow: 
            0.8em 1.5em 1em -0.5em rgba(0,0,0,0.3),
            inset 0.1em 0.1em 0.3em rgba(255,255,255,0.4),
            inset -0.1em -0.1em 0.2em rgba(255,255,255,0.1),
            0 0 0.5em rgba(255,255,255,0.3);
    }
    75% { 
        transform: translate(-50%, -50%) rotateX(10deg) rotateY(-30deg) rotateZ(-2deg);
        box-shadow: 
            0.8em 1.5em 1em -0.5em rgba(0,0,0,0.3),
            inset 0.05em 0.05em 0.2em rgba(255,255,255,0.3),
            inset -0.1em -0.1em 0.2em rgba(255,255,255,0.1),
            0 0 0.3em rgba(255,255,255,0.2);
    }
    100% { 
        transform: translate(-50%, -50%) rotateX(15deg) rotateY(-25deg) rotateZ(0deg);
        box-shadow: 
            0.8em 1.5em 1em -0.5em rgba(0,0,0,0.3),
            inset 0.1em 0.1em 0.3em rgba(255,255,255,0.4),
            inset -0.1em -0.1em 0.2em rgba(255,255,255,0.1),
            0 0 0.5em rgba(255,255,255,0.3);
    }
}

/* Input styles */
input {
    display: inline-block;
    border: 0em solid;
    font: inherit;
    text-align: center;
    padding: 0;
    margin: 0;
    background: none;
    color: inherit;
    pointer-events: auto;
    outline: none;
}

.hex-display {
    color: var(--foreground);
    width: 5em;
    font-size: 2em;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    user-select: none;
}

/* HEX отображение для градиента - меньший шрифт */
.hex-display.gradient-mode {
    font-size: 1em;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.2em;
    flex-wrap: nowrap;
    width: auto;
}

.hex-display.gradient-mode .color-part {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.1em 0.2em;
    border-radius: 4px;
}

.hex-display.gradient-mode .color-part:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.hex-display.gradient-mode .color-part::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    right: 0;
    height: 5px;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hex-display.gradient-mode .color-part.color1::after {
    background: var(--color1, #000);
}

.hex-display.gradient-mode .color-part.color2::after {
    background: var(--color2, #000);
}

.hex-display.gradient-mode .separator {
    font-size: 0.8em;
    opacity: 0.7;
}

/* Кликабельное описание градиента */
.text.gradient-description {
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.text.gradient-description:hover {
    opacity: 1;
    transform: scale(1.05);
}

/* Luxury pattern background */
.luxury-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    background: 
        linear-gradient(45deg, rgba(0,0,0,0.3) 0%, rgba(26,26,26,0.2) 25%, rgba(51,51,51,0.1) 50%, rgba(102,102,102,0.1) 75%, rgba(153,153,153,0.1) 90%, rgba(255,255,255,0.2) 100%),
        linear-gradient(45deg, rgba(0,0,0,0.1) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(0,0,0,0.1) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.05) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.05) 75%);
    background-size: 100% 100%, 40px 40px, 40px 40px, 40px 40px, 40px 40px;
    background-position: 0 0, 0 0, 0 20px, 20px -20px, -20px 0px;
}

input[type="color"] {
    appearance: none;
    cursor: pointer;
    width: var(--chip-size);
    height: var(--chip-size);
    overflow: hidden;
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: .2;
}

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

input[type="color"]::-webkit-color-swatch { 
    border: none; 
}

/* Info block */
.info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    text-align: center;
    z-index: 10;
}

/* Text display */
.text {
    pointer-events: auto;
    border-radius: 2em;
    padding: .3em .5em;
    margin-top: 1em;
    line-height: 1.4;
    opacity: .5;
    transition: opacity 300ms ease-out;
    font-weight: 500;
    font-size: 0.5em;
}

.text:hover {
    opacity: 1;
}

/* Контролы */
.controls {
    position: absolute;
    top: 200%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 1em;
    align-items: center;
}

/* Random button */
.rando {
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 2.5em;
    height: 2.5em;
    border: .1em solid;
    opacity: .3;
    cursor: pointer;
    user-select: none;
    pointer-events: auto;
    transition: opacity 300ms ease-out;
    font-size: 0.5em;
}

.rando:hover {
    opacity: .6;
}

/* Shape button */
.shape-btn {
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 2.5em;
    height: 2.5em;
    border: .1em solid;
    opacity: .3;
    cursor: pointer;
    user-select: none;
    pointer-events: auto;
    transition: opacity 300ms ease-out;
    font-size: 0.5em;
}

.shape-btn:hover {
    opacity: .6;
}

/* Picker button */
.picker-btn {
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 2.5em;
    height: 2.5em;
    border: .1em solid;
    opacity: .3;
    cursor: pointer;
    user-select: none;
    pointer-events: auto;
    transition: opacity 300ms ease-out;
    font-size: 0.5em;
}

.picker-btn:hover {
    opacity: .6;
}

/* Анимация сияния для кнопки пикера */
@keyframes pickerGlow {
    0% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.6);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
        transform: scale(1);
    }
}

.picker-btn.glow {
    animation: pickerGlow 1.5s ease-in-out infinite;
}

/* Кнопка закрытия пикера */
.picker-close-btn {
    position: absolute;
    top: -31px;
    right: -31px;
    width: 32px;
    height: 32px;
   
 
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;

  
}

.custom-color-picker.show .picker-close-btn {
    display: flex !important;
    animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-360deg);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2) rotate(-180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes fadeOutScale {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) rotate(360deg);
    }
}

.picker-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.picker-close-btn:active {
    transform: scale(0.95);
}

/* Стили для HEX инпута */
input#hex-input {
    background-color: unset;
    color: white;
    font-weight: 500;
    font-size: 1em;
}

/* Уведомление о копировании */
.copy-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.37em;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.copy-notification.show {
    opacity: 1;
}

/* ===== КАСТОМНЫЙ ЦВЕТОВОЙ ПИКЕР ===== */

.custom-color-picker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.4), 
                0 0 0 1px rgba(255,255,255,0.1) inset;
    padding: 20px;
    min-width: 320px;
    z-index: 1000;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: move;
}

.custom-color-picker.dragging {
    cursor: grabbing;
    transition: none;
}

/* Исключения для элементов управления - обычный курсор */
.custom-color-picker input,
.custom-color-picker button,
.custom-color-picker .slider,
.custom-color-picker .slider-handle,
.custom-color-picker .color-preview,
.custom-color-picker .gradient-preview,
.custom-color-picker .gradient-slider,
.custom-color-picker .gradient-slider-handle,
.custom-color-picker .gradient-slider-controls,
.custom-color-picker .gradient-toggles,
.custom-color-picker .gradient-toggle,
.custom-color-picker .alpha-toggle,
.custom-color-picker label,
.custom-color-picker span {
    cursor: default;
}

.custom-color-picker.show {
    display: block;
    animation: pickerShow 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes pickerShow {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotateY(-15deg);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.05) rotateY(5deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotateY(0deg);
    }
}

.custom-color-picker.hide {
    animation: pickerHide 0.3s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

@keyframes pickerHide {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotateY(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotateY(15deg);
    }
}

/* Заголовок пикера */
.picker-header {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 500;
    min-height: 60px;
    cursor: move;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.header-spacer {
    flex: 1;
}

.picker-header .hex-display {
    width: 80px;
    min-width: 80px;
    font-size: 1.2em;
    pointer-events: auto;
}

/* Кнопка пипетки */
.eyedropper-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    margin-right: 10px;
    user-select: none;
    position: relative;
}

/* Скрытый нативный color input для пипетки - позиционируем рядом с кнопкой */
#native-color-picker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    border: none;
    outline: none;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.eyedropper-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.eyedropper-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

.picker-header:hover {
    background: rgba(255, 255, 255, 0.15);
}

.color-preview {
    display: none;
}


.rgb-display {
    font-weight: 500;
    font-size: 1.3em;
}

.hex-display {
    background: none;
    border: none;
    color: white;
    font-weight: 600;
    font-size: 1.5em;
    outline: none;
    text-align: center;
    min-width: 100px;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.hex-display:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hex-display:focus {
    background-color: rgba(255, 255, 255, 0.2);
}

.picker-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.picker-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Контролы градиента */
.gradient-controls {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Чекбокс градиента */
.gradient-toggles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.gradient-toggle {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.gradient-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.gradient-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
}

.gradient-label {
    color: white;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
}

/* Ползунки градиента */
.gradient-slider-container {
    margin-top: 10px;
}

/* Сетка ползунков градиента */
.gradient-sliders-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.gradient-slider-item {
    display: flex;
    flex-direction: column;
}

.gradient-slider-label {
    color: white;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 6px;
}

.gradient-slider {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gradient-slider-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 3px;
    background: linear-gradient(to right, 
        rgba(252, 88, 48, 0.8) 0%, 
        rgba(100, 150, 200, 0.8) 100%);
}

.gradient-slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.gradient-slider-handle:active {
    cursor: grabbing;
}

.gradient-slider-value {
    color: white;
    font-size: 10px;
    font-weight: 500;
    text-align: right;
}

/* Чекбокс "за мышкой" */
.mouse-follow-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
}

.mouse-follow-toggle input[type="checkbox"] {
    width: 12px;
    height: 12px;
    accent-color: #007cba;
}

.mouse-follow-toggle label {
    color: white;
    font-size: 9px;
    font-weight: 500;
    cursor: pointer;
}

/* Чекбокс "закруглить градиент" */
.round-gradient-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.round-gradient-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #007cba;
}

.round-gradient-toggle label {
    color: white;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    line-height: normal;
}

/* Тело пикера */
.picker-body {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

/* Контейнер для двух пикеров */
.picker-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.picker-single {
    flex: 1;
}

.picker-gradient {
    display: none;
    flex: 1;
}

.picker-gradient.active {
    display: block;
}

/* Заголовок второго пикера */
.picker-header-secondary {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 500;
    min-height: 60px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.picker-header-secondary .hex-display-secondary {
    width: 80px;
    min-width: 80px;
    font-size: 1.2em;
    pointer-events: auto;
}

.picker-header-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.picker-header-secondary .color-preview,
.picker-header-secondary .color-preview-secondary {
    display: none;
}

.picker-header-secondary .hex-display {
    font-size: 1.5em;
    font-weight: 600;
    min-width: 100px;
    color: white;
}

/* ===== ВТОРОЙ ПИКЕР (ГРАДИЕНТ) ===== */

/* Тело второго пикера */
.picker-body-secondary {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

/* Квадрат насыщенности и яркости для второго пикера */
.saturation-brightness-secondary {
    position: relative;
    width: var(--palette-width);
    height: var(--palette-height);
    border-radius: 8px;
    cursor: crosshair;
    overflow: hidden;
    transition: width 0.3s ease, height 0.3s ease;
}

.saturation-brightness-bg-secondary {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #4a90e2;
}

.saturation-brightness-white-secondary {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, white, transparent);
}

.saturation-brightness-black-secondary {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent, black);
}

/* Полосы для оттенка и альфа для второго пикера */
.hue-slider-secondary,
.alpha-slider-secondary {
    position: relative;
    width: 30px;
    height: 200px;
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    transition: width 0.3s ease-in-out;
}

/* Анимация появления ползунка прозрачности для второго пикера */
.alpha-slider-secondary.alpha-slider-hidden {
    width: 0px;
    opacity: 0;
    transition: width 0.3s ease-in-out, opacity 0.2s ease-in-out;
}

.alpha-slider-secondary.alpha-slider-visible {
    width: 30px;
    opacity: 1;
    transition: width 0.3s ease-in-out, opacity 0.2s ease-in-out;
}

.hue-bg-secondary {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, 
        #ff0000 0%, 
        #ffff00 16.66%, 
        #00ff00 33.33%, 
        #00ffff 50%, 
        #0000ff 66.66%, 
        #ff00ff 83.33%, 
        #ff0000 100%);
}

.alpha-bg-secondary {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #4a90e2;
}

.alpha-pattern-secondary {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(45deg, rgba(0,0,0,0.3) 0%, rgba(26,26,26,0.2) 25%, rgba(51,51,51,0.1) 50%, rgba(102,102,102,0.1) 75%, rgba(153,153,153,0.1) 90%, rgba(255,255,255,0.2) 100%),
        linear-gradient(45deg, #ccc 25%, transparent 25%), 
        linear-gradient(-45deg, #ccc 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #ccc 75%), 
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 100% 100%, 8px 8px, 8px 8px, 8px 8px, 8px 8px;
    background-position: 0 0, 0 0, 0 4px, 4px -4px, -4px 0px;
    mask: linear-gradient(to bottom, transparent, black);
    -webkit-mask: linear-gradient(to bottom, transparent, black);
}

/* Ручки второго пикера */
.picker-handle-secondary {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

#gradient-sb-handle {
    top: 20%;
    left: 80%;
}

#gradient-hue-handle {
    top: 0%;
    left: 50%;
}

#gradient-alpha-handle {
    top: 0%;
    left: 50%;
}

/* Превью цвета для второго пикера */
.color-preview-secondary {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a90e2;
    margin-right: 10px;
    position: relative;
    overflow: hidden;
}

.color-preview-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(45deg, #ccc 25%, transparent 25%), 
        linear-gradient(-45deg, #ccc 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #ccc 75%), 
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 4px 4px;
    background-position: 0 0, 0 2px, 2px -2px, -2px 0px;
    z-index: 1;
}

.color-preview-secondary::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    z-index: 2;
}

/* HEX инпут для второго пикера */
.hex-display-secondary {
    background: none;
    border: none;
    color: white;
    font-weight: 600;
    font-size: 1.5em;
    outline: none;
    text-align: center;
    min-width: 100px;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.hex-display-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hex-display-secondary:focus {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Квадрат насыщенности и яркости */
.saturation-brightness {
    position: relative;
    width: var(--palette-width);
    height: var(--palette-height);
    border-radius: 8px;
    cursor: crosshair;
    overflow: hidden;
    transition: width 0.3s ease, height 0.3s ease;
}

.saturation-brightness-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #287365;
}

.saturation-brightness-white {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, white, transparent);
}

.saturation-brightness-black {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent, black);
}

/* Полосы для оттенка и альфа */
.hue-slider,
.alpha-slider {
    position: relative;
    width: 30px;
    height: 200px;
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    transition: width 0.3s ease-in-out;
}

/* Анимация появления ползунка прозрачности */
.alpha-slider.alpha-slider-hidden {
    width: 0px;
    opacity: 0;
    transition: width 0.3s ease-in-out, opacity 0.2s ease-in-out;
}

.alpha-slider.alpha-slider-visible {
    width: 30px;
    opacity: 1;
    transition: width 0.3s ease-in-out, opacity 0.2s ease-in-out;
}

.hue-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, 
        #ff0000 0%, 
        #ffff00 16.66%, 
        #00ff00 33.33%, 
        #00ffff 50%, 
        #0000ff 66.66%, 
        #ff00ff 83.33%, 
        #ff0000 100%);
}

.alpha-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #287365;
}

.alpha-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(45deg, rgba(0,0,0,0.3) 0%, rgba(26,26,26,0.2) 25%, rgba(51,51,51,0.1) 50%, rgba(102,102,102,0.1) 75%, rgba(153,153,153,0.1) 90%, rgba(255,255,255,0.2) 100%),
        linear-gradient(45deg, #ccc 25%, transparent 25%), 
        linear-gradient(-45deg, #ccc 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #ccc 75%), 
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 100% 100%, 8px 8px, 8px 8px, 8px 8px, 8px 8px;
    background-position: 0 0, 0 0, 0 4px, 4px -4px, -4px 0px;
    mask: linear-gradient(to bottom, transparent, black);
    -webkit-mask: linear-gradient(to bottom, transparent, black);
}

/* Ручки пикера */
.picker-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

#sb-handle {
    top: 20%;
    left: 80%;
}

#hue-handle {
    top: 0%;
    left: 50%;
}

#alpha-handle {
    top: 0%;
    left: 50%;
}

/* Стили для переключателя альфа-канала */
.alpha-toggle {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.alpha-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.alpha-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
}

.alpha-toggle label {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

/* Стили для HEX полей */
input#picker-hex-input {
    color: white;
}

input#gradient-hex-input {
    color: white;
}

/* Стили для контролов поворота градиента */
.gradient-slider-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

/* Стили для неактивных ползунков градиента */
.gradient-slider.disabled {
    opacity: 0.4 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    filter: grayscale(50%) !important;
}

.gradient-slider.disabled .gradient-slider-handle {
    opacity: 0.2 !important;
    cursor: not-allowed !important;
    background: #666 !important;
    border-color: #999 !important;
}

.gradient-slider.disabled .gradient-slider-track {
    opacity: 0.3 !important;
    filter: grayscale(70%) !important;
}

.gradient-slider.disabled .gradient-slider-value {
    opacity: 0.4 !important;
    color: #999 !important;
}

/* Дополнительные стили для контейнера неактивного ползунка */
.gradient-slider-item:has(.gradient-slider.disabled) {
    opacity: 0.5 !important;
}

.gradient-slider-item:has(.gradient-slider.disabled) .gradient-slider-label {
    opacity: 0.5 !important;
    color: #999 !important;
}

/* Альтернативные стили для лучшей совместимости */
.gradient-slider-item.disabled {
    opacity: 0.5 !important;
}

.gradient-slider-item.disabled .gradient-slider-label {
    opacity: 0.5 !important;
    color: #999 !important;
}

.gradient-slider-controls .mouse-follow-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gradient-slider-controls .mouse-follow-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.gradient-slider-controls .mouse-follow-toggle label {
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.gradient-slider-controls .gradient-slider-value {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .custom-color-picker {
        transform: translate(-50%, -50%) scale(0.9);
        padding: 15px;
        min-width: 280px;
    }
    
    .picker-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .picker-header,
    .picker-header-secondary {
        padding: 12px 15px;
        margin-bottom: 15px;
        min-height: 50px;
    }
    
    .picker-body,
    .picker-body-secondary {
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .saturation-brightness,
    .saturation-brightness-secondary {
        width: var(--palette-width-mobile);
        height: var(--palette-height-mobile);
    }
    
    .hue-slider,
    .hue-slider-secondary,
    .alpha-slider,
    .alpha-slider-secondary {
        width: 25px;
        height: 160px;
    }
    
    /* Анимация появления ползунка прозрачности на планшетах */
    .alpha-slider.alpha-slider-hidden,
    .alpha-slider-secondary.alpha-slider-hidden {
        width: 0px;
    }
    
    .alpha-slider.alpha-slider-visible,
    .alpha-slider-secondary.alpha-slider-visible {
        width: 25px;
    }
    
    .gradient-sliders-grid {
        gap: 10px;
    }
    
    .gradient-slider-item {
        margin-bottom: 8px;
    }
    
    .gradient-slider {
        height: 8px;
        margin-bottom: 3px;
    }
    
    .gradient-slider-handle {
        width: 16px;
        height: 16px;
    }
    
    .gradient-slider-handle::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 30px;
        height: 30px;
        transform: translate(-50%, -50%);
        background: transparent;
        border-radius: 50%;
        z-index: 11;
    }
    
    .gradient-slider-value {
        font-size: 9px;
        pointer-events: none;
        z-index: 1;
    }
    
    .gradient-slider-item {
        pointer-events: none;
    }
    
    .gradient-slider-item .gradient-slider {
        pointer-events: auto;
        z-index: 5;
    }
    
    .gradient-slider-handle {
        z-index: 10;
    }
    
    .gradient-toggles {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .gradient-toggle,
    .alpha-toggle {
        padding: 8px 12px;
    }
    
    .mouse-follow-toggle {
        display: none !important;
    }
    
    .picker-header-secondary {
        display: none;
    }
    
    .picker-header {
        display: none;
    }
    
    .gradient-controls {
        margin-top: 0px;
    }
    
    .eyedropper-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
        margin-right: 8px;
    }
}

@media (max-width: 480px) {
    .custom-color-picker {
        transform: translate(-50%, -50%) scale(0.85);
        padding: 12px;
        min-width: 260px;
    }
    
    .saturation-brightness,
    .saturation-brightness-secondary {
        width: var(--palette-width-mobile-small);
        height: var(--palette-height-mobile-small);
    }
    
    .hue-slider,
    .hue-slider-secondary,
    .alpha-slider,
    .alpha-slider-secondary {
        width: 20px;
        height: 140px;
    }
    
    /* Анимация появления ползунка прозрачности на маленьких мобильных */
    .alpha-slider.alpha-slider-hidden,
    .alpha-slider-secondary.alpha-slider-hidden {
        width: 0px;
    }
    
    .alpha-slider.alpha-slider-visible,
    .alpha-slider-secondary.alpha-slider-visible {
        width: 20px;
    }
    
    .gradient-slider {
        height: 6px;
    }
    
    .gradient-slider-handle {
        width: 14px;
        height: 14px;
    }
    
    .gradient-slider-handle::before {
        width: 26px;
        height: 26px;
    }
    
    .picker-header-secondary {
        display: none;
    }
    
    .picker-header {
        display: none;
    }
    
    .gradient-controls {
        margin-top: 0px;
    }
    
    .eyedropper-btn {
        width: 24px;
        height: 24px;
        font-size: 12px;
        margin-right: 6px;
    }
}

/* Фиксированная высота для значения поворота */
span#gradient-rotation-value {
    min-height: 26px;
}

/* Классы для увеличенных палитр когда прозрачность отключена */
.yan-tools-color-picker.alpha-disabled {
    --palette-width: 233px;
    --palette-height: 200px;
    --palette-width-mobile: 200px;
    --palette-height-mobile: 160px;
    --palette-width-mobile-small: 211px;
    --palette-height-mobile-small: 140px;
}