/* WooCommerce Creative Studio - Main Styles */

:root {
    /* Colors */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary: #64748b;
    --secondary-hover: #475569;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Neutrals */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Sizing */
    --header-height: 56px;
    --sidebar-width: 72px;
    --panel-width: 300px;
    --properties-width: 280px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Layout */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    flex-shrink: 0;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.logo {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i {
    color: var(--primary);
}

.template-name-input {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    text-align: center;
    min-width: 200px;
    transition: var(--transition-fast);
}

.template-name-input:hover {
    border-color: var(--border-color);
}

.template-name-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-tertiary);
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-hover);
}

.btn-icon {
    padding: 8px;
    min-width: 36px;
    height: 36px;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    min-width: 28px;
    height: 28px;
}

.btn-block {
    width: 100%;
}

/* Main Content */
.app-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar Navigation */
.sidebar-left {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 4px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    font-size: 10px;
    gap: 4px;
}

.nav-item i {
    font-size: 18px;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

/* Panel */
.sidebar-panel {
    width: var(--panel-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.panel {
    display: none;
    flex-direction: column;
    height: 100%;
}

.panel.active {
    display: flex;
}

.panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.panel-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.panel-search input,
.panel-search select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}

.panel-search input:focus,
.panel-search select:focus {
    outline: none;
    border-color: var(--primary);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.panel-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.product-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 2px solid transparent;
}

.product-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.product-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.product-card-info {
    padding: 8px;
}

.product-card-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card-price {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Asset Grid */
.asset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.asset-item {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-fast);
    position: relative;
}

.asset-item:hover {
    border-color: var(--primary);
}

.asset-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.asset-item .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition-fast);
}

.asset-item:hover .delete-btn {
    opacity: 1;
}

.empty-message {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 16px 8px;
    grid-column: 1 / -1;
}

/* Custom Elements Grid */
.custom-elements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.custom-elements-grid .empty-state {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 16px 8px;
}

.custom-element-item {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: var(--transition-fast);
    position: relative;
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.custom-element-item:hover {
    border-color: var(--primary);
}

.custom-element-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.custom-element-item .element-placeholder {
    font-size: 24px;
    color: var(--text-muted);
}

.custom-element-item .element-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 9px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-element-item .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 9px;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-element-item:hover .delete-btn {
    opacity: 1;
}

.divider-horizontal {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

/* Elements */
.element-group {
    margin-bottom: 20px;
}

.element-group h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.element-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.element-btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.badge-preview {
    font-size: 8px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
}

.badge-preview.sale { background: var(--danger); }
.badge-preview.new { background: var(--success); }
.badge-preview.hot { background: var(--warning); }
.badge-preview.percent { background: var(--primary); }

/* Text Presets */
.text-presets {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.text-preset-btn {
    width: 100%;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: var(--transition-fast);
}

.text-preset-btn:hover {
    border-color: var(--primary);
}

.text-preset-btn .preview {
    display: block;
    color: var(--text-primary);
}

.text-preset-btn .preview.heading {
    font-size: 24px;
    font-weight: 700;
}

.text-preset-btn .preview.subheading {
    font-size: 18px;
    font-weight: 500;
}

.text-preset-btn .preview.body {
    font-size: 14px;
}

.text-preset-btn .preview.cta {
    font-size: 14px;
    font-weight: 700;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    display: inline-block;
}

/* Color Grid */
.color-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.color-swatch {
    aspect-ratio: 1;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.color-swatch.custom {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.hidden-color-picker {
    position: absolute;
    visibility: hidden;
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.canvas-toolbar {
    height: 48px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 24px;
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.toolbar-group select {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
}

.canvas-dimensions {
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

#zoomLevel {
    min-width: 48px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 40px;
    background:
        linear-gradient(45deg, #1a1a2e 25%, transparent 25%),
        linear-gradient(-45deg, #1a1a2e 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1a1a2e 75%),
        linear-gradient(-45deg, transparent 75%, #1a1a2e 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #16162d;
    position: relative;
}

.canvas-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Allow controls to render outside the canvas */
    overflow: visible;
    padding: 30px;
    transition: margin 0s;
}

.canvas-wrapper .canvas-container-inner {
    position: relative;
}

.canvas-container canvas {
    box-shadow: var(--shadow-lg);
}

/* Canvas panning cursor */
.canvas-container.panning {
    cursor: grab;
}

.canvas-container.panning:active {
    cursor: grabbing;
}

/* Properties Panel */
.sidebar-right {
    width: var(--properties-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

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

.properties-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.properties-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.no-selection {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.no-selection i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Property Groups */
.property-group {
    margin-bottom: 20px;
}

.property-group-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.property-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.property-row label {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 60px;
}

.property-row input[type="text"],
.property-row input[type="number"],
.property-row select {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
}

.property-row input[type="color"] {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.property-row input:focus,
.property-row select:focus {
    outline: none;
    border-color: var(--primary);
}

.input-group {
    display: flex;
    gap: 8px;
    flex: 1;
}

.input-group input {
    flex: 1;
    min-width: 0;
}

/* Alignment buttons */
.alignment-buttons {
    display: flex;
    gap: 4px;
}

.alignment-buttons button {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.alignment-buttons button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.alignment-buttons button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Slider */
.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.slider-value {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
}

/* Layer Actions */
.layer-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.layer-actions button {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition-fast);
}

.layer-actions button:hover {
    background: var(--secondary-hover);
    color: var(--text-primary);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-lg {
    max-width: 700px;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    font-size: 24px;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form Groups */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

/* Product Modal */
.product-modal-grid {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 20px;
}

.product-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.product-image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition-fast);
}

.product-image-item:hover {
    border-color: var(--primary);
}

.product-image-item.selected {
    border-color: var(--primary);
}

.product-image-item.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.product-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
}

.product-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.product-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Batch Sizes */
.batch-sizes {
    margin-top: 12px;
}

.batch-sizes-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
}

.batch-size-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.batch-size-item:hover {
    background: var(--bg-tertiary);
}

.batch-size-item input {
    margin-right: 12px;
}

.batch-size-item span {
    flex: 1;
    font-size: 13px;
}

.batch-size-item small {
    color: var(--text-muted);
    font-size: 11px;
}

/* Share Result */
.share-result {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.share-link-wrapper {
    display: flex;
    gap: 8px;
}

.share-link-wrapper input {
    flex: 1;
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-bottom: 16px;
}

.upload-dropzone:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-dropzone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.2);
}

.upload-dropzone i {
    font-size: 36px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.upload-dropzone p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    gap: 12px;
}

.loading i {
    font-size: 24px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    min-width: 280px;
    border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.error { border-left-color: var(--danger); }

.toast-icon {
    font-size: 18px;
}

.toast.success .toast-icon { color: var(--success); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.error .toast-icon { color: var(--danger); }

.toast-message {
    flex: 1;
    font-size: 14px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.divider-horizontal {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

/* Brand Section */
.brand-section {
    margin-bottom: 20px;
}

.brand-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.brand-logo-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.brand-logo-preview {
    width: 100%;
    max-height: 100px;
    object-fit: contain;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px;
}

.brand-colors {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.brand-color-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-color-item label {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}

.brand-color-item input[type="color"] {
    width: 40px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* Folder Tree */
.folder-tree {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
}

.folder-item {
    display: flex;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    color: var(--text-secondary);
    gap: 8px;
}

.folder-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.folder-item.active {
    background: var(--primary);
    color: white;
}

.folder-item i {
    font-size: 14px;
}

/* Templates Grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.template-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 2px solid transparent;
}

.template-card:hover {
    border-color: var(--primary);
}

.template-card-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-primary);
}

.template-card-info {
    padding: 8px;
}

.template-card-name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-card-date {
    font-size: 10px;
    color: var(--text-muted);
}

/* Progress Bar */
.bulk-progress {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Saved Presets */
.saved-presets {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.saved-preset-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    gap: 8px;
}

.saved-preset-item:hover {
    background: var(--secondary-hover);
}

.saved-preset-preview {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: var(--radius-sm);
}

.saved-preset-name {
    flex: 1;
    font-size: 13px;
}

/* ============== SETTINGS PANEL ============== */

.settings-section {
    margin-bottom: 20px;
}

.settings-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.help-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Add Font Form */
.add-font-form {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.add-font-form input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
}

.add-font-form input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Font List */
.font-list {
    max-height: 200px;
    overflow-y: auto;
}

.font-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
}

.font-item-name {
    font-size: 14px;
    color: var(--text-primary);
}

.font-item .delete-font {
    opacity: 0.5;
    transition: opacity 0.2s;
}

.font-item:hover .delete-font {
    opacity: 1;
}

/* Preset List */
.preset-list {
    margin-top: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.preset-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.preset-item-preview {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 18px;
}

.preset-item-info {
    flex: 1;
    min-width: 0;
}

.preset-item-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-item-details {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.preset-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.preset-item:hover .preset-item-actions {
    opacity: 1;
}

/* Nav spacer */
.nav-spacer {
    flex: 1;
}

/* Text Preset Modal */
.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.preset-preview-box {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.preset-preview-box label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.text-preview {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    word-break: break-word;
}

/* Save Mode Options */
.save-mode-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    border: 2px solid transparent;
}

.radio-option:hover {
    border-color: var(--primary);
}

.radio-option input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.radio-option input[type="radio"]:checked + span {
    color: var(--primary);
}

.radio-option span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.radio-option span i {
    font-size: 12px;
}

/* Current Product Section */
.current-product-section {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
}

.current-product-section h4 {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.current-product-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: var(--bg-secondary);
}

.current-product-info {
    flex: 1;
    min-width: 0;
}

.current-product-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.current-product-price {
    font-size: 12px;
    color: var(--text-muted);
}

.current-product-actions {
    display: flex;
    gap: 4px;
}

.empty-product-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-product-slot i {
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-product-slot p {
    font-size: 12px;
}

.placeholder-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: var(--success);
    color: white;
    font-size: 10px;
    border-radius: 3px;
    margin-top: 4px;
}

.placeholder-count {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Template Product Selector Modal */
.template-product-search {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.template-product-search input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}

.template-product-search input:focus {
    outline: none;
    border-color: var(--primary);
}

.template-product-search select {
    min-width: 160px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.template-product-search select:focus {
    outline: none;
    border-color: var(--primary);
}

.template-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.template-product-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 2px solid transparent;
}

.template-product-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.template-product-card.selected {
    border-color: var(--success);
}

.template-product-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-secondary);
}

.template-product-card-info {
    padding: 10px;
}

.template-product-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.template-product-card-price {
    font-size: 12px;
    color: var(--text-secondary);
}

.template-product-pagination {
    margin-top: 16px;
    text-align: center;
}

.template-products-grid .loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    gap: 12px;
}

.template-products-grid .loading i {
    font-size: 24px;
}

/* ============================================
   RIGHT SIDEBAR TABS
   ============================================ */

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.sidebar-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 8px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 10px;
}

.sidebar-tab i {
    font-size: 14px;
}

.sidebar-tab span {
    font-weight: 500;
}

.sidebar-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.sidebar-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg-secondary);
}

/* Tab Content */
.sidebar-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.sidebar-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* ============================================
   LAYERS PANEL
   ============================================ */

.layers-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.layers-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.layers-count {
    font-size: 12px;
    color: var(--text-muted);
}

.layers-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.no-layers {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.no-layers i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.no-layers p {
    font-size: 13px;
}

/* Layer Item */
.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.layer-item:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.layer-item.selected {
    background: var(--primary-light);
    border-color: var(--primary);
}

.layer-item.selected .layer-name {
    color: var(--primary);
}

.layer-item.locked {
    opacity: 0.6;
}

.layer-item.locked .layer-name {
    font-style: italic;
}

.layer-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 11px;
    flex-shrink: 0;
}

.layer-item.selected .layer-icon {
    background: var(--primary);
    color: white;
}

.layer-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.layer-actions-mini {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: var(--transition-fast);
}

.layer-item:hover .layer-actions-mini {
    opacity: 1;
}

.layer-actions-mini button {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    transition: var(--transition-fast);
}

.layer-actions-mini button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.layer-actions-mini button.locked-btn.active {
    color: var(--warning);
}

.layer-actions-mini button.delete-btn:hover {
    color: var(--danger);
}

.layer-actions-mini button.visibility-btn.active {
    color: var(--text-muted);
}

/* Hidden layer styling - layer stays visible in panel, just shows indicators */
.layer-hidden-text {
    text-decoration: line-through;
    color: var(--text-muted) !important;
}

.layer-item.layer-hidden .layer-icon {
    opacity: 0.6;
}

/* Image thumbnail in layer icon */
.layer-icon.layer-icon-image {
    padding: 0;
    overflow: hidden;
}

.layer-icon.layer-icon-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* ============================================
   PROJECT PANEL
   ============================================ */

.project-panel {
    padding: 16px;
    overflow-y: auto;
}

.project-panel .property-group {
    margin-bottom: 20px;
}

.color-text-input {
    width: 70px !important;
    flex: none !important;
    font-family: monospace;
    font-size: 12px;
    text-transform: uppercase;
}

/* Background Image Preview */
.bg-image-preview {
    width: 100%;
    height: 80px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.bg-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-bg-image {
    text-align: center;
    color: var(--text-muted);
}

.no-bg-image i {
    font-size: 24px;
    margin-bottom: 4px;
    opacity: 0.5;
}

.no-bg-image p {
    font-size: 11px;
}

/* Property row slider adjustments for project panel */
.project-panel .property-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
}

.project-panel .property-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.project-panel .slider-value {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 35px;
    text-align: right;
}

/* ============================================
   BACKGROUND IMAGE PICKER MODAL
   ============================================ */

.bg-picker-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.bg-picker-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.bg-picker-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.bg-picker-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.bg-picker-content {
    display: none;
    min-height: 300px;
}

.bg-picker-content.active {
    display: block;
}

.bg-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.bg-picker-item {
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-fast);
    position: relative;
}

.bg-picker-item:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

.bg-picker-item.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.bg-picker-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bg-picker-item .bg-item-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Upload dropzone in bg picker */
#bgUploadDropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--bg-tertiary);
}

#bgUploadDropzone:hover,
#bgUploadDropzone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

#bgUploadDropzone i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

#bgUploadDropzone p {
    margin: 0;
    color: var(--text-secondary);
}

#bgUploadDropzone .help-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.bg-picker-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.bg-picker-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.bg-picker-empty p {
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .sidebar-right {
        width: 240px;
    }

    .sidebar-panel {
        width: 260px;
    }

    .sidebar-tab span {
        display: none;
    }

    .sidebar-tab {
        padding: 12px 8px;
    }

    .sidebar-tab i {
        font-size: 16px;
    }
}
