/* Desaturation Tool Styles */
.desaturation-tool {
    margin-top: 2rem;
}

.tool-card {
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.tool-card-body {
    padding: 2rem;
}

.tool-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Input Column */
.inputs-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;flex-wrap: nowrap;
}

.input-label {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

/* Color Input */
.color-input-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.color-picker-wrapper {
    position: relative;
    flex-shrink: 0;
}

.color-picker {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    padding: 0;
    background: transparent;
    overflow: hidden;
}

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

.color-picker::-webkit-color-swatch {
    border: 3px solid #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.color-picker::-moz-color-swatch {
    border: 3px solid #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.color-preview-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    background-image: 
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
}

.color-preview-box::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 9px;
    background-color: var(--preview-color, #3498db);
}

.text-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.color-text-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 1rem;
    font-size: 1rem;
    
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    color: #1a1a1a;
    transition: all 0.2s ease;
}

.color-text-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-action-btn {
    position: absolute;
    right: 0.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.input-action-btn:hover {
    background: #e5e7eb;
    color: #1a1a1a;
}

/* Method Selection */
.method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 1rem;
}

.method-card {
    padding: 0.75rem 0.625rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: auto;
    height: auto;
}

.method-card:hover {
    border-color: #3b82f6;
    background: #f8faff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.method-card.active {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.method-icon {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    opacity: 0.9;
    line-height: 1.2;
}

.method-card.active .method-icon {
    opacity: 1;
}

.method-name {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
    line-height: 1.3;
}

.method-desc {
    font-size: 0.625rem;
    opacity: 0.7;
    line-height: 1.2;
}

.method-card.active .method-desc {
    opacity: 0.9;
}

/* Saturation Control */
.saturation-control-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.saturation-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saturation-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

.saturation-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    font-variant-numeric: tabular-nums;
}

.slider-container {
    position: relative;
    padding: 0.75rem 0;
    margin: 0.5rem 0;
}

.saturation-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    z-index: 2;
    margin: 0;
    padding: 0;
}

.saturation-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: transparent;
    border: none;
}

.saturation-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #3b82f6;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: -6px;
    position: relative;
}

.saturation-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
    border-color: #2563eb;
}

.saturation-slider::-moz-range-track {
    width: 100%;
    height: 8px;
    background: transparent;
    border: none;
}

.saturation-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #3b82f6;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
    -moz-appearance: none;
}

.saturation-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
    border-color: #2563eb;
}

.slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(to right, #9ca3af 0%, #3b82f6 100%);
    border-radius: 4px;
    transform: translateY(-50%);
    z-index: 1;
}

.slider-fill {
    height: 100%;
    background: linear-gradient(to right, #9ca3af 0%, #3b82f6 100%);
    border-radius: 4px;
    width: 100%;
    transition: width 0.1s ease;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.preset-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.preset-btn {
    flex: 1;
    min-width: 70px;
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #f8faff;
}

.preset-btn.active {
    border-color: #3b82f6;
    background: #3b82f6;
    color: #ffffff;
}

/* Saturation Scale */
.saturation-scale-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    width: 100%;
}

.scale-item {
    width: 100%;
    height: 72px;margin-bottom: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: visible;
    background-image: 
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
}

.scale-item::after {
    content: attr(data-saturation);
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.625rem;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
    transition: bottom 0.2s ease;
    pointer-events: none;
}

.scale-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10;
    border-color: #3b82f6;
}

.scale-item:hover::after {
    bottom: -20px;
    color: #3b82f6;
}

.scale-item .scale-color {
    position: absolute;
    inset: 0;
    border-radius: 6px;
    z-index: 1;
}

/* Result Column */
.result-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 2rem;
    align-self: start;
}

.result-header {
    margin-bottom: 0.5rem;
}

.result-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.result-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.color-display-large {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 2px solid #ffffff;
    background-image: 
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.color-fill {
    position: absolute;
    inset: 0;
    transition: background-color 0.3s ease;
}

.color-values {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.value-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.value-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 40px;
}

.value-text {
    flex: 1;
    font-size: 0.875rem;
    
    color: #1a1a1a;
    word-break: break-all;
}

.copy-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
}

.copy-btn:hover {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
    transform: scale(1.05);
}

/* Result Actions */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.action-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.action-btn.primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.action-btn.secondary {
    background: #ffffff;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

.action-btn.secondary:hover {
    border-color: #9ca3af;
    color: #1a1a1a;
    background: #f9fafb;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: #1a1a1a;
    color: #ffffff;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: auto;
    min-width: 240px;
}

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

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-icon {
    flex-shrink: 0;
    color: #10b981;
}

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .tool-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .result-column {
        position: static;
    }
}

@media (max-width: 768px) {
    .tool-card-body {
        padding: 1.5rem;
    }

    .inputs-column {
        gap: 1.5rem;
    }

    .color-input-container {
        flex-direction: column;
        align-items: stretch;
    }

    .color-picker-wrapper {
        align-self: center;
    }

    .method-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .saturation-scale-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .scale-item {
        height: 50px;
    }

    .preset-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .preset-btn {
        min-width: auto;
    }

    .result-column {
        gap: 1.25rem;
    }
}

@media (max-width: 480px) {
    .tool-card-body {
        padding: 1.25rem;
    }

    .input-label {
        font-size: 0.9375rem;
    }

    .saturation-value {
        font-size: 1.25rem;
    }

    .method-grid {
        grid-template-columns: 1fr;
    }

    .saturation-scale-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .scale-item {
        height: 45px;
    }

    .scale-item::after {
        font-size: 0.5625rem;
        bottom: -16px;
    }

    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }
}
