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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: #f5f5f7;
    padding: 40px 20px;
}

.palette-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.back-link {
    display: inline-block;
    color: #0071e3;
    text-decoration: none;
    margin-bottom: 20px;
    font-size: 14px;
}

.back-link:hover {
    text-decoration: underline;
}

h1 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #1c1c1e;
}

.color-picker-wrapper {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    height: 200px; /* Фиксируем высоту */
}

.color-preview {
    width: 150px;
    height: 100%;
    border-radius: 12px;
    border: 1px solid #d1d1d6;
    background-color: #CAB7E1; /* Начальный цвет */
    transition: background-color 0.1s;
}

.color-gradient-picker {
    flex: 1;
    height: 100%;
    border-radius: 12px;
    position: relative;
    cursor: crosshair;
    overflow: hidden;
    /* Убрали background, он будет задаваться через JS */
    /* Базовый цвет установим через JS */
    background-color: hsl(267, 100%, 50%);
}

/* Слой белого градиента (слева направо) */
.color-gradient-picker::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to right, white, transparent);
    pointer-events: none;
    border-radius: 12px;
}

/* Слой черного градиента (сверху вниз) */
.color-gradient-picker::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, transparent, black);
    pointer-events: none;
    border-radius: 12px;
}

.color-selector {
    width: 20px;
    height: 20px;
    border: 3px solid white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    pointer-events: none;
    z-index: 10;
}

.hue-slider {
    width: 100%;
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(to right,
        #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
    margin-bottom: 20px;
    position: relative;
    cursor: pointer;
}

.hue-selector {
    width: 24px;
    height: 24px;
    border: 3px solid white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    pointer-events: none;
}

.color-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.color-value-box {
    background: #f8f8fa;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e5e5ea;
    transition: all 0.2s;
}

.color-value-box:hover {
    border-color: #0071e3;
}

.color-value-info {
    flex: 1;
    overflow: hidden;
}

.color-label {
    font-size: 12px;
    color: #8e8e93;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-code {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: #1c1c1e;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #0071e3;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    margin-left: 10px;
    flex-shrink: 0;
    position: relative;
}

.copy-btn:hover {
    background: #0077ed;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,113,227,0.3);
}

.copy-btn.copied {
    background: #34c759;
}

.copy-btn.copied .copy-text {
    display: none;
}

.copy-btn .copy-icon {
    flex-shrink: 0;
    transition: all 0.2s;
}

.copy-btn.copied .copy-icon {
    display: none;
}

.copy-btn::after {
    content: '✓';
    font-weight: bold;
    font-size: 16px;
    display: none;
    position: absolute;
    right: 14px;
}

.copy-btn.copied::after {
    display: block;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1c1c1e;
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast svg {
    color: #34c759;
}
