/* --- Variables & General Styles --- */
:root {
    --primary-color: #8A2BE2; /* BlueViolet */
    --secondary-color: #9370DB; /* MediumPurple */
    --accent-color: #BA55D3; /* MediumOrchid */
    --background-color: #1a0f2d; /* Deep purple */
    --glass-bg: rgba(46, 31, 71, 0.5);
    --text-color: #e9e4f0;
    --shadow-color: rgba(138, 43, 226, 0.25);
    --border-radius: 1rem;
    --font-family: 'Poppins', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    display: grid;
    place-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Animated Background --- */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}

@keyframes float {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 0.7; }
    90% { opacity: 0.7; }
    100% { transform: translateY(-100vh) scale(1.5) rotate(360deg); opacity: 0; }
}

/* --- Layout & Container --- */
.container {
    width: clamp(320px, 90vw, 700px);
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 1rem 3rem var(--shadow-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: perspective(1200px);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    text-align: center;
    overflow: hidden;
}

.container:hover {
    transform: perspective(1200px) translateY(-10px) rotateX(2deg);
    box-shadow: 0 2rem 4rem var(--shadow-color);
}

.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 2.5rem 1.5rem;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.header h1 {
    font-size: 2.25rem;
    font-weight: 700;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* --- Input & Output Areas --- */
.input-area,
.output-area {
    padding: 2rem;
}

.output-area {
    background-color: rgba(0, 0, 0, 0.1);
}

.output-area h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

/* --- Form Elements --- */
.input-container {
    position: relative;
    margin-bottom: 1.5rem;
}

textarea {
    width: 100%;
    height: 150px;
    padding: 1rem;
    border: 2px solid rgba(147, 112, 219, 0.4);
    border-radius: calc(var(--border-radius) / 2);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    resize: vertical;
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.2);
    font-family: inherit;
}

textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.5);
}

.output-container {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(147, 112, 219, 0.3);
    border-radius: calc(var(--border-radius) / 2);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    word-break: break-word;
    min-height: 50px;
    text-align: left;
}

#output {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color);
}

/* --- Buttons --- */
.btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: white;
}

.btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
}

.btn-secondary {
    background: linear-gradient(45deg, var(--secondary-color), #a88beb);
}

/* --- Color Visualizer --- */
.color-visualizer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1rem;
    justify-content: center;
}

.color-sample {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.color-sample:hover {
    transform: scale(1.2);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

/* --- Floating Home Button --- */
.home-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    text-decoration: none;
    z-index: 100;
    box-shadow: 0 8px 25px var(--shadow-color);
    transition: all 0.3s ease;
}

.home-button:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 12px 30px var(--shadow-color);
}

/* --- Notification --- */
.notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #28a745, #218838); /* Success Green */
    color: white;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification.show {
    top: 30px;
}

.notification.error {
    background: linear-gradient(135deg, #dc3545, #c82333); /* Error Red */
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: var(--background-color);
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--primary-color), var(--secondary-color));
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(var(--secondary-color), var(--primary-color));
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .header h1 { font-size: 1.8rem; }
    .header p { font-size: 1rem; }
    .input-area, .output-area { padding: 1.5rem; }
    .btn { padding: 0.8rem 1.5rem; font-size: 1rem; }
    .home-button { width: 50px; height: 50px; font-size: 20px; }
}