.rgb-hex-converter {
    margin-bottom: 2rem;
}

.converter-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.color-preview-section {
    order: 1;
}

.color-preview-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.color-preview-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.color-preview-display {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    background: rgb(255, 0, 0);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.color-preview-display::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.color-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.color-value-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

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

.color-value {
    flex: 1;
    font-size: 1.5rem;
    font-weight: 700;
    
    color: #1f2937;
    letter-spacing: 0.05em;
}

.copy-button {
    background: transparent;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.copy-button:active {
    transform: scale(0.95);
}

.copy-button.copied {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.controls-section {
    order: 2;
}

.rgb-controls {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.rgb-channel {
    margin-bottom: 2rem;
}

.rgb-channel:last-child {
    margin-bottom: 0;
}

.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

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

.channel-value {
    font-size: 1.125rem;
    font-weight: 700;
    
    color: #1f2937;
    min-width: 3ch;
    text-align: right;
}

.channel-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.color-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.color-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.color-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

#redSlider {
    background: linear-gradient(to right, rgb(0, var(--green, 0), var(--blue, 0)), rgb(255, var(--green, 0), var(--blue, 0)));
}

#greenSlider {
    background: linear-gradient(to right, rgb(var(--red, 0), 0, var(--blue, 0)), rgb(var(--red, 0), 255, var(--blue, 0)));
}

#blueSlider {
    background: linear-gradient(to right, rgb(var(--red, 0), var(--green, 0), 0), rgb(var(--red, 0), var(--green, 0), 255));
}

.channel-input {
    width: 80px;
    padding: 0.625rem 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    
    text-align: center;
    color: #1f2937;
    transition: all 0.2s ease;
    -moz-appearance: textfield;
}

.channel-input::-webkit-outer-spin-button,
.channel-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

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

.output-formats {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.format-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.format-item:hover {
    background: #f3f4f6;
    transform: translateX(4px);
}

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

.format-value-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    justify-content: flex-end;
}

.format-value {
    font-size: 0.9375rem;
    
    color: #1f2937;
    background: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    flex: 1;
    max-width: 100%;
    word-break: break-all;
}

.copy-button-small {
    background: transparent;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.copy-button-small:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    transform: scale(1.05);
}

.copy-button-small:active {
    transform: scale(0.95);
}

.copy-button-small.copied {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.preset-colors-section {
    margin-top: 3rem;
}

.preset-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
    text-align: center;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin: 0 auto;
}

.preset-color {
    aspect-ratio: 1;
    border-radius: 12px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0.5rem;
}

.preset-color::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preset-color:hover::before {
    opacity: 1;
}

.preset-color:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.preset-color:active {
    transform: translateY(-2px) scale(1.02);
}

.preset-name {
    position: relative;
    z-index: 1;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preset-color:hover .preset-name {
    opacity: 1;
}

.content-section {
    background: #f9fafb;
    border-radius: 16px;
    padding: 2.5rem;
    margin-top: 2rem;
}

.content-section h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.content-block {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.content-block h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
}

.content-block h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.content-block p {
    color: #4b5563;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.content-block ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.content-block ul li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #4b5563;
    line-height: 1.6;
}

.content-block ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: 700;
}

.code-block {
    background: #1f2937;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    overflow-x: auto;
}

.code-block code {
    color: #10b981;
    
    font-size: 0.9375rem;
    white-space: pre;
}

@media (max-width: 768px) {
    .converter-wrapper {
        gap: 1.5rem;
    }

    .color-preview-container {
        padding: 1.5rem;
    }

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

    .rgb-controls,
    .output-formats {
        padding: 1.5rem;
    }

    .channel-controls {
        flex-direction: column;
        gap: 0.75rem;
    }

    .channel-input {
        width: 100%;
    }

    .format-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .format-value-wrapper {
        width: 100%;
        justify-content: flex-start;
    }

    .preset-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.75rem;
    }

    .content-section {
        padding: 1.5rem;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .content-block {
        padding: 1.25rem;
    }
}

@media (min-width: 1024px) {
    .converter-wrapper {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }

    .color-preview-section {
        order: 0;
    }

    .controls-section {
        order: 0;
    }
}
