:root {
    --bg-main: #f0f2f5;                      /* Clean light gray studio background */
    --bg-sidebar: rgba(255, 255, 255, 0.92); /* Pure white glassmorphic sidebar */
    --bg-card: rgba(37, 120, 188, 0.04);     /* Very soft brand blue card tint */
    --bg-input: #ffffff;                     /* Pristine white input background */
    
    --border-color: rgba(37, 120, 188, 0.12); /* Subtle corporate blue border */
    --border-hover: rgba(37, 120, 188, 0.4);  /* Active hover brand blue border */
    --border-focus: #2578bc;                  /* Make-It Mid-Blue brand color */
    
    --color-text-primary: #1e293b;            /* Deep slate primary text (very readable) */
    --color-text-secondary: #5a738e;          /* Cool corporate slate secondary text */
    
    --accent-purple: #2578bc; /* Make-It Mid-Blue brand color */
    --accent-cyan: #1d5f96;   /* Make-It Darker Blue for secondary states */
    --accent-green: #2e7d32;  /* Green for success */
    --accent-warning: #ed6c02;/* Warm amber warning */
    --accent-error: #d32f2f;  /* Deep crimson error */
    
    --glow-purple: 0 4px 12px rgba(37, 120, 188, 0.18);
    --glow-cyan: 0 4px 12px rgba(29, 95, 150, 0.18);
    
    --font-heading: 'Assistant', 'Space Grotesk', sans-serif;
    --font-body: 'Heebo', 'Outfit', sans-serif;
    
    --sidebar-width: 420px;
    --transition-speed: 0.25s;
}

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

body {
    background-color: var(--bg-main);
    color: var(--color-text-primary);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* App Container Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    backdrop-filter: blur(20px) saturate(160%);
    border-right: 1px solid var(--border-color);
    border-top: 5px solid var(--border-focus); /* Signature top brand bar matching make-it.co.il */
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.03);
}

.app-header {
    padding: 24px 24px 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.5);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 8px rgba(37, 120, 188, 0.25));
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #1e293b 30%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 4px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* Sidebar Scroll Area */
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Custom Scrollbars */
.sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 120, 188, 0.35);
}

/* Configuration Sections */
.config-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.config-section:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 15px rgba(37, 120, 188, 0.03);
}

.config-section h2 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text-primary);
    border-left: 3px solid var(--accent-purple);
    padding-left: 8px;
    line-height: 1;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    background-color: var(--accent-purple);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 30px;
    font-family: var(--font-heading);
    box-shadow: 0 2px 8px rgba(37, 120, 188, 0.15);
}

/* Input Fields & Textarea */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 12px;
    color: var(--color-text-secondary);
}

textarea {
    width: 100%;
    height: 110px;
    background-color: var(--bg-input);
    border: 1px solid rgba(37, 120, 188, 0.2);
    border-radius: 8px;
    color: var(--color-text-primary);
    padding: 10px 12px;
    font-family: monospace;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 120, 188, 0.1);
}

/* Controls Rows */
.control-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-row label {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-header label {
    font-size: 13px;
}

.value-display {
    font-size: 13px;
    font-weight: 600;
    color: var(--border-focus);
    font-family: monospace;
}

/* Select Styling */
select {
    background-color: var(--bg-input);
    border: 1px solid rgba(37, 120, 188, 0.2);
    border-radius: 8px;
    color: var(--color-text-primary);
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    font-family: var(--font-body);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 120, 188, 0.1);
}

/* Range Input (Slider) Custom Styling */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(37, 120, 188, 0.12);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-purple);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(37, 120, 188, 0.35);
    transition: transform 0.1s;
}

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

/* Checkbox Grid Layout */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.checkbox-row input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid rgba(37, 120, 188, 0.35);
    border-radius: 4px;
    background-color: var(--bg-input);
    outline: none;
    cursor: pointer;
    display: grid;
    place-content: center;
    transition: border-color var(--transition-speed), background-color var(--transition-speed);
}

.checkbox-row input[type="checkbox"]::before {
    content: "✓";
    font-size: 12px;
    color: #fff;
    transform: scale(0);
    transition: transform 0.1s ease-in-out;
}

.checkbox-row input[type="checkbox"]:checked {
    background-color: var(--accent-purple);
    border-color: var(--accent-purple);
    box-shadow: 0 2px 8px rgba(37, 120, 188, 0.25);
}

.checkbox-row input[type="checkbox"]:checked::before {
    transform: scale(1);
}

.checkbox-row label {
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

/* Border, Hole & URL options animation sections */
.border-options, .hole-options, .url-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-left: 10px;
    border-left: 1px dashed rgba(37, 120, 188, 0.25);
    transition: max-height 0.3s ease-out, opacity 0.3s;
}

.hidden {
    display: none !important;
}

/* Stats Summary Panel */
.stats-panel {
    background: linear-gradient(135deg, rgba(37, 120, 188, 0.03) 0%, rgba(37, 120, 188, 0.08) 100%);
    border-color: rgba(37, 120, 188, 0.18);
}

.stats-panel h3 {
    font-family: var(--font-heading);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
}

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

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    background-color: #ffffff;
    border-radius: 6px;
    border: 1px solid rgba(37, 120, 188, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.015);
}

.stat-label {
    font-size: 11px;
    color: var(--color-text-secondary);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.stat-value.text-small {
    font-size: 11px;
    font-family: monospace;
}

#stat-status {
    color: var(--accent-purple);
}

/* Action Panel Footer */
.action-panel {
    padding: 20px 24px 24px 24px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.02);
}

.btn {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    padding: 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.1s, box-shadow var(--transition-speed), filter var(--transition-speed);
}

.btn-primary {
    background-color: var(--accent-purple); /* Solid Make-It brand blue */
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 120, 188, 0.2);
}

.btn-primary:hover {
    background-color: var(--accent-cyan); /* Darker shade blue on hover */
    box-shadow: 0 6px 16px rgba(37, 120, 188, 0.35);
}

.btn:active {
    transform: scale(0.98);
}

.secondary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-secondary {
    background-color: #ffffff;
    border: 1px solid rgba(37, 120, 188, 0.25);
    color: var(--color-text-secondary);
    padding: 10px;
    font-size: 12px;
}

.btn-secondary:hover {
    border-color: var(--border-focus);
    color: var(--border-focus);
    background-color: rgba(37, 120, 188, 0.02);
}

/* 3D Viewport Styling */
.viewport-container {
    flex: 1;
    position: relative;
    height: 100%;
}

/* Canvas overlay elements */
.viewport-overlay {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 5;
}

.interaction-tip {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(37, 120, 188, 0.15);
    border-radius: 30px;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--color-text-secondary);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

.separator {
    color: rgba(0, 0, 0, 0.08);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(240, 242, 245, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    z-index: 15;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(37, 120, 188, 0.06);
    border-top: 3px solid var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 4px 12px rgba(37, 120, 188, 0.15);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading-text {
    font-family: var(--font-heading);
    font-size: 15px;
    color: var(--accent-purple);
    letter-spacing: 0.5px;
}

/* Warning Overlay */
.warning-overlay {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(237, 108, 2, 0.08);
    border: 1px solid var(--accent-warning);
    backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
    box-shadow: 0 6px 20px rgba(237, 108, 2, 0.15);
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
    from { transform: translate(-50%, -20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.warning-icon {
    font-size: 16px;
}

.warning-msg {
    font-size: 13px;
    font-weight: 500;
    color: #b25302;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 60%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .viewport-container {
        height: 40%;
    }
    
    .interaction-tip {
        font-size: 10px;
        padding: 4px 10px;
    }
}

/* Dropdown Font option previews */
option[value="amaticsc"] {
    font-family: 'Amatic SC', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
}
option[value="fredoka"] {
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
}
option[value="rubikbubbles"] {
    font-family: 'Rubik Bubbles', sans-serif;
    font-size: 1.1rem;
}
option[value="rubik"] {
    font-family: 'Rubik', sans-serif;
    font-weight: 700;
}
option[value="heebo"] {
    font-family: 'Heebo', sans-serif;
    font-weight: 700;
}
option[value="secularone"] {
    font-family: 'Secular One', sans-serif;
}
option[value="varelaround"] {
    font-family: 'Varela Round', sans-serif;
}
option[value="frankruhl"] {
    font-family: 'Frank Ruhl Libre', serif;
    font-weight: 800;
}
