﻿@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;800&display=swap');

:root {
    --bg-main: #050505;
    --bg-card: rgba(20, 20, 20, 0.4);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --accent-glow: rgba(99, 102, 241, 0.5);
    --accent-gradient: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    --danger: #ff4545;
    --danger-glow: rgba(255, 69, 69, 0.2);
    --success: #0df09a;
    --success-glow: rgba(13, 240, 154, 0.2);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(168, 85, 247, 0.08), transparent 25%);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 4rem;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 60vw;
    height: 400px;
    background: radial-gradient(ellipse at center, rgba(168, 85, 247, 0.15) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
    filter: blur(40px);
}

.container {
    width: 100%;
    max-width: 900px;
    margin-bottom: 2.5rem;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(to right, #ffffff, #a1a1aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.04em;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.1));
}

.controls {
    display: flex;
    gap: 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1rem 2rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    margin-bottom: 3rem;
    flex-wrap: wrap;
    justify-content: center;
}

select {
    padding: 0.85rem 1.55rem;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    background: rgba(25, 25, 25, 0.8);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:focus,
select:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(40, 40, 40, 0.8);
}

select option {
    background: var(--bg-main);
    color: var(--text-primary);
}

button {
    padding: 0.85rem 1.75rem;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 600;
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px var(--accent-glow);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px var(--accent-glow);
    filter: brightness(1.06);
}

button:active {
    transform: translateY(1px) scale(0.98);
}

.palette {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.color-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: center top;
    cursor: pointer;
    opacity: 0;
}

.color-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    background: rgba(30, 30, 30, 0.5);
}

.color-box {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.color-card:hover .color-box {
    transform: scale(1.03);
}

.color-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    text-align: center;
}

.color-hex {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 1px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.color-rgb {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.copy-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.3s ease;
    margin-top: 0.2rem;
}

.color-card:hover .copy-hint {
    opacity: 1;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Styling for the dynamically generated divs from JS */
.color {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 150px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 1px;
    color: var(--text-primary);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.color:hover {
    border-color: var(--border-hover);
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#copy-color {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-family: 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
    font-weight: 500;
    color: #ffffff;
    border: none;
    border-top-left-radius: 15px;
    border-bottom-left-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1.5rem;
    position: fixed;
    right: 0px;
    top: 10px;
}
