:root {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.8);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: var(--primary-gradient);
    filter: blur(100px);
    opacity: 0.15;
    border-radius: 50%;
    animation: move 20s infinite alternate;
}

.blob-2 {
    bottom: -100px;
    right: -100px;
    animation: move 25s infinite alternate-reverse;
}

@keyframes move {
    from {
        transform: translate(-10%, -10%) scale(1);
    }

    to {
        transform: translate(20%, 20%) scale(1.1);
    }
}

.color-converter-container {
    width: 100%;
    max-width: 1000px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow-premium);
}

.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 2.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
}

.converter-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

@media (max-width: 850px) {
    .converter-layout {
        grid-template-columns: 1fr;
    }
}

/* Color Picker UI */
.picker-container {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.color-picker-box {
    width: 100%;
    height: 250px;
    background: red;
    position: relative;
    border-radius: 12px;
    cursor: crosshair;
    overflow: hidden;
    user-select: none;
}

.white-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #fff, transparent);
}

.black-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, #000, transparent);
}

.picker-cursor {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 10;
}

.hue-slider-container {
    width: 24px;
    height: 250px;
}

.hue-slider {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            #ff0000 0%, #ffff00 17%, #00ff00 33%,
            #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
}

.hue-cursor {
    position: absolute;
    left: 50%;
    width: 32px;
    height: 8px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    transform: translateX(-50%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.manual-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hex-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.hex-copy-btn {
    position: absolute;
    right: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.hex-copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.hex-copy-btn:active {
    transform: scale(0.9);
}

.current-color-preview {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.input-field {
    flex-grow: 1;
}

.input-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    font-weight: 600;
}

.input-field input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 1.25rem;
    font-family: monospace;
}

/* Results Section */
.results-grid {
    display: grid;
    gap: 1rem;
}

.result-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.result-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 241, 0.1);
}

.result-label {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.result-value {
    font-family: 'Space Mono', monospace;
    font-weight: 600;
    font-size: 1.1rem;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
}

.copy-btn:hover {
    background: #6366f1;
    color: white;
}

/* Tonal Palette */
.palette-section {
    margin-top: 2rem;
}

.palette-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.palette-header h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Dropdown Style */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: space-between;
}

.dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 5px);
    background: #1e293b;
    min-width: 180px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    padding: 0.5rem;
}

.dropdown-content.show {
    display: block;
}

.dropdown-content a {
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    padding-left: 1.25rem;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 0.4rem 0.5rem;
}

.shades-container {
    display: flex;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
}

.shade-box {
    flex: 1;
    height: 100%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.shade-box:hover {
    flex: 4;
    z-index: 10;
}

.shade-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.shade-box:hover .shade-text {
    opacity: 1;
    transform: translateY(0);
}

.shade-box.light .shade-text {
    color: #000;
}

.shade-box.dark .shade-text {
    color: #fff;
}

/* RGB to Hex Section */
.rgb-to-hex-section {
    margin: 4rem auto 0;
    max-width: 800px;
    padding-top: 4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.section-header h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    text-align: center;
}

.rgb-input-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
}

.rgb-inputs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 600px) {
    .rgb-inputs-grid {
        grid-template-columns: 1fr;
    }
}

.rgb-field label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.rgb-field input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 12px;
    font-size: 1.15rem;
    text-align: center;
}

.rgb-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 2.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-primary {
    background: #000;
    color: #fff;
    border: 1px solid #333;
}

.btn-primary:hover {
    background: #333;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.rgb-result-area {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
}

.large-color-preview {
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-secondary);
    position: relative;
    transition: all 0.3s ease;
}

.main-copy-btn {
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.6rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s;
}

.main-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.conversion-table-container {
    padding: 0;
}

.conversion-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.conversion-table th,
.conversion-table td {
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.conversion-table th {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 600;
}

.conversion-table td {
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Space Mono', monospace;
}

.conversion-table tr:last-child td {
    border-bottom: none;
}