:root {
    --primary: #6C5CE7;
    --primary-hover: #5A4FCF;
    --secondary: #A29BFE;
    --accent: #FD79A8;

    --bg-dark: #1A0D2E;
    --bg-panel: rgba(30, 18, 56, 0.6);
    --bg-input: rgba(13, 11, 30, 0.6);
    --bg-input-hover: rgba(26, 22, 60, 0.8);

    --border: rgba(108, 92, 231, 0.3);
    --border-hover: rgba(162, 155, 254, 0.6);
    --border-focus: var(--primary);

    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    --error: #FF4757;
    --success: #2ED573;

    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Menlo', 'Courier New', monospace;

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;

    /* Subtle background glow */
    background-image:
        radial-gradient(circle at 0% 0%, rgba(108, 92, 231, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(253, 121, 168, 0.1) 0%, transparent 40%);
    background-attachment: fixed;
}

.hidden {
    display: none !important;
}

.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    margin-bottom: 2rem;
    animation: fadeInDown 0.6s var(--transition);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.accent-text {
    background: linear-gradient(135deg, var(--secondary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Workspace Layout */
.workspace {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
    animation: fadeInUp 0.5s var(--transition) 0.1s both;
}

@media (min-width: 1024px) {
    .workspace {
        flex-direction: row;
        align-items: stretch;
        max-height: calc(100vh - 150px);
    }
}

/* Panels */
.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.form-panel {
    flex: 1.2;
}

.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.panel-footer {
    padding: 1.25rem 1.5rem;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid var(--border);
}

.scrollable {
    overflow-y: auto;
}

.scrollable::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.scrollable::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Forms */
.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px dashed var(--border);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group.row {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .form-group.row {
        flex-direction: row;
    }

    .col {
        flex: 1;
        min-width: 0;
        /* fixes flexbox truncation issues */
    }
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

input[type="text"],
select,
textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    background: rgba(108, 92, 231, 0.05);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Color Picker Row */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    transition: var(--transition);
}

.color-picker-wrapper:focus-within {
    border-color: var(--border-focus);
    background: rgba(108, 92, 231, 0.05);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

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

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-text {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 0.5rem !important;
    box-shadow: none !important;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-input);
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(108, 92, 231, 0.05);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
}

.upload-content p {
    font-size: 0.9rem;
    font-weight: 500;
}

.icon-preview {
    max-width: 100px;
    max-height: 100px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    object-fit: contain;
}

.icon-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

/* Code Preview */
.code-wrapper {
    background: rgba(0, 0, 0, 0.4);
    flex: 1;
    padding: 0;
}

pre {
    margin: 0;
    padding: 1.5rem;
    min-height: 100%;
}

.json-code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
    word-break: break-all;
    white-space: pre-wrap;
}

/* JSON Syntax Colors */
.json-key {
    color: var(--secondary);
}

.json-string {
    color: var(--success);
}

.json-number {
    color: var(--accent);
}

.json-boolean {
    color: var(--primary);
}

/* Buttons */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-text {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.text-error {
    color: var(--error);
}

.text-error:hover {
    color: #ff6b81;
    text-decoration: underline;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translate(-50%, 100px);
    background: var(--text-primary);
    color: var(--bg-dark);
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    font-weight: 600;
    font-size: 0.9rem;
}

.toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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