/* Override main container layout for full-width Canva-style layout */
body.maker-page {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

body.maker-page main {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

body.maker-page .main-container {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Hide footer on maker page (keep header visible) */
body.maker-page footer {
    display: none !important;
}

body.maker-page .min-vh-100 {
    min-height: 100vh !important;
    overflow: hidden !important;
}

/* Canvas Controls Bar (Inside Canvas Area) */
.canvas-controls-bar {
    position: fixed;
    bottom: 0;
    right: 0;
    height: 45px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 100;
    background: white;
    padding-left: 37%;
    width: 100%;
}

.canvas-controls-bar .canvas-size-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.canvas-controls-bar .canvas-size-selector select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    background: white;
    font-size: 0.875rem;
    cursor: pointer;
}

.canvas-controls-bar .dimension-input {
    padding: 4px;
    border: 1px solid var(--border);
    font-size: 0.875rem;
    text-align: center;
}

.canvas-controls-bar .canvas-info-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.canvas-controls-bar .zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.canvas-controls-bar .zoom-btn {
    padding: 4px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
}

.canvas-controls-bar .zoom-btn:hover {
    color: var(--text-primary);
}

.canvas-controls-bar .zoom-btn .material-icons {
    font-size: 20px;
}

.canvas-controls-bar .zoom-value {
    min-width: 50px;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

:root {
    --sidebar-width: 74px;
    --properties-width: 350px;
    --header-height: 56px;
    --footer-height: 48px;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #64748b;
    --border: #e2e8f0;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
}

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

body {
    font-family: var(--app-font-family);
    overflow: hidden;
    background: var(--bg-secondary);
}

.maker-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-secondary);
}

/* Header */
.maker-header {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 100;
}

/* Border Controls Tooltip */
.border-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 200px;
    margin-top: 8px;
}

.border-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--border);
}

.border-tooltip::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid var(--bg-primary);
}

.border-tooltip-header {
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.border-tooltip-content {
    padding: 12px;
}

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

.border-control-row:last-child {
    margin-bottom: 0;
}

.border-control-row label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 50px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.border-control-row input[type="color"] {
    width: 32px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.border-control-row input[type="range"] {
    flex: 1;
    height: 4px;
}

.border-control-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.border-control-row span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 30px;
    text-align: right;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.canvas-size-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
}

.aspect-ratio-buttons {
    display: flex;
    gap: 0.25rem;
}

.aspect-ratio-btn {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.35rem 0.55rem;
}

.aspect-ratio-btn:hover,
.aspect-ratio-btn:focus-visible,
.aspect-ratio-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.save-status {
    min-width: 4.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.visibility-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 999px;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
}

.visibility-status .material-icons {
    font-size: 0.85rem;
}

.visibility-public {
    background: #ecfdf5;
    color: #047857;
}

.visibility-private {
    background: #eef2ff;
    color: #4338ca;
}

.stock-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.stock-results {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.stock-result {
    position: relative;
    overflow: hidden;
    min-height: 76px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-secondary);
}

.stock-result img {
    width: 100%;
    height: 82px;
    object-fit: cover;
}

.stock-result span {
    display: block;
    overflow: hidden;
    padding: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.625rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-license-note {
    margin: 0.6rem 0 0;
    color: var(--text-secondary);
    font-size: 0.65rem;
    line-height: 1.35;
}

.canvas-size-selector select {
    border: none;
    background: transparent;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Project Title Container */
.project-title-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.project-title-container:hover {
    opacity: 0.8;
}

.project-title-icon {
    font-size: 1rem;
    color: var(--text-secondary);
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.project-title-container:hover .project-title-icon {
    opacity: 1;
}

.project-title-input {
    background: transparent;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
    min-width: 100px;
    max-width: 300px;
    cursor: pointer;
}

.project-title-input:focus {
    cursor: text;
    background: white;
    border: 1px solid var(--primary);
    border-radius: 4px;
    padding: 2px 6px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.zoom-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.zoom-value {
    min-width: 48px;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}
nav .btn {
    display: inline;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

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

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

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

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

.btn-ghost:disabled {
    background: transparent;
    color: var(--text-secondary);
    opacity: 0.4;
}

.btn-ghost:disabled:hover {
    background: transparent;
    color: var(--text-secondary);
    transform: none;
}

.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    justify-content: center;
}

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

/* Left Sidebar - Tools */
.tools-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0.45rem 0;
    gap: 0.2rem;
}

.tool-btn {
    width: 100%;
    min-height: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    gap: 4px;
}

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

.tool-btn.active {
    color: var(--primary);
    background: #eff6ff;
}

.tool-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.tool-icon {
    font-size: 20px;
    line-height: 1;
}

.tool-label {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.tool-separator {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0.75rem;
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #f1f5f9;
    position: relative;
    overflow: auto;
    padding: 40px 40px 0 40px; /* Extra bottom padding for controls bar */
}

.canvas-wrapper {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    background: white;
    position: relative;
    display: inline-block;
    transform-origin: center top;
}

#maker-canvas {
    display: block;
}

/* Prevent Fabric.js hidden textarea from causing layout shifts and browser auto-zoom */
.canvas-container textarea {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
    font-size: 16px !important; /* Prevents browser auto-zoom on focus */
    transform: scale(0) !important;
    width: 1px !important;
    height: 1px !important;
}

/* Prevent zoom on double-tap for maker page */
body.maker-page {
    touch-action: manipulation;
}

body.maker-page * {
    touch-action: manipulation;
}

/* Right Sidebar - Properties */
.properties-sidebar {
    width: var(--properties-width);
    background: var(--bg-primary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.properties-sidebar input[type="text"] {
width: 50%;
}

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

.selection-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.border-controls-wrapper {
    position: relative;
}

.sidebar-action-btn {
    width: 100%;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    font: inherit;
    font-size: 0.65rem;
}

.sidebar-action-btn .material-icons {
    font-size: 18px;
}

.sidebar-action-btn:hover:not(:disabled) {
    color: var(--text-primary);
    border-color: var(--border);
    background: var(--bg-primary);
}

.sidebar-action-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.mobile-only {
    display: none;
}

.properties-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

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

.property-group {
    margin-bottom: .5rem;
}

.property-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.5rem;
    display: block;
}

.property-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.property-input {
    flex: 1;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bg-primary);
    width: 50%;
}

.property-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Color Picker */
.color-picker-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 120px;
}

.color-picker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: transparent;
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    transition: all 0.2s;
    min-width: 30px;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 4px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-picker::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

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

.color-picker:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.color-value {
    flex: 1;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: monospace;
    text-transform: uppercase;
    background: var(--bg-primary);
}

.color-value:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Background Presets */
.background-type-selector {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.bg-type-btn {
    padding: 0.375rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.background-image-card,
.sidebar-section-heading {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.background-image-card .material-icons,
.sidebar-section-heading .material-icons {
    color: var(--primary);
}

.background-image-card strong,
.sidebar-section-heading strong {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.82rem;
}

.background-image-card p,
.sidebar-section-heading span:not(.material-icons) {
    display: block;
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1.4;
}

.sidebar-divider {
    height: 1px;
    margin: 1rem 0;
    background: var(--border);
}

.background-image-actions {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.background-image-actions > .btn,
.background-adjust-controls .btn {
    width: 100%;
}

.background-adjust-controls {
    display: grid;
    gap: 0.65rem;
    padding: 0.75rem;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
}

.background-adjust-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    color: #1e40af;
    font-size: 0.75rem;
    line-height: 1.4;
}

.background-adjust-notice .material-icons {
    font-size: 18px;
}

#background-zoom {
    flex: 1;
}

#background-zoom-value {
    min-width: 44px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-align: right;
}

.background-adjust-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.canvas-wrapper.background-adjusting {
    box-shadow: 0 0 0 3px var(--primary), 0 8px 30px rgba(37, 99, 235, 0.25);
}

#image-effects-properties {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.bg-type-btn:hover {
    background: var(--bg-secondary);
}

.bg-type-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.color-presets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.color-preset {
    width: 100%;
    height: 32px;
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: var(--primary);
    z-index: 1;
}

.color-preset.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.gradient-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.gradient-preset {
    width: 100%;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.gradient-preset:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    z-index: 1;
}

.gradient-preset.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.pattern-presets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

.pattern-preset {
    width: 100%;
    height: 48px;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.pattern-preset:hover,
.pattern-preset:focus-visible {
    z-index: 1;
    border-color: var(--primary);
    outline: none;
    transform: translateY(-2px);
}

.pattern-preset.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.pattern-dots {
    background-color: #0f172a;
    background-image: radial-gradient(circle, #38bdf8 0 3px, transparent 3.5px);
    background-size: 18px 18px;
}

.pattern-grid {
    background-color: #f8fafc;
    background-image: linear-gradient(#94a3b8 1px, transparent 1px), linear-gradient(90deg, #94a3b8 1px, transparent 1px);
    background-size: 16px 16px;
}

.pattern-diagonal {
    background: repeating-linear-gradient(135deg, #312e81 0 10px, #a78bfa 10px 14px, #312e81 14px 24px);
}

.pattern-checker {
    background-color: #fef3c7;
    background-image: conic-gradient(#f97316 25%, transparent 0 50%, #f97316 0 75%, transparent 0);
    background-size: 22px 22px;
}

.pattern-waves {
    background-color: #083344;
    background-image: radial-gradient(ellipse at 50% 100%, transparent 55%, #22d3ee 57% 61%, transparent 63%);
    background-size: 34px 20px;
}

.pattern-confetti {
    background-color: #fff1f2;
    background-image: linear-gradient(25deg, transparent 45%, #e11d48 46% 54%, transparent 55%), linear-gradient(115deg, transparent 45%, #f59e0b 46% 54%, transparent 55%);
    background-position: 0 0, 12px 10px;
    background-size: 28px 28px;
}

.property-help {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.7rem;
    line-height: 1.45;
}

.gradient-controls {
    display: none;
}

.gradient-controls.active {
    display: block;
}

.gradient-control-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.gradient-control-row label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 60px;
}

/* Text Preset Styles */
.text-preset-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.text-preset-tab {
    flex: 1;
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-bottom: 2px solid transparent;
}

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

.text-preset-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.text-presets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.text-preset-item {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-preset-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.text-preset-item.active {
    border-color: var(--primary);
    background: #eff6ff;
}

.text-preset-preview {
    font-size: 1.25rem;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
}

/* Layers Panel */
.layers-panel {
    padding: 0;
    margin: 0;
}

.layers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.layer-item:hover {
    background: #e0f2fe;
}

.layer-item.active {
    background: #dbeafe;
    border: 1px solid var(--primary);
}

.layer-visibility {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.layer-name {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-type {
    font-size: 0.625rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    text-transform: uppercase;
}

/* Footer */
.maker-footer {
    height: var(--footer-height);
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.footer-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Text Tools Panel */
.text-tools {
    display: none;
}

.text-tools.active {
    display: block;
}

.font-selector {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bg-primary);
    margin-bottom: 0.75rem;
}

.text-style-buttons {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.style-btn {
    flex: 1;
    padding: 0.375rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

.style-btn:hover {
    background: var(--bg-secondary);
}

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

/* Mixed state for text style buttons (when selection has mixed styles) */
.style-btn.mixed {
    background: linear-gradient(135deg, var(--primary) 50%, var(--bg-primary) 50%);
    color: var(--text-secondary);
    border-color: var(--primary);
    position: relative;
}

.style-btn.mixed::after {
    content: '~';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    color: var(--text-secondary);
}

/* Selection mode indicator */
.text-properties-selection-mode {
    display: none;
    padding: 0.5rem;
    margin-bottom: 0.75rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--primary);
    text-align: center;
}

.text-properties-selection-mode.visible {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

/* Mixed state for color value input */
.color-value.mixed {
    color: var(--text-secondary);
    font-style: italic;
}

/* Text color presets */
.text-color-presets {
    display: grid;
    grid-template-columns: repeat(10, 1fr);

    margin-bottom: 0.75rem;
}

.text-color-swatch {
    width: 100%;
    height: 32px;
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.text-color-swatch.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Shape Tools */
.shape-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.shape-grid .material-icons {font-size: 54px;}

.shape-btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.shape-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}
.toggleh {display: none; position: absolute; left: -9999px;}

/* Image Shapes Grid */
.image-shapes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.image-shape-btn {
    aspect-ratio: 1;
    width: 100%;
    height: auto;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s;
    padding: 4px;
    max-height: 60px;
}

.image-shape-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.material-icons {
    font-size: 20px;
    line-height: 1;
}

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

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

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

/* Loading State */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .maker-header {
        height: 52px;
        padding: 0 0.5rem;
    }

    .header-right .btn-ghost:not(#save-btn),
    .header-right > div,
    .header-left .btn-icon span:last-child,
    .save-status {
        display: none;
    }

    .tools-sidebar {
        width: 68px;
        gap: 0.35rem;
        overflow-y: auto;
    }

    .tool-btn {
        min-height: 48px;
    }

    .properties-sidebar {
        position: fixed;
        top: 52px;
        bottom: 45px;
        right: -100%;
        width: min(88vw, 340px);
        height: auto;
        z-index: 200;
        box-shadow: -8px 0 24px rgba(15, 23, 42, 0.18);
        transition: right 0.3s;
    }

    .properties-sidebar.show {
        right: 0;
    }

    .canvas-size-selector span {
        display: none;
    }

    .mobile-only {
        display: inline-flex;
    }

    .canvas-area {
        padding: 16px 16px 50px;
    }

    .canvas-controls-bar {
        left: 68px;
        width: calc(100% - 68px);
        padding: 0 0.4rem;
    }

    .canvas-controls-bar .canvas-size-selector select,
    .canvas-controls-bar .dimension-input,
    .canvas-info-text,
    .zoom-controls {
        display: none;
    }

    .aspect-ratio-buttons {
        width: 100%;
        justify-content: center;
    }

    .header-center {
        display: none;
    }
}

/* Maker v2 sidebar system */
:root {
    --sidebar-width: 70px;
    --properties-width: 340px;
    --sidebar-surface: #ffffff;
    --sidebar-hover: #f5f7fb;
    --sidebar-active: #edf4ff;
    --sidebar-radius: 10px;
}

.tools-sidebar {
    padding: 0.65rem 0.45rem;
    gap: 0.25rem;
    border-right-color: #e7eaf0;
}

.tool-btn {
    min-height: 58px;
    border-radius: 9px;
    gap: 5px;
}

.tool-btn:hover {
    background: var(--sidebar-hover);
}

.tool-btn.active {
    background: var(--sidebar-active);
    color: #2563eb;
}

.tool-btn.active::before {
    display: none;
}

.tool-btn:focus-visible,
.sidebar-action-btn:focus-visible,
.shape-btn:focus-visible,
.template-item:focus-visible,
.sidebar-icon-button:focus-visible,
.sidebar-disclosure summary:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.28);
    outline-offset: 1px;
}

.tool-icon {
    font-size: 22px;
}

.tool-label {
    font-size: 0.64rem;
    font-weight: 650;
}

.properties-sidebar {
    overflow: hidden;
    border-left-color: #e7eaf0;
    box-shadow: -4px 0 18px rgba(15, 23, 42, 0.035);
}

.properties-header {
    min-height: 56px;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.96);
}

.properties-title {
    font-size: 0.82rem;
    font-weight: 750;
    letter-spacing: 0.045em;
}

.properties-content {
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.property-panel {
    padding: 0.9rem 1rem 1.5rem;
}

.property-panel > .property-group {
    margin: 0;
    padding: 0.8rem 0;
    border-bottom: 1px solid #eef1f5;
}

.property-panel > .property-group:last-child {
    border-bottom: 0;
}

.property-label {
    margin-bottom: 0.45rem;
    color: #475569;
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.sidebar-panel-intro {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.35rem;
    padding: 0.75rem 0.8rem;
    border: 1px solid #e7edf7;
    border-radius: var(--sidebar-radius);
    background: linear-gradient(135deg, #f8fbff 0%, #f4f7fb 100%);
}

.sidebar-panel-intro strong {
    color: #172033;
    font-size: 0.82rem;
}

.sidebar-panel-intro span {
    color: #64748b;
    font-size: 0.7rem;
    line-height: 1.4;
}

.sidebar-panel-intro-action {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.sidebar-panel-intro-action > div {
    display: grid;
    gap: 0.2rem;
}

.sidebar-icon-button {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #fff;
    color: #526174;
    cursor: pointer;
}

.sidebar-icon-button:hover {
    border-color: #b9c8da;
    background: #f8fafc;
    color: #2563eb;
}

.sidebar-icon-button .material-icons {
    font-size: 18px;
}

.sidebar-icon-button:disabled .material-icons {
    animation: spin 0.8s linear infinite;
}

.selection-actions {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.2rem;
    padding: 0.45rem 0.6rem;
    background: #fafbfc;
}

.sidebar-action-btn {
    min-height: 40px;
    padding: 0.25rem 0.15rem;
    border-radius: 7px;
    font-size: 0.57rem;
}

.sidebar-action-btn .material-icons {
    font-size: 17px;
}

.property-input,
.font-selector-display,
#properties-panel input[type="text"],
#properties-panel input[type="search"],
#properties-panel input[type="number"],
#properties-panel select {
    min-height: 38px;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #fff;
    font-size: 0.8rem;
}

#properties-panel input[type="text"] {
    width: 100%;
}

.property-input:focus,
.font-selector-display:focus-within,
#properties-panel input:focus,
#properties-panel select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.color-picker {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid #dbe2ea;
    border-radius: 9px;
}

.background-type-selector {
    gap: 0.35rem;
    padding: 0.25rem;
    border-radius: 9px;
    background: #f1f4f8;
}

.bg-type-btn {
    min-height: 34px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    font-size: 0.68rem;
}

.bg-type-btn.active {
    background: #fff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.text-style-buttons {
    gap: 0.35rem;
    margin-bottom: 0;
}

.sidebar-insert-group .text-style-buttons {
    display: grid;
    grid-template-columns: 1.35fr 1fr 0.8fr;
}

.sidebar-insert-group .btn,
.sidebar-insert-group .style-btn {
    min-height: 40px;
    justify-content: center;
}

.style-btn {
    min-height: 38px;
    padding: 0.4rem;
    border-color: #dbe2ea;
    border-radius: 8px;
    background: #fff;
    color: #334155;
}

.style-btn:hover {
    border-color: #b8c5d4;
    background: #f8fafc;
}

.style-btn.active {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #2563eb;
}

.text-color-presets {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 0.32rem;
}

.text-color-swatch,
.color-preset {
    aspect-ratio: 1;
    height: auto;
    border-radius: 50%;
    border-width: 1px;
}

.color-presets {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 0.32rem;
}

.compact-color-group {
    padding-top: 0.25rem !important;
}

.sidebar-section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 1rem 0 0.55rem;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.035em;
}

.sidebar-section-title small {
    color: #94a3b8;
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.sidebar-disclosure {
    margin-top: 0.75rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: var(--sidebar-radius);
    background: #fff;
}

.sidebar-disclosure summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 0.55rem 0.7rem;
    color: #334155;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.sidebar-disclosure summary::-webkit-details-marker {
    display: none;
}

.sidebar-disclosure summary > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.sidebar-disclosure summary .material-icons {
    color: #64748b;
    font-size: 18px;
}

.sidebar-disclosure .disclosure-arrow {
    transition: transform 0.18s ease;
}

.sidebar-disclosure[open] .disclosure-arrow {
    transform: rotate(180deg);
}

.sidebar-disclosure-content {
    padding: 0.7rem;
    border-top: 1px solid #eef2f7;
    background: #fbfcfe;
}

.sidebar-disclosure-content .property-group {
    margin-bottom: 0.8rem;
}

.sidebar-disclosure-content .property-group:last-child {
    margin-bottom: 0;
}

.control-hint {
    color: #64748b;
    font-size: 0.72rem;
}

.compact-slider-row {
    margin-top: 0.35rem;
}

.compact-slider-row > span:first-child {
    width: 28px;
    color: #64748b;
    font-size: 0.68rem;
}

.compact-slider-row > span:last-child {
    width: 24px;
    color: #64748b;
    font-size: 0.68rem;
    text-align: right;
}

.text-presets-grid {
    gap: 0.45rem;
    padding: 0;
}

.text-preset-item {
    min-height: 54px;
    border: 1px solid #e1e6ed;
    border-radius: 9px;
    background: #fff;
}

.text-preset-item:hover {
    border-color: #93b4e8;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.sidebar-section-heading,
.background-image-card {
    padding: 0.7rem 0;
    border-radius: 0;
    background: transparent;
}

.shape-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin-bottom: 0;
}

.shape-grid .material-icons {
    font-size: 30px;
}

.shape-btn {
    aspect-ratio: auto;
    min-height: 68px;
    flex-direction: column;
    gap: 0.3rem;
    border-color: #e1e6ed;
    border-radius: 9px;
    color: #334155;
}

.shape-btn::after {
    content: attr(data-label);
    color: #64748b;
    font-size: 0.61rem;
    font-weight: 650;
}

.shape-btn:hover {
    border-color: #93b4e8;
    background: #f7faff;
    color: #2563eb;
    transform: translateY(-1px);
}

.stock-search-form .property-input {
    width: 100%;
}

.stock-search-form .btn {
    width: 40px;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
}

.stock-result,
.image-shape-btn {
    border-radius: 9px;
}

#image-effects-properties {
    margin: 0;
    padding: 0.9rem 1rem 1.5rem;
    border: 0;
    border-radius: 0;
    background: #fff;
}

#image-effects-properties .sidebar-section-heading {
    margin: 0.15rem 0 0;
}

#image-effects-properties > .property-group {
    margin: 0;
    padding: 0.8rem 0;
    border-bottom: 1px solid #eef1f5;
}

.image-edit-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.7rem;
    padding: 0.25rem 0;
    border: 0;
    background: transparent;
    color: #2563eb;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.image-edit-back:hover {
    color: #1d4ed8;
}

.image-edit-back:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.22);
    outline-offset: 3px;
    border-radius: 4px;
}

.image-edit-back .material-icons {
    font-size: 17px;
}

.image-edit-intro {
    margin-bottom: 0.15rem;
}

.image-adjustments-heading {
    border-bottom: 1px solid #eef1f5;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.template-item {
    position: relative;
    overflow: hidden;
    border: 1px solid #e1e6ed;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.template-item:hover,
.template-item:focus-visible {
    border-color: #8eb5ef;
    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.11);
    transform: translateY(-2px);
}

.template-item img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.template-overlay {
    position: absolute;
    inset: 0 0 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.68);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.template-format-badge {
    position: absolute;
    top: 0.42rem;
    left: 0.42rem;
    z-index: 2;
    padding: 0.18rem 0.34rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-size: 0.52rem;
    font-weight: 750;
    letter-spacing: 0.02em;
    line-height: 1;
    pointer-events: none;
}

.template-item:hover .template-overlay,
.template-item:focus-visible .template-overlay {
    opacity: 1;
}

.template-item-title {
    display: block;
    overflow: hidden;
    padding: 0.38rem 0.48rem;
    color: #334155;
    font-size: 0.65rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layers-list {
    gap: 0.38rem;
    margin-top: 0.7rem;
}

.layer-item {
    min-height: 44px;
    padding: 0.48rem 0.55rem;
    border: 1px solid #e8ecf2;
    border-radius: 9px;
    background: #fff;
}

.layer-item:hover {
    border-color: #c5d5e8;
    background: #f8fbff;
}

.layer-item.active {
    border-color: #93c5fd;
    background: #eff6ff;
}

.layer-select {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.layer-type {
    border-radius: 999px;
    padding: 0.18rem 0.4rem;
    background: #f1f5f9;
}

.maker-dialog {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(3px);
}

.maker-dialog-card {
    width: min(100%, 390px);
    padding: 1.35rem;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
    text-align: center;
}

.maker-dialog-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    border-radius: 12px;
    background: #eff6ff;
    color: #2563eb;
}

.maker-dialog-icon .material-icons {
    font-size: 23px;
}

.maker-dialog-icon-warning {
    background: #fff7ed;
    color: #ea580c;
}

.maker-dialog-card h2 {
    margin-bottom: 0.45rem;
    color: #172033;
    font-size: 1.08rem;
    font-weight: 750;
}

.maker-dialog-card p {
    margin: 0 auto 1.15rem;
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.55;
}

.maker-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}

.maker-dialog-actions .btn {
    min-height: 40px;
    justify-content: center;
}

@media (max-width: 768px) {
    .tools-sidebar {
        width: 64px;
        padding-inline: 0.3rem;
    }

    .properties-sidebar {
        width: min(90vw, 350px);
    }

    .canvas-controls-bar {
        left: 64px;
        width: calc(100% - 64px);
    }
}
