/* =========================================
   Neumorphism CSS Generator Styles
   Base variables inherit from the app logic,
   but we need neutral base mechanics.
========================================= */

:root {
    /* These values will be overridden by JS, but serve as defaults */
    --base-color: #e0e5ec;
    --text-color: #2d3748;
    --text-muted: #718096;
    --accent-color: #6366f1;
    --panel-bg: rgba(255, 255, 255, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--base-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.3s ease;
}

/* --- Navigation --- */
.tool-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.back-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.back-link:hover {
    opacity: 0.7;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--accent-color);
}

/* --- Container & Header --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

.tool-header {
    text-align: center;
    margin-bottom: 4rem;
}

.header-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-color);
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.tool-header p {
    color: var(--text-muted);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Main Layout --- */
.neumorphism-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    background: var(--panel-bg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
}

/* --- Preview Panel --- */
.preview-panel {
    display: flex;
    flex-direction: column;
    border-radius: 20px;
}

.color-picker-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.5);
    padding: 1rem;
    border-radius: 999px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.color-picker-bar input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
}

.color-picker-bar input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-bar input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.hex-display {
    font-family: monospace;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    letter-spacing: 1px;
}

.preview-stage {
    flex: 1;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--base-color);
    border-radius: 20px;
    transition: background-color 0.3s ease;
    /* Soft inset to distinguish the preview area */
    box-shadow: inset 5px 5px 10px rgba(0, 0, 0, 0.05), inset -5px -5px 10px rgba(255, 255, 255, 0.5);
}

.neu-shape {
    /* Initially flat, JS populates this heavily */
    width: 250px;
    height: 250px;
    border-radius: 50px;
    background-color: var(--base-color);
    box-shadow: 20px 20px 60px #bec3c9, -20px -20px 60px #ffffff;
    transition: background-color 0.3s ease, border-radius 0.1s ease, width 0.1s ease, height 0.1s ease;
}

/* --- Controls Panel --- */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.control-group {
    background: rgba(255, 255, 255, 0.6);
    padding: 1.25rem;
    border-radius: 12px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.slider-header span {
    color: var(--accent-color);
    font-family: monospace;
    font-size: 1.1rem;
}

/* Sliders */
input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    background: transparent;
}

input[type="range"]:focus {
    outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Shape Toggle Buttons */
.shape-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.shape-btn {
    padding: 0.75rem;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.shape-btn i {
    font-size: 1.2rem;
}

.shape-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.shape-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
}

/* --- Code Output --- */
.code-output-wrapper {
    background: #1e293b;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #0f172a;
    border-bottom: 1px solid #334155;
}

.code-header span {
    color: #f8fafc;
    font-weight: 600;
    font-size: 0.875rem;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

pre {
    margin: 0;
    padding: 1.5rem;
    overflow-x: auto;
}

.css-output {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: #e2e8f0;
    line-height: 1.5;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #10b981;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

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

/* --- Responsive --- */
@media (max-width: 1024px) {
    .neumorphism-layout {
        grid-template-columns: 1fr;
    }

    .preview-stage {
        min-height: 300px;
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 2.5rem;
    }

    .shape-buttons {
        grid-template-columns: 1fr 1fr;
    }

    .tool-header {
        margin-bottom: 2rem;
    }

    .neumorphism-layout {
        padding: 1.5rem;
    }
}