/* ============================================
   Mandala Studio - Adobe Creative Suite Style
   Professional Full-Screen Creative Application
   ============================================ */

/* CSS Variables */
:root {
    /* Adobe-style dark theme colors */
    --studio-bg-darkest: #1e1e1e;
    --studio-bg-dark: #252526;
    --studio-bg-medium: #2d2d2d;
    --studio-bg-light: #3c3c3c;
    --studio-bg-hover: #4a4a4a;
    --studio-bg-active: #094771;
    
    /* Canvas */
    --studio-canvas-bg: #1a1a2e;
    --studio-canvas-light: #ffffff;
    
    /* Text */
    --studio-text: #cccccc;
    --studio-text-bright: #ffffff;
    --studio-text-dim: #808080;
    
    /* Accent */
    --studio-accent: #0078d4;
    --studio-accent-hover: #1a8cff;
    --studio-success: #4ec9b0;
    --studio-warning: #dcdcaa;
    --studio-danger: #f14c4c;
    
    /* Borders */
    --studio-border: #3c3c3c;
    --studio-border-light: #4a4a4a;
    
    /* Layout dimensions */
    --studio-header-height: 32px;
    --studio-toolbar-width: 40px;
    --studio-panel-width: 260px;
    --studio-statusbar-height: 22px;
}

/* ============================================
   Full Page Takeover - Remove Site Chrome
   ============================================ */

.mandala-studio-page {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 9999;
    overflow: hidden;
}

.mandala-studio-page .row,
.mandala-studio-page .col-12 {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
    height: 100% !important;
}

.mandala-studio-page .tool-page-card {
    display: block !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    border-radius: 0 !important;
}

.mandala-studio-page .tool-page-header,
.mandala-studio-page .tool-page-footer {
    display: none !important;
}

.mandala-studio-page .tool-page-body {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* ============================================
   Main Studio Container
   ============================================ */

.mandala-studio-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--studio-bg-darkest);
    color: var(--studio-text);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}

/* ============================================
   Top Menu Bar (Adobe Style)
   ============================================ */

.studio-topbar {
    height: var(--studio-header-height);
    background: var(--studio-bg-dark);
    border-bottom: 1px solid var(--studio-border);
    display: flex;
    align-items: center;
    padding: 0 8px;
    gap: 4px;
    flex-shrink: 0;
    user-select: none;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 6px;
    color: var(--studio-text-bright);
    font-weight: 600;
    font-size: 11px;
    border-right: 1px solid var(--studio-border);
    margin-right: 4px;
    text-decoration: none;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
}

.topbar-brand:hover {
    background: var(--studio-bg-hover);
    color: white;
}

.topbar-brand i {
    color: var(--studio-accent);
    font-size: 14px;
    transition: transform 0.2s;
}

.topbar-brand:hover i {
    transform: rotate(-15deg);
}

.toolbar-left-section {
    display: flex;
    align-items: center;
    gap: 2px;
}

.tool-group {
    display: flex;
    align-items: center;
    background: var(--studio-bg-medium);
    border-radius: 3px;
    padding: 2px;
}

.separator {
    width: 1px;
    height: 16px;
    background: var(--studio-border);
    margin: 0 6px;
}

.toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Buttons */
.icon-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--studio-text);
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: background 0.1s, color 0.1s;
}

.icon-btn:hover:not(:disabled) {
    background: var(--studio-bg-hover);
    color: var(--studio-text-bright);
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.icon-btn.active {
    background: var(--studio-accent);
    color: white;
}

.text-btn {
    height: 24px;
    padding: 0 8px;
    border: none;
    background: transparent;
    color: var(--studio-text);
    border-radius: 2px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.1s;
}

.text-btn:hover {
    background: var(--studio-bg-hover);
    color: var(--studio-text-bright);
}

.text-btn.danger:hover {
    background: var(--studio-danger);
    color: white;
}

.primary-btn {
    height: 26px;
    padding: 0 14px;
    border: none;
    background: linear-gradient(135deg, var(--studio-accent), #005a9e);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(0,120,212,0.25);
}

.primary-btn:hover {
    background: linear-gradient(135deg, var(--studio-accent-hover), var(--studio-accent));
    box-shadow: 0 3px 10px rgba(0,120,212,0.35);
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: translateY(0);
}

.zoom-level {
    font-size: 10px;
    color: var(--studio-text-dim);
    min-width: 36px;
    text-align: center;
    padding: 0 4px;
}

/* ============================================
   Main Workspace Area
   ============================================ */

.mandala-app-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.studio-main-area {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ============================================
   Left Tool Bar (Vertical Icons)
   ============================================ */

.studio-toolbar-left {
    width: var(--studio-toolbar-width);
    background: var(--studio-bg-dark);
    border-right: 1px solid var(--studio-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 0;
    gap: 2px;
    flex-shrink: 0;
}

.tool-item {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    cursor: pointer;
    color: var(--studio-text);
    font-size: 14px;
    transition: all 0.1s;
    position: relative;
    border: none;
    background: transparent;
}

.tool-item:hover {
    background: var(--studio-bg-hover);
    color: var(--studio-text-bright);
}

.tool-item.active {
    background: var(--studio-bg-active);
    color: white;
}

.tool-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--studio-accent);
    border-radius: 0 1px 1px 0;
}

.separator-horizontal {
    width: 24px;
    height: 1px;
    background: var(--studio-border);
    margin: 4px 0;
}

/* Tool Tooltip */
.tool-item[title]::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--studio-bg-darkest);
    color: var(--studio-text-bright);
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
    pointer-events: none;
    z-index: 1000;
    border: 1px solid var(--studio-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.tool-item[title]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Canvas Area (Center - Full Size, Non-Square)
   ============================================ */

.studio-canvas-area {
    flex: 1;
    min-width: 0;
    min-height: 0;
    background: var(--studio-bg-darkest);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    /* Subtle grid pattern */
    background-image: 
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    background-color: #0d0d0d;
}

.canvas-wrapper {
    /* Fill available space - not limited to square */
    width: 100%;
    height: 100%;
    background: transparent;
    position: relative;
}

#mandala-svg {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
    touch-action: none;
    background: radial-gradient(circle at center, var(--studio-canvas-bg) 0%, #0a0a15 100%);
}

/* Light mode canvas */
.canvas-wrapper.light-mode #mandala-svg {
    background: radial-gradient(circle at center, #ffffff 0%, #f0f0f5 100%);
}

/* Preview layer */
#layer-preview path {
    pointer-events: none;
    opacity: 0.6;
}

/* ============================================
   Right Panel (Properties)
   ============================================ */

.studio-sidebar-right {
    width: var(--studio-panel-width);
    background: var(--studio-bg-dark);
    border-left: 1px solid var(--studio-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.studio-sidebar-right::-webkit-scrollbar {
    width: 8px;
}

.studio-sidebar-right::-webkit-scrollbar-track {
    background: var(--studio-bg-dark);
}

.studio-sidebar-right::-webkit-scrollbar-thumb {
    background: var(--studio-bg-light);
    border-radius: 4px;
}

/* Panel Sections */
.panel-section {
    border-bottom: 1px solid var(--studio-border);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--studio-bg-medium);
    cursor: pointer;
    user-select: none;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--studio-text);
}

.section-header:hover {
    background: var(--studio-bg-light);
}

.section-header span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-header i:first-child {
    font-size: 12px;
    opacity: 0.7;
}

.section-header .fa-chevron-down {
    font-size: 9px;
    opacity: 0.5;
    transition: transform 0.2s;
}

.section-header .fa-chevron-down.rotated {
    transform: rotate(-90deg);
}

.section-content {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Remove hard limit to allow full scrolling of large libraries */
    max-height: none; 
    overflow: visible;
    transition: padding 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.section-content.collapsed {
    max-height: 0;
    padding: 0 10px;
    opacity: 0;
    pointer-events: none;
}

/* Panel section when collapsed shows only header */
.panel-section .section-header {
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.panel-section .section-header:hover {
    background: var(--studio-bg-light);
    border-left: 2px solid var(--studio-accent);
    padding-left: 8px;
}

/* ============================================
   Clean Minimal Sliders (Inspired by Lightroom/Figma)
   ============================================ */

.control-group {
    margin-bottom: 8px;
}

.control-group label {
    font-size: 10px;
    color: var(--studio-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: block;
    margin-bottom: 4px;
}

.control-group.checkbox-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.control-group.checkbox-group span {
    font-size: 11px;
    color: var(--studio-text);
}

/* Info icon for tooltips */
.control-group.checkbox-group .info-icon {
    font-size: 10px;
    color: var(--studio-text-dim, rgba(255,255,255,0.4));
    cursor: help;
    margin-left: auto;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.control-group.checkbox-group .info-icon:hover {
    opacity: 1;
    color: var(--studio-accent);
}

/* Minimal Slider Style */
.control-group.lr-slider {
    margin-bottom: 10px;
}

.lr-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.lr-slider-header label {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

.slider-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-number-input {
    width: 40px;
    height: 20px;
    background: #1e1e1e; /* Hardcoded dark background for contrast */
    border: 1px solid var(--studio-border);
    border-radius: 2px;
    color: var(--studio-text-bright);
    font-size: 11px;
    text-align: right;
    padding-right: 4px;
    outline: none;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    -moz-appearance: textfield;
}

.slider-number-input::-webkit-outer-spin-button,
.slider-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.slider-number-input:focus {
    border-color: var(--studio-accent);
    background: var(--studio-bg-dark);
    color: white;
}

/* The Slider Track & Thumb */
.control-group.lr-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1; /* Take remaining space */
    height: 4px; /* Apple style track height */
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    outline: none;
    border: none;
    padding: 0;
    cursor: pointer;
    position: relative;
    margin: 0;
}

.control-group.lr-slider input[type="range"]:focus {
    outline: none;
    box-shadow: none;
}

/* Progress fill using CSS gradient */
.control-group.lr-slider input[type="range"] {
    background: linear-gradient(
        to right,
        #007aff 0%,
        #007aff var(--value, 0%),
        rgba(255,255,255,0.15) var(--value, 0%),
        rgba(255,255,255,0.15) 100%
    );
}

/* Webkit Thumb */
.control-group.lr-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px; /* Apple style thumb size */
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    border: 0.5px solid rgba(0,0,0,0.04);
    margin-top: -7px; /* Center thumb: (18px - 4px) / 2 = 7px */
}

.control-group.lr-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}

.control-group.lr-slider input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.05);
    background: #f2f2f2;
}

/* Firefox Thumb */
.control-group.lr-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #ffffff;
    border: 0.5px solid rgba(0,0,0,0.04);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.control-group.lr-slider input[type="range"]::-moz-range-track {
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

.control-group.lr-slider input[type="range"]::-moz-range-progress {
    height: 4px;
    background: #007aff;
    border-radius: 2px;
}

/* Legacy Range Input (for backward compatibility) */
.range-input-group {
    display: none; /* Hide old style, use lr-slider instead */
}

/* Compact shapes grid for pattern panel */
.shapes-grid.compact {
    gap: 4px;
}

.shapes-grid.compact .shape-btn {
    width: 28px;
    height: 28px;
    padding: 4px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 28px;
    height: 14px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--studio-bg-light);
    border-radius: 7px;
    transition: 0.2s;
}

.toggle-switch .slider::before {
    content: '';
    position: absolute;
    height: 10px;
    width: 10px;
    left: 2px;
    bottom: 2px;
    background: var(--studio-text-dim);
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .slider {
    background: var(--studio-accent);
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(14px);
    background: white;
}

/* Color Picker */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker-wrapper input[type="color"] {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    padding: 0;
    transition: transform 0.1s, box-shadow 0.1s;
}

.color-picker-wrapper input[type="color"]:hover {
    transform: scale(1.05);
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
    border: 2px solid var(--studio-border);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.color-hex {
    font-size: 10px;
    color: var(--studio-text-dim);
    font-family: 'Consolas', monospace;
    text-transform: uppercase;
}

/* Color Swatches */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
}

.color-swatch:hover {
    transform: scale(1.15);
    border-color: var(--studio-text);
}

.color-swatch.active {
    border-color: white;
    box-shadow: 0 0 0 1px var(--studio-accent);
}

/* Select Input */
.select-input {
    width: 100%;
    height: 24px;
    background: var(--studio-bg-medium);
    border: 1px solid var(--studio-border);
    border-radius: 2px;
    color: var(--studio-text);
    font-size: 11px;
    padding: 0 8px;
    cursor: pointer;
    outline: none;
}

.select-input:focus {
    border-color: var(--studio-accent);
}

/* Action Button */
.action-btn {
    width: 100%;
    height: 32px;
    background: linear-gradient(135deg, var(--studio-accent), #005a9e);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
    box-shadow: 0 2px 8px rgba(0,120,212,0.3);
}

.action-btn:hover {
    background: linear-gradient(135deg, var(--studio-accent-hover), var(--studio-accent));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,120,212,0.4);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,120,212,0.3);
}

.action-btn.secondary {
    background: var(--studio-bg-light);
    box-shadow: none;
}

.action-btn.secondary:hover {
    background: var(--studio-bg-hover);
    box-shadow: none;
}

/* Quick Actions */
.quick-actions {
    padding: 10px;
    border-top: 1px solid var(--studio-border);
    margin-top: auto;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 4px;
    background: var(--studio-bg-medium);
    border: 1px solid var(--studio-border);
    border-radius: 4px;
    color: var(--studio-text);
    font-size: 9px;
    cursor: pointer;
    transition: all 0.15s;
}

.quick-action-btn i {
    font-size: 14px;
    transition: transform 0.2s;
}

.quick-action-btn:hover {
    background: var(--studio-bg-hover);
    border-color: var(--studio-accent);
    color: var(--studio-text-bright);
}

.quick-action-btn:hover i {
    transform: scale(1.1);
    color: var(--studio-accent);
}

.quick-action-btn:active {
    transform: scale(0.95);
}

/* ============================================
   Status Bar (Bottom)
   ============================================ */

.studio-statusbar {
    height: var(--studio-statusbar-height);
    background: var(--studio-bg-dark);
    border-top: 1px solid var(--studio-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    font-size: 11px;
    flex-shrink: 0;
}

.statusbar-left,
.statusbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--studio-text-dim);
}

.status-item i {
    font-size: 10px;
}

.shortcut-hint {
    cursor: pointer;
}

.shortcut-hint:hover {
    color: var(--studio-text);
}

.kbd {
    display: inline-block;
    padding: 1px 4px;
    background: var(--studio-bg-medium);
    border: 1px solid var(--studio-border);
    border-radius: 2px;
    font-size: 9px;
    font-family: 'Consolas', monospace;
}

/* ============================================
   Exit Immersive Button
   ============================================ */

.btn-exit-immersive {
    display: none;
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 100001;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: 1px solid var(--studio-border);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
}

.btn-exit-immersive:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: var(--studio-accent);
}

/* ============================================
   Immersive Mode (True Fullscreen)
   ============================================ */

.mandala-studio-wrapper.immersive-mode .studio-topbar,
.mandala-studio-wrapper.immersive-mode .studio-toolbar-left,
.mandala-studio-wrapper.immersive-mode .studio-sidebar-right,
.mandala-studio-wrapper.immersive-mode .studio-statusbar {
    display: none;
}

.mandala-studio-wrapper.immersive-mode .btn-exit-immersive {
    display: flex;
}

.mandala-studio-wrapper.immersive-mode .canvas-wrapper {
    width: min(calc(100vw - 40px), calc(100vh - 40px));
    height: min(calc(100vw - 40px), calc(100vh - 40px));
}

/* Focus Mode (Hide Right Panel Only) */
.mandala-studio-wrapper.focus-mode .studio-sidebar-right {
    display: none;
}

.mandala-studio-wrapper.focus-mode .canvas-wrapper {
    width: min(calc(100vw - var(--studio-toolbar-width) - 40px), calc(100vh - var(--studio-header-height) - var(--studio-statusbar-height) - 40px));
    height: min(calc(100vw - var(--studio-toolbar-width) - 40px), calc(100vh - var(--studio-header-height) - var(--studio-statusbar-height) - 40px));
}

#btn-focus.active {
    background: var(--studio-accent);
    color: white;
}

/* ============================================
   Modals
   ============================================ */

.studio-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100002;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.studio-modal.active {
    display: flex;
}

.studio-modal .modal-content {
    background: var(--studio-bg-dark);
    border: 1px solid var(--studio-border);
    border-radius: 4px;
    min-width: 320px;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.studio-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--studio-border);
}

.studio-modal .modal-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--studio-text-bright);
    margin: 0;
}

.studio-modal .close-modal {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: var(--studio-text-dim);
    cursor: pointer;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.studio-modal .close-modal:hover {
    background: var(--studio-bg-hover);
    color: var(--studio-text);
}

.studio-modal .modal-body {
    padding: 16px;
}

/* Export Grid */
.export-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--studio-bg-medium);
    border: 1px solid var(--studio-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s;
    text-align: left;
}

.export-option:hover {
    background: var(--studio-bg-hover);
    border-color: var(--studio-accent);
}

.export-option i {
    font-size: 20px;
    color: var(--studio-accent);
}

.export-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.export-option-text span {
    font-size: 12px;
    font-weight: 500;
    color: var(--studio-text-bright);
}

.export-option-text small {
    font-size: 10px;
    color: var(--studio-text-dim);
}

/* Shortcuts List */
.shortcuts-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: var(--studio-bg-medium);
    border-radius: 2px;
}

.shortcut-item .kbd {
    min-width: 50px;
    text-align: center;
    padding: 2px 6px;
}

.shortcut-item span:last-child {
    font-size: 11px;
    color: var(--studio-text);
}

/* Confirm Modal */
.modal-confirm-content {
    max-width: 340px;
}

.confirm-message {
    font-size: 14px;
    color: var(--studio-text-bright);
    margin: 0 0 20px 0;
    text-align: center;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-confirm-cancel,
.btn-confirm-ok {
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}

.btn-confirm-cancel {
    background: var(--studio-bg-light);
    color: var(--studio-text);
    border: 1px solid var(--studio-border);
}

.btn-confirm-cancel:hover {
    background: var(--studio-bg-hover);
    color: var(--studio-text-bright);
}

.btn-confirm-ok {
    background: linear-gradient(135deg, var(--studio-accent), #3a7bd5);
    color: white;
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.3);
}

.btn-confirm-ok:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.4);
}

/* ============================================
   SVG Guide Lines
   ============================================ */

.guides-layer line,
.guides-layer circle {
    stroke: rgba(255, 255, 255, 0.25);
    stroke-width: 2;
    fill: none;
    pointer-events: none;
    vector-effect: non-scaling-stroke;
}

.guides-layer .primary-guide {
    stroke: rgba(74, 158, 255, 0.6);
    stroke-width: 2;
}

.guides-layer .secondary-guide {
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 1;
}

.guides-layer .grid-area {
    stroke: rgba(74, 158, 255, 0.4);
    stroke-width: 2;
    stroke-dasharray: 8 4;
    fill: rgba(74, 158, 255, 0.02);
}

.guides-layer.hidden {
    display: none;
}

.canvas-wrapper.light-mode .guides-layer line,
.canvas-wrapper.light-mode .guides-layer circle {
    stroke: rgba(0, 0, 0, 0.15);
}

.canvas-wrapper.light-mode .guides-layer .primary-guide {
    stroke: rgba(0, 100, 200, 0.5);
}

.canvas-wrapper.light-mode .guides-layer .secondary-guide {
    stroke: rgba(0, 0, 0, 0.08);
}

.canvas-wrapper.light-mode .guides-layer .grid-area {
    stroke: rgba(0, 100, 200, 0.4);
    fill: rgba(0, 100, 200, 0.02);
}

/* ============================================
   Symmetry Quick Buttons
   ============================================ */

.symmetry-quick-btns {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.symmetry-quick-btns .quick-btn {
    flex: 1;
    min-width: 28px;
    padding: 4px 2px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.symmetry-quick-btns .quick-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--studio-accent);
    color: #fff;
}

.symmetry-quick-btns .quick-btn:active {
    background: var(--studio-accent);
    transform: scale(0.95);
}

.symmetry-quick-btns .quick-btn[data-action="divide"] {
    color: rgba(239, 68, 68, 0.8);
}

.symmetry-quick-btns .quick-btn[data-action="multiply"] {
    color: rgba(34, 197, 94, 0.8);
}

.symmetry-quick-btns .quick-btn[data-action="divide"]:hover {
    border-color: rgb(239, 68, 68);
    color: rgb(239, 68, 68);
}

.symmetry-quick-btns .quick-btn[data-action="multiply"]:hover {
    border-color: rgb(34, 197, 94);
    color: rgb(34, 197, 94);
}

/* ============================================
   Symmetry Type Selector
   ============================================ */

.symmetry-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 10px;
}

.sym-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.15s ease;
}

.sym-type-btn i {
    font-size: 14px;
}

.sym-type-btn span {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sym-type-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
}

.sym-type-btn.active {
    background: rgba(74, 158, 255, 0.15);
    border-color: var(--studio-accent);
    color: var(--studio-accent);
}

.sym-type-btn.active i {
    color: var(--studio-accent);
}

/* ============================================
   Layers Panel
   ============================================ */

.layers-toolbar {
    display: flex;
    gap: 4px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--studio-border);
    margin-bottom: 8px;
}

.layer-action-btn {
    flex: 1;
    height: 26px;
    background: var(--studio-bg-medium);
    border: 1px solid var(--studio-border);
    border-radius: 3px;
    color: var(--studio-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.1s;
}

.layer-action-btn:hover {
    background: var(--studio-bg-hover);
    border-color: var(--studio-accent);
    color: var(--studio-text-bright);
}

.layer-action-btn.danger:hover {
    border-color: var(--studio-danger);
    color: var(--studio-danger);
}

.layer-action-btn.active {
    background: var(--studio-accent);
    border-color: var(--studio-accent);
    color: #fff;
}

.layer-action-btn.active:hover {
    background: var(--studio-accent-hover, var(--studio-accent));
}

/* Layers List */
.layers-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.layers-list::-webkit-scrollbar {
    width: 6px;
}

.layers-list::-webkit-scrollbar-thumb {
    background: var(--studio-bg-light);
    border-radius: 3px;
}

/* Layer Item */
.layer-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--studio-bg-medium);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s;
    user-select: none;
}

.layer-item:hover {
    background: var(--studio-bg-hover);
}

.layer-item.active {
    background: var(--studio-bg-active);
    border-color: var(--studio-accent);
}

.layer-item.dragging {
    opacity: 0.5;
    border: 1px dashed var(--studio-accent);
}

.layer-item.drag-over {
    border-top: 2px solid var(--studio-accent);
}

/* Layer Visibility Button */
.layer-visibility {
    width: 22px;
    height: 22px;
    background: transparent;
    border: none;
    color: var(--studio-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border-radius: 3px;
    flex-shrink: 0;
    transition: all 0.1s;
}

.layer-visibility:hover {
    background: var(--studio-bg-light);
    color: var(--studio-text-bright);
}

.layer-visibility.hidden-layer {
    color: var(--studio-text-dim);
}

.layer-visibility.hidden-layer i::before {
    content: "\f070"; /* fa-eye-slash */
}

/* Layer Preview Thumbnail */
.layer-preview {
    width: 32px;
    height: 32px;
    background: var(--studio-bg-darkest);
    border: 1px solid var(--studio-border);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.layer-preview svg {
    width: 100%;
    height: 100%;
}

/* Layer Name Input */
.layer-name {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 2px;
    color: var(--studio-text);
    font-size: 11px;
    padding: 2px 4px;
    outline: none;
    transition: all 0.1s;
}

.layer-name:hover {
    background: var(--studio-bg-light);
}

.layer-name:focus {
    background: var(--studio-bg-medium);
    border-color: var(--studio-accent);
}

/* Layer Lock Button */
.layer-lock {
    width: 22px;
    height: 22px;
    background: transparent;
    border: none;
    color: var(--studio-text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border-radius: 3px;
    flex-shrink: 0;
    transition: all 0.1s;
}

.layer-lock:hover {
    background: var(--studio-bg-light);
    color: var(--studio-text);
}

.layer-lock.locked {
    color: var(--studio-warning);
}

.layer-lock.locked i::before {
    content: "\f023"; /* fa-lock */
}

/* Layer Expand Button */
.layer-expand {
    width: 18px;
    height: 18px;
    background: transparent;
    border: none;
    color: var(--studio-text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    border-radius: 3px;
    flex-shrink: 0;
    transition: all 0.1s;
    padding: 0;
    margin-right: 2px;
}

.layer-expand:hover {
    background: var(--studio-bg-light);
    color: var(--studio-text);
}

/* Layer Item Wrapper */
.layer-item-wrapper {
    margin-bottom: 2px;
}

/* Sublayers Container */
.sublayers-container {
    margin-left: 20px;
    padding-left: 8px;
    border-left: 1px solid var(--studio-border);
    margin-top: 2px;
}

/* Sublayer Item */
.sublayer-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    background: var(--studio-bg-darkest);
    border-radius: 3px;
    margin-bottom: 2px;
    font-size: 10px;
}

.sublayer-item:hover {
    background: var(--studio-bg-medium);
}

/* Sublayer Visibility Button */
.sublayer-visibility {
    width: 18px;
    height: 18px;
    background: transparent;
    border: none;
    color: var(--studio-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border-radius: 3px;
    flex-shrink: 0;
    transition: all 0.1s;
    padding: 0;
}

.sublayer-visibility:hover {
    background: var(--studio-bg-light);
    color: var(--studio-text-bright);
}

/* Sublayer Name */
.sublayer-name {
    flex: 1;
    color: var(--studio-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sublayer Delete Button */
.sublayer-delete {
    width: 18px;
    height: 18px;
    background: transparent;
    border: none;
    color: var(--studio-text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    border-radius: 3px;
    flex-shrink: 0;
    transition: all 0.1s;
    padding: 0;
    opacity: 0;
}

.sublayer-item:hover .sublayer-delete {
    opacity: 1;
}

.sublayer-delete:hover {
    background: var(--studio-danger);
    color: white;
}

/* Layer Options */
.layer-options {
    padding-top: 8px;
    border-top: 1px solid var(--studio-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Drawing Layer SVG Styles */
.drawing-layer {
    pointer-events: all;
}

.drawing-layer.hidden {
    display: none;
}

.drawing-layer.locked {
    pointer-events: none;
}

/* ============================================
   Hidden Utility
   ============================================ */

.hidden {
    display: none !important;
}

/* ============================================
   Drawing Cursor Styles
   ============================================ */

.cursor-brush {
    cursor: crosshair;
}

.cursor-eraser {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='8' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 12 12, crosshair;
}

.cursor-move {
    cursor: grab;
}

.cursor-move:active {
    cursor: grabbing;
}

/* ============================================
   Drawing State Indicator
   ============================================ */

.canvas-wrapper.is-drawing {
    cursor: crosshair !important;
}

.canvas-wrapper.is-drawing::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid var(--studio-accent);
    border-radius: 4px;
    pointer-events: none;
    animation: pulse-border 1s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ============================================
   Loading & Processing States
   ============================================ */

.studio-loading {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.studio-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--studio-border);
    border-top-color: var(--studio-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Notifications / Toasts
   ============================================ */

.studio-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--studio-bg-dark);
    border: 1px solid var(--studio-border);
    padding: 10px 20px;
    border-radius: 6px;
    color: var(--studio-text-bright);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 100003;
}

.studio-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.studio-toast.success {
    border-color: var(--studio-success);
}

.studio-toast.success i {
    color: var(--studio-success);
}

.studio-toast.error {
    border-color: var(--studio-danger);
}

.studio-toast.error i {
    color: var(--studio-danger);
}

/* Toast Container for JS-generated toasts */
.toast-container {
    position: fixed;
    bottom: calc(var(--studio-statusbar-height) + 20px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 100004;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--studio-bg-dark);
    border: 1px solid var(--studio-border);
    padding: 10px 20px;
    border-radius: 6px;
    color: var(--studio-text-bright);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateY(20px);
    transition: transform 0.3s, opacity 0.3s;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-info {
    border-color: var(--studio-accent);
}

.toast-info i {
    color: var(--studio-accent);
}

.toast-warning {
    border-color: var(--studio-warning);
}

.toast-warning i {
    color: var(--studio-warning);
}

.toast-success {
    border-color: var(--studio-success);
}

.toast-success i {
    color: var(--studio-success);
}

.toast-error {
    border-color: var(--studio-danger);
}

.toast-error i {
    color: var(--studio-danger);
}

/* Hidden Layer Item State */
.layer-item.hidden-layer {
    opacity: 0.5;
}

.layer-item.hidden-layer .layer-preview {
    opacity: 0.3;
}

/* Locked Layer Item State */
.layer-item.locked-layer .layer-name {
    color: var(--studio-text-dim);
    font-style: italic;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 900px) {
    :root {
        --studio-panel-width: 180px;
    }
}

@media (max-width: 768px) {
    .studio-sidebar-right {
        display: none;
    }
    
    .toolbar-left-section {
        display: none;
    }
    
    .canvas-wrapper {
        width: min(calc(100vw - var(--studio-toolbar-width) - 20px), calc(100vh - var(--studio-header-height) - var(--studio-statusbar-height) - 20px));
        height: min(calc(100vw - var(--studio-toolbar-width) - 20px), calc(100vh - var(--studio-header-height) - var(--studio-statusbar-height) - 20px));
    }
}

@media (max-width: 480px) {
    .studio-toolbar-left {
        width: 36px;
    }
    
    .tool-item {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .studio-statusbar {
        display: none;
    }
    
    .canvas-wrapper {
        width: min(calc(100vw - 36px - 16px), calc(100vh - var(--studio-header-height) - 16px));
        height: min(calc(100vw - 36px - 16px), calc(100vh - var(--studio-header-height) - 16px));
    }
}

/* ============================================
   Shapes Panel
   ============================================ */

.shapes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 4px;
    padding: 6px;
    background: var(--studio-bg-tertiary);
    border-radius: 6px;
    margin-bottom: 12px;
    max-height: 500px;
    overflow-y: auto;
}

.shape-btn {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--studio-bg-secondary);
    border: 1px solid var(--studio-border-subtle);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 3px;
}

.shape-btn svg {
    width: 100%;
    height: 100%;
    stroke: var(--studio-text-secondary);
    stroke-width: 2;
    fill: none;
}

.shape-btn:hover {
    background: var(--studio-bg-hover);
    border-color: var(--studio-accent);
}

.shape-btn:hover svg {
    stroke: var(--studio-accent);
}

.shape-btn.active {
    background: var(--studio-accent);
    border-color: var(--studio-accent);
}

.shape-btn.active svg {
    stroke: white;
}

.shape-hint {
    font-size: 11px;
    color: var(--studio-text-muted);
    text-align: center;
    padding: 8px;
    background: var(--studio-bg-tertiary);
    border-radius: 4px;
    margin-top: 8px;
    line-height: 1.4;
}

/* ============================================
   Library Sections (Shapes & Patterns)
   ============================================ */

.library-section {
    margin-bottom: 16px;
}

/* Shape Category Styles */
.shape-category {
    background: var(--studio-bg-tertiary);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.shape-category .library-header {
    margin-bottom: 0;
    padding: 10px 12px;
    background: var(--studio-bg-secondary);
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.shape-category .library-header:hover {
    background: var(--studio-hover);
}

.shape-category.expanded .library-header {
    border-bottom-color: var(--studio-border-subtle);
}

.shape-category .shapes-grid {
    padding: 8px;
    display: none;
}

.shape-category.expanded .shapes-grid {
    display: grid;
}

.library-header.collapsible {
    cursor: pointer;
    user-select: none;
}

.library-header.collapsible span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.library-header.collapsible span i {
    font-size: 12px;
    color: var(--studio-accent);
    width: 16px;
    text-align: center;
}

.library-header .toggle-icon {
    font-size: 10px;
    color: var(--studio-text-muted);
    transition: transform 0.2s ease;
}

.shape-category.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Keep first category expanded by default */
.shape-category:first-of-type {
    /* Default expanded via JS */
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 0 4px;
}

.library-header span {
    font-size: 11px;
    font-weight: 600;
    color: var(--studio-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.library-action-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--studio-bg-tertiary);
    border: 1px solid var(--studio-border-subtle);
    border-radius: 4px;
    color: var(--studio-text-muted);
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s ease;
}

.library-action-btn:hover {
    background: var(--studio-accent);
    border-color: var(--studio-accent);
    color: white;
}

.library-empty-hint {
    font-size: 11px;
    color: var(--studio-text-muted);
    text-align: center;
    padding: 12px 8px;
    font-style: italic;
}

/* ============================================
   Fill Color Picker
   ============================================ */

.color-picker-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 4px;
}

.color-picker-row .color-input {
    width: 48px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--studio-border-subtle);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.color-picker-row .color-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker-row .color-input::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-picker-row .color-text-input {
    flex: 1;
    height: 32px;
    padding: 0 10px;
    background: var(--studio-bg-tertiary);
    border: 1px solid var(--studio-border-subtle);
    border-radius: 6px;
    color: var(--studio-text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    text-transform: uppercase;
}

.color-picker-row .color-text-input:focus {
    outline: none;
    border-color: var(--studio-accent);
}

.quick-colors {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    padding: 8px;
    background: var(--studio-bg-tertiary);
    border-radius: 6px;
}

.quick-color-btn {
    aspect-ratio: 1;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.quick-color-btn:hover {
    transform: scale(1.15);
    border-color: var(--studio-accent);
}

.quick-color-btn:active {
    transform: scale(0.95);
}

/* ============================================
   Patterns Panel
   ============================================ */

.patterns-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px;
    background: var(--studio-bg-tertiary);
    border-radius: 6px;
}

.pattern-btn {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--studio-bg-secondary);
    border: 1px solid var(--studio-border-subtle);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 4px;
    overflow: hidden;
}

.pattern-btn:hover {
    border-color: var(--studio-accent);
    transform: scale(1.05);
}

.pattern-btn.active {
    border-color: var(--studio-accent);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.3);
}

.pattern-preview {
    width: 100%;
    height: 100%;
    border-radius: 3px;
    background-color: #888;
}

/* Pattern Preview Styles */
.pattern-preview.solid {
    background: #888;
}

.pattern-preview.dots {
    background-image: radial-gradient(circle, #888 2px, transparent 2px);
    background-size: 8px 8px;
    background-color: #2d2d2d;
}

.pattern-preview.lines-h {
    background-image: repeating-linear-gradient(
        0deg,
        #888 0px,
        #888 2px,
        transparent 2px,
        transparent 6px
    );
    background-color: #2d2d2d;
}

.pattern-preview.lines-v {
    background-image: repeating-linear-gradient(
        90deg,
        #888 0px,
        #888 2px,
        transparent 2px,
        transparent 6px
    );
    background-color: #2d2d2d;
}

.pattern-preview.lines-d {
    background-image: repeating-linear-gradient(
        45deg,
        #888 0px,
        #888 2px,
        transparent 2px,
        transparent 8px
    );
    background-color: #2d2d2d;
}

.pattern-preview.crosshatch {
    background-image: 
        repeating-linear-gradient(45deg, #888 0px, #888 1px, transparent 1px, transparent 6px),
        repeating-linear-gradient(-45deg, #888 0px, #888 1px, transparent 1px, transparent 6px);
    background-color: #2d2d2d;
}

.pattern-preview.zigzag {
    background-image: linear-gradient(135deg, #888 25%, transparent 25%),
        linear-gradient(225deg, #888 25%, transparent 25%),
        linear-gradient(45deg, #888 25%, transparent 25%),
        linear-gradient(315deg, #888 25%, transparent 25%);
    background-size: 8px 8px;
    background-position: 0 0, 4px 0, 4px -4px, 0 4px;
    background-color: #2d2d2d;
}

.pattern-preview.waves {
    background: repeating-linear-gradient(
        0deg,
        #2d2d2d 0px,
        #2d2d2d 3px,
        #888 3px,
        #888 5px
    );
    border-radius: 50%;
}

.pattern-preview.checkerboard {
    background-image: 
        linear-gradient(45deg, #888 25%, transparent 25%),
        linear-gradient(-45deg, #888 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #888 75%),
        linear-gradient(-45deg, transparent 75%, #888 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0;
    background-color: #2d2d2d;
}

.pattern-preview.honeycomb {
    background-image: 
        radial-gradient(circle farthest-side at 0% 50%, #2d2d2d 23.5%, transparent 0) 10px 15px,
        radial-gradient(circle farthest-side at 0% 50%, #888 24%, transparent 0) 8px 15px,
        linear-gradient(#888 14%, transparent 0, transparent 85%, #888 0) 0 0,
        linear-gradient(150deg, #888 24%, #2d2d2d 0, #2d2d2d 26%, transparent 0, transparent 74%, #2d2d2d 0, #2d2d2d 76%, #888 0) 0 0,
        linear-gradient(30deg, #888 24%, #2d2d2d 0, #2d2d2d 26%, transparent 0, transparent 74%, #2d2d2d 0, #2d2d2d 76%, #888 0) 0 0;
    background-size: 10px 17.32px;
    background-color: #888;
}

.pattern-preview.scales {
    background-image: radial-gradient(circle at 50% 0%, transparent 70%, #888 70%);
    background-size: 10px 10px;
    background-color: #2d2d2d;
}

.pattern-preview.stipple {
    background-image: 
        radial-gradient(circle, #888 1px, transparent 1px),
        radial-gradient(circle, #888 1px, transparent 1px);
    background-size: 6px 6px;
    background-position: 0 0, 3px 3px;
    background-color: #2d2d2d;
}

/* Boho Pattern Previews */
.pattern-preview.aztec {
    background-image: 
        linear-gradient(45deg, #888 25%, transparent 25%),
        linear-gradient(-45deg, #888 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #888 75%),
        linear-gradient(-45deg, transparent 75%, #888 75%);
    background-size: 8px 8px;
    background-position: 0 0, 4px 0, 4px -4px, 0 4px;
    background-color: #2d2d2d;
}

.pattern-preview.tribal-lines {
    background-image: 
        repeating-linear-gradient(0deg, #888 0px, #888 1px, transparent 1px, transparent 4px),
        repeating-linear-gradient(60deg, #888 0px, #888 1px, transparent 1px, transparent 6px),
        repeating-linear-gradient(-60deg, #888 0px, #888 1px, transparent 1px, transparent 6px);
    background-color: #2d2d2d;
}

.pattern-preview.mandala-dots {
    background-image: 
        radial-gradient(circle, #888 2px, transparent 2px),
        radial-gradient(circle, #666 1px, transparent 1px);
    background-size: 10px 10px, 5px 5px;
    background-position: 0 0, 5px 5px;
    background-color: #2d2d2d;
}

.pattern-preview.fringe {
    background-image: 
        repeating-linear-gradient(180deg, #888 0px, #888 8px, transparent 8px, transparent 10px);
    background-size: 3px 10px;
    background-color: #2d2d2d;
}

.pattern-preview.macrame {
    background-image: 
        radial-gradient(circle, transparent 3px, #888 3px, #888 4px, transparent 4px),
        linear-gradient(180deg, #888 0px, #888 1px, transparent 1px);
    background-size: 8px 8px, 4px 8px;
    background-color: #2d2d2d;
}

.pattern-preview.boho-arrows {
    background-image: 
        linear-gradient(135deg, #888 3px, transparent 3px),
        linear-gradient(225deg, #888 3px, transparent 3px);
    background-size: 6px 10px;
    background-position: 0 0, 3px 0;
    background-color: #2d2d2d;
}

.pattern-preview.dreamcatcher-web {
    background-image: 
        radial-gradient(circle, transparent 5px, #888 5px, #888 6px, transparent 6px),
        radial-gradient(circle, transparent 2px, #888 2px, #888 3px, transparent 3px);
    background-size: 16px 16px, 16px 16px;
    background-position: 0 0, 8px 8px;
    background-color: #2d2d2d;
}

.pattern-preview.feathers {
    background-image: 
        repeating-linear-gradient(45deg, #888 0px, #888 1px, transparent 1px, transparent 3px),
        repeating-linear-gradient(-45deg, #888 0px, #888 1px, transparent 1px, transparent 3px);
    background-size: 12px 6px;
    background-color: #2d2d2d;
}

.pattern-preview.moon-phases {
    background-image: 
        radial-gradient(circle at 30% 50%, #888 4px, transparent 4px),
        radial-gradient(circle at 70% 50%, #2d2d2d 3px, transparent 3px);
    background-size: 14px 14px;
    background-color: #2d2d2d;
}

.pattern-preview.boho-diamonds {
    background-image: 
        linear-gradient(45deg, transparent 40%, #888 40%, #888 50%, transparent 50%),
        linear-gradient(-45deg, transparent 40%, #888 40%, #888 50%, transparent 50%);
    background-size: 10px 10px;
    background-color: #2d2d2d;
}

.pattern-preview.paisley {
    background-image: 
        radial-gradient(ellipse 4px 6px at 50% 50%, #888 50%, transparent 50%);
    background-size: 10px 10px;
    background-color: #2d2d2d;
}

.pattern-preview.lotus-pattern {
    background-image: 
        radial-gradient(ellipse 3px 5px at 50% 100%, #888 50%, transparent 50%),
        radial-gradient(ellipse 3px 5px at 30% 80%, #888 50%, transparent 50%),
        radial-gradient(ellipse 3px 5px at 70% 80%, #888 50%, transparent 50%);
    background-size: 12px 12px;
    background-color: #2d2d2d;
}

.pattern-preview.sun-rays {
    background-image: 
        repeating-conic-gradient(from 0deg, #888 0deg 10deg, transparent 10deg 20deg);
    background-size: 16px 16px;
    background-color: #2d2d2d;
}

.pattern-preview.mountain-pattern {
    background-image: 
        linear-gradient(135deg, transparent 40%, #888 40%, #888 50%, transparent 50%),
        linear-gradient(225deg, transparent 40%, #888 40%, #888 50%, transparent 50%);
    background-size: 12px 8px;
    background-position: 0 0, 6px 0;
    background-color: #2d2d2d;
}

.pattern-preview.crescent-moons {
    background-image: 
        radial-gradient(circle at 60% 50%, #2d2d2d 3px, transparent 3px),
        radial-gradient(circle at 50% 50%, #888 4px, transparent 4px);
    background-size: 12px 12px;
    background-color: #2d2d2d;
}

/* Custom shape/pattern item with delete button */
.shape-btn.custom,
.pattern-btn.custom {
    position: relative;
}

.shape-btn.custom .delete-btn,
.pattern-btn.custom .delete-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: #e74c3c;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.shape-btn.custom:hover .delete-btn,
.pattern-btn.custom:hover .delete-btn {
    display: flex;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .mandala-studio-wrapper {
        position: static;
        width: auto;
        height: auto;
    }
    
    .studio-topbar,
    .studio-toolbar-left,
    .studio-sidebar-right,
    .studio-statusbar,
    .btn-exit-immersive {
        display: none !important;
    }
    
    .studio-canvas-area {
        background: white !important;
    }
    
    .canvas-wrapper {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1;
        box-shadow: none !important;
    }
}
