@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,700;1,700&family=Space+Mono:wght@700&family=Montserrat:wght@800;900&family=Cinzel:wght@700;900&family=Shrikhand&display=swap');

:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131b2e;
    --bg-tertiary: #1e294b;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --grout-default: #d1cbd4;
    --sidebar-width: 420px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Layout Scaffolding */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #a5b4fc, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header p {
    font-size: 0.825rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Scrollbar customization */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}
.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

/* Control Groupings */
.section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Input Fields */
input[type="text"], select {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    width: 100%;
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Customized Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-primary);
    outline: none;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    transition: transform 0.1s ease;
    border: 2px solid var(--bg-secondary);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #818cf8;
}

/* Color Pickers Grid */
.color-pickers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s;
}

.color-picker-wrapper:hover {
    border-color: var(--border-hover);
}

.color-picker-wrapper input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    background: none;
}

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

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    box-shadow: var(--shadow-inset);
}

.color-picker-label {
    display: flex;
    flex-direction: column;
}

.color-picker-label span:first-child {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.color-picker-label span:last-child {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    text-transform: uppercase;
}

/* Preset Palettes List */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.preset-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s;
    text-align: left;
}

.preset-btn:hover {
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.preset-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.preset-colors {
    display: flex;
    height: 10px;
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
}

.preset-color-block {
    flex: 1;
    height: 100%;
}

/* Viewport Area */
.viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-primary);
    position: relative;
}

.viewport-header {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background-color: rgba(19, 27, 46, 0.4);
    backdrop-filter: blur(10px);
}

.viewport-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.viewport-title span {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    color: var(--accent-color);
    font-weight: 600;
}

.export-actions {
    display: flex;
    gap: 12px;
}

.btn {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
}

.btn-primary {
    background-color: var(--accent-color);
    border: none;
}

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

/* Workspace Canvas Area */
.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 32px;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
    background-size: 24px 24px;
}

canvas {
    background-color: #ffffff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    cursor: crosshair;
    transition: box-shadow 0.3s;
    max-width: 100%;
}

canvas.dragging {
    cursor: grabbing;
}

/* Footer status bar in viewport */
.viewport-footer {
    height: 40px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(19, 27, 46, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.viewport-footer .interaction-hint {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Collapsible side drawer indicator */
.toggle-sidebar {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

/* Toggle Switch Styling */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    transition: .3s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
    border-color: transparent;
}

input:checked + .slider:before {
    transform: translateX(16px);
    background-color: var(--text-primary);
}

/* Slider Row adjustments */
.switch-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}

/* Dropdown list customization */
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
}

.numeric-display {
    float: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Space Mono', monospace;
}

/* Toast message style */
.toast {
    position: absolute;
    bottom: 60px;
    right: 32px;
    background: rgba(99, 102, 241, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
    z-index: 100;
    backdrop-filter: blur(5px);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

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

/* Sub-section titles within merged cards */
.sub-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 8px 0 6px 0;
    font-weight: 600;
    opacity: 0.7;
}

.sub-section-title:first-child {
    margin-top: 0;
}

/* Divider inside cards */
.section-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 12px 0;
}

/* Textarea styling */
textarea {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    width: 100%;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Accordion Collapsible Sections */
.section-title {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
    position: relative;
    padding-right: 20px;
}

.section-title:hover {
    color: var(--text-secondary);
}

.section-title .chevron {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.3s ease;
    opacity: 0.5;
}

.control-section.collapsed .section-title .chevron {
    transform: translateY(-50%) rotate(-90deg);
}

.control-section .section-body {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.control-section.collapsed .section-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

/* Disabled Color Picker State (finding-3) */
.color-picker-wrapper.disabled {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(0.6);
}

/* Enhanced Color Picker Hover (finding-5) */
.color-picker-wrapper {
    transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
}

.color-picker-wrapper:hover:not(.disabled) {
    border-color: var(--accent-color);
    background-color: rgba(99, 102, 241, 0.05);
    transform: translateY(-1px);
}

/* Enhanced Primary Export Button (finding-4) */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    border: none;
    padding: 10px 24px;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    transition: all 0.25s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #818cf8, var(--accent-color));
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.export-actions .btn:not(.btn-primary) {
    font-size: 0.78rem;
    padding: 6px 12px;
    opacity: 0.8;
}

.export-actions .btn:not(.btn-primary):hover {
    opacity: 1;
}
