/**
 * BirthdayCardMaker - Studio Editor Stylesheet
 */

html.editor-html, body.editor-body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #0f172a;
    color: #f8fafc;
}

.editor-app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ================= TOPBAR ================= */
.editor-topbar {
    height: 60px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 50;
    flex-shrink: 0;
}

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

.topbar-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 0.88rem;
    font-weight: 600;
}

.topbar-back-btn:hover {
    background: #334155;
    color: #ffffff;
}

.topbar-back-btn svg {
    width: 16px;
    height: 16px;
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background: #334155;
}

.card-title-field {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.card-title-field input {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    outline: none;
    max-width: 180px;
    transition: all 0.2s;
}

.card-title-field input:focus, .card-title-field:hover input {
    background: #0f172a;
    border-color: #475569;
}

.title-edit-hint {
    font-size: 0.75rem;
    opacity: 0.5;
}

/* Tool Buttons */
.tool-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover:not(:disabled) {
    background: #334155;
    color: #ffffff;
}

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

.tool-btn svg {
    width: 18px;
    height: 18px;
}

.action-btn-group, .zoom-btn-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.zoom-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #94a3b8;
    min-width: 45px;
    text-align: center;
}

.btn-topbar-photo {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(236, 72, 153, 0.15);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    color: #f472b6;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-topbar-photo:hover {
    background: var(--primary);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-topbar-photo svg {
    width: 16px;
    height: 16px;
}

/* Size Selector Dropdown */
.size-dropdown-wrapper {
    position: relative;
}

.size-selector-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    color: #e2e8f0;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.size-selector-btn svg {
    width: 16px;
    height: 16px;
}

.size-selector-btn .chevron-sm {
    width: 14px;
    height: 14px;
}

.size-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 260px;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: 6px;
    display: none;
    z-index: 100;
}

.size-dropdown-menu.open {
    display: block;
}

.size-opt {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.size-opt:hover {
    background: #334155;
}

.size-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
}

.size-dims {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Topbar Right Buttons */
.btn-topbar-ghost {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-topbar-ghost:hover {
    background: #334155;
    color: #ffffff;
}

.btn-topbar-ghost svg {
    width: 16px;
    height: 16px;
}

.btn-download-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.4);
    transition: all 0.2s;
}

.btn-download-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(var(--primary-rgb), 0.5);
}

.btn-download-primary svg {
    width: 18px;
    height: 18px;
}

/* ================= 3-COLUMN WORKSPACE ================= */
.editor-workspace {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* ================= LEFT SIDEBAR ================= */
.editor-left-sidebar {
    display: flex;
    height: 100%;
    background: #1e293b;
    border-right: 1px solid #334155;
    z-index: 20;
    flex-shrink: 0;
}

/* Vertical Icon Tabs (72px wide) */
.editor-nav-tabs {
    width: 72px;
    background: #0f172a;
    border-right: 1px solid #334155;
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 4px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.7rem;
    font-weight: 600;
    border-left: 3px solid transparent;
}

.nav-tab svg {
    width: 22px;
    height: 22px;
}

.nav-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    color: var(--primary);
    background: #1e293b;
    border-left-color: var(--primary);
}

/* Expandable Tab Panels Container (330px wide) */
.editor-panels-container {
    width: 330px;
    background: #1e293b;
    height: 100%;
    overflow-y: auto;
    position: relative;
}

.tab-panel {
    display: none;
    padding: 20px;
}

.tab-panel.active {
    display: block;
}

.panel-header {
    margin-bottom: 20px;
}

.panel-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 4px;
}

.panel-subtitle {
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.4;
}

.panel-search-input {
    width: 100%;
    padding: 10px 14px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.9rem;
    outline: none;
    margin-bottom: 14px;
}

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

.panel-cat-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.p-chip {
    padding: 4px 10px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-full);
    color: #94a3b8;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.p-chip.active, .p-chip:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

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

.panel-tmpl-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

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

.panel-tmpl-thumb {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 4px;
    object-fit: contain;
    margin-bottom: 6px;
    background: #1e293b;
}

.panel-tmpl-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #cbd5e1;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Photo Dropzone */
.photo-dropzone {
    background: #0f172a;
    border: 2px dashed #475569;
    border-radius: var(--radius-md);
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.photo-dropzone:hover, .photo-dropzone.dragover {
    border-color: var(--primary);
    background: rgba(236, 72, 153, 0.05);
}

.dropzone-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.dropzone-text {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 14px;
}

.btn-browse-photo {
    padding: 8px 18px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.btn-browse-photo:hover {
    transform: translateY(-1px);
    background: #db2777;
}

.photo-dropzone.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.photo-dropzone.loading::after {
    content: "Processing image...";
    display: block;
    margin-top: 10px;
    color: #ec4899;
    font-weight: 700;
    font-size: 0.88rem;
}

/* Uploaded Photos History Grid */
.uploaded-photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.uploaded-photo-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
    background: #0f172a;
    border: 1px solid #334155;
    cursor: pointer;
    transition: all 0.2s;
}

.uploaded-photo-item:hover {
    border-color: var(--primary);
    transform: scale(1.03);
}

.uploaded-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.uploaded-photo-item .photo-add-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(15, 23, 42, 0.85);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 9999px;
    pointer-events: none;
}

/* Editor Toast Notification */
.editor-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: #1e293b;
    color: #ffffff;
    border: 1px solid #ec4899;
    padding: 10px 22px;
    border-radius: 9999px;
    font-size: 0.92rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.editor-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.frame-masks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.frame-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    padding: 10px 4px;
    color: #cbd5e1;
    cursor: pointer;
}

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

.frame-preview {
    width: 32px;
    height: 32px;
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--primary);
}

.frame-rect { border-radius: 2px; }
.frame-circle { border-radius: 50%; }
.frame-roundrect { border-radius: 8px; }
.frame-heart { border: none; font-size: 1.6rem; }
.frame-arch { border-radius: 16px 16px 2px 2px; }
.frame-name { font-size: 0.72rem; }

/* Text Add Buttons */
.text-add-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.btn-add-text {
    width: 100%;
    padding: 12px;
    border: 1px solid #334155;
    background: #0f172a;
    border-radius: var(--radius-sm);
    color: #ffffff;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.btn-add-title { font-size: 1.2rem; font-weight: 900; }
.btn-add-sub { font-size: 1rem; font-weight: 700; color: #cbd5e1; }
.btn-add-body { font-size: 0.88rem; color: #94a3b8; }

.btn-add-text:hover {
    border-color: var(--primary);
    background: #334155;
}

.panel-section {
    margin-top: 24px;
}

.section-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.quick-phrases-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.phrase-chip {
    padding: 8px 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
}

.phrase-chip:hover {
    border-color: var(--primary);
    color: #ffffff;
}

/* Background Color Palette */
.color-palette-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.color-swatch-btn {
    width: 100%;
    aspect-ratio: 1/1;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.15s;
}

.color-swatch-btn:hover {
    transform: scale(1.15);
    z-index: 2;
}

.custom-color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.custom-color-row input[type="color"] {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}

.gradients-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.grad-preset-btn {
    width: 100%;
    aspect-ratio: 1.6 / 1;
    border: 1px solid #475569;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s;
}

.grad-preset-btn:hover {
    transform: scale(1.08);
}

.btn-reset-bg {
    width: 100%;
    padding: 10px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 20px;
    cursor: pointer;
}

/* Stickers Grid */
.stickers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.sticker-item-btn {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    padding: 12px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sticker-item-btn:hover {
    border-color: var(--primary);
    transform: scale(1.08);
    background: #334155;
}

.sticker-item-btn svg {
    width: 44px;
    height: 44px;
}

/* Shapes Grid */
.shapes-list-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.shape-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    cursor: pointer;
    font-size: 0.82rem;
}

.shape-btn:hover {
    border-color: var(--primary);
    color: #ffffff;
}

.shape-icon-rect { width: 32px; height: 24px; background: var(--primary); border-radius: 2px; }
.shape-icon-circle { width: 28px; height: 28px; background: var(--secondary); border-radius: 50%; }
.shape-icon-triangle { width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-bottom: 28px solid #f59e0b; }
.shape-icon-star, .shape-icon-heart { font-size: 2rem; color: #ec4899; line-height: 1; }

/* Layers List */
.layers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
}

.layer-item.active {
    border-color: var(--primary);
    background: #334155;
}

.layer-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.layer-actions {
    display: flex;
    gap: 6px;
}

.layer-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px;
}

.layer-btn:hover {
    color: #ffffff;
}

.layers-empty {
    font-size: 0.85rem;
    color: #64748b;
    text-align: center;
    padding: 24px 0;
}

/* Wishes Panel */
.panel-wishes-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.form-group-sm label {
    display: block;
    font-size: 0.78rem;
    color: #94a3b8;
    margin-bottom: 4px;
}

.form-select-sm {
    width: 100%;
    padding: 8px 10px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.85rem;
    outline: none;
}

.editor-wish-output {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    padding: 16px;
}

.wish-quote-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #e2e8f0;
    font-style: italic;
    margin-bottom: 14px;
}

.editor-wish-btns {
    display: flex;
    gap: 8px;
}

.btn-wish-mini {
    flex: 1;
    padding: 8px;
    background: #334155;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-wish-mini.primary {
    background: var(--primary);
}

/* ================= CENTER STAGE WORKSPACE ================= */
.editor-center-stage {
    flex: 1;
    height: 100%;
    position: relative;
    background: #0b1120;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.canvas-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 40px;
    position: relative;
}

.canvas-artboard-wrapper {
    position: relative;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background: #ffffff;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

/* Floating Bottom Bar */
.floating-stage-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid #475569;
    border-radius: var(--radius-full);
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-xl);
    z-index: 30;
}

.floating-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.floating-btn:hover {
    background: #334155;
    color: #ffffff;
}

.floating-btn svg {
    width: 15px;
    height: 15px;
}

.floating-btn.text-danger:hover {
    color: #ef4444;
}

.stage-divider {
    width: 1px;
    height: 16px;
    background: #475569;
}

.stage-info-pill {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 700;
}

/* ================= RIGHT PROPERTIES SIDEBAR ================= */
.editor-right-sidebar {
    width: 300px;
    background: #1e293b;
    border-left: 1px solid #334155;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    z-index: 20;
    flex-shrink: 0;
}

.properties-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #334155;
    padding-bottom: 12px;
}

.properties-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
}

.properties-empty-state {
    text-align: center;
    padding: 40px 10px;
    color: #94a3b8;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.empty-text {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 24px;
}

.empty-hints {
    background: #0f172a;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: #cbd5e1;
    text-align: left;
    line-height: 1.4;
}

.prop-group {
    margin-bottom: 24px;
    border-bottom: 1px solid #334155;
    padding-bottom: 20px;
}

.prop-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 14px;
}

.prop-row {
    margin-bottom: 14px;
}

.prop-row label {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 6px;
}

.prop-select {
    width: 100%;
    padding: 8px 12px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.9rem;
    outline: none;
}

.prop-row-dual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.prop-col label {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 6px;
}

.prop-input-number {
    width: 100%;
    padding: 8px 12px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.9rem;
    outline: none;
}

.prop-color-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
}

.prop-color-wrapper input[type="color"] {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}

.color-hex-label {
    font-size: 0.8rem;
    color: #cbd5e1;
    font-family: monospace;
}

.prop-btn-toolbar {
    display: flex;
    align-items: center;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 2px;
    margin-bottom: 14px;
}

.prop-toggle-btn {
    flex: 1;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #cbd5e1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prop-toggle-btn:hover {
    background: #334155;
    color: #ffffff;
}

.prop-toggle-btn.active {
    background: var(--primary);
    color: #ffffff;
}

.prop-toggle-btn svg {
    width: 16px;
    height: 16px;
}

.prop-bar-divider {
    width: 1px;
    height: 20px;
    background: #475569;
    margin: 0 4px;
}

.prop-slider {
    width: 100%;
    accent-color: var(--primary);
    cursor: pointer;
}

.frame-selector-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.frame-chip {
    padding: 6px 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-full);
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
}

.frame-chip.active, .frame-chip:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.prop-alignment-btns, .prop-layer-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.btn-align-quick, .btn-layer-order {
    padding: 8px 6px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-align-quick:hover, .btn-layer-order:hover {
    background: #334155;
    color: #ffffff;
}

.prop-action-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-prop-action {
    padding: 8px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-prop-action:hover {
    background: #334155;
    color: #ffffff;
}

.btn-prop-action.danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

/* ================= MODALS ================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal-dialog {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog-sm {
    max-width: 400px;
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #334155;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
}

.modal-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover {
    color: #ffffff;
}

.modal-body {
    padding: 24px;
}

.export-format-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.format-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.format-card:hover {
    border-color: #64748b;
}

.format-card.active {
    border-color: var(--primary);
    background: rgba(236, 72, 153, 0.08);
}

.format-card input[type="radio"] {
    accent-color: var(--primary);
}

.fmt-icon {
    font-size: 1.8rem;
}

.fmt-name {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
}

.fmt-desc {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
}

.export-quality-wrapper {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 16px;
}

.export-quality-wrapper label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 8px;
}

.export-status-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #0f172a;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
}

.spinner-sm {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(var(--primary-rgb), 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #334155;
    background: #172033;
}

.btn-modal-cancel {
    padding: 10px 20px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: var(--radius-full);
    color: #cbd5e1;
    font-weight: 600;
    cursor: pointer;
}

.btn-modal-download {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #ffffff;
    border: none;
    border-radius: var(--radius-full);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.4);
}

.btn-modal-danger {
    padding: 10px 20px;
    background: #dc2626;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-full);
    font-weight: 700;
    cursor: pointer;
}

/* Saved Drafts List */
.drafts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 340px;
    overflow-y: auto;
}

.draft-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
}

.draft-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.draft-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.draft-date {
    font-size: 0.75rem;
    color: #94a3b8;
}

.draft-btns {
    display: flex;
    gap: 6px;
}

.btn-draft-action {
    padding: 6px 12px;
    background: #334155;
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-draft-action.load {
    background: var(--primary);
}

.btn-draft-action.del:hover {
    background: #ef4444;
}

.drafts-empty {
    text-align: center;
    color: #94a3b8;
    padding: 24px;
    font-size: 0.9rem;
}

/* ================= CLEAN PREVIEW OVERLAY ================= */
.preview-overlay {
    position: fixed;
    inset: 0;
    background: #020617;
    z-index: 300;
    display: flex;
    flex-direction: column;
}

.preview-topbar {
    height: 56px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.preview-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
}

.btn-close-preview {
    padding: 8px 18px;
    background: #e2e8f0;
    color: #0f172a;
    border: none;
    border-radius: var(--radius-full);
    font-weight: 700;
    cursor: pointer;
}

.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    overflow: auto;
}

.preview-card-img {
    max-width: 90%;
    max-height: 85vh;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    background: #ffffff;
}

/* Add Photo Frame Slots Grid in Photos Panel */
.panel-section-hint {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-bottom: 12px;
}

.add-frames-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.btn-add-frame-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #e2e8f0;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 600;
    transition: all 0.2s;
    text-align: left;
}

.btn-add-frame-slot:hover {
    border-color: var(--primary, #ec4899);
    background: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.2);
}

.btn-add-frame-slot .slot-icon {
    font-size: 1.2rem;
}

/* Photo Filter Chips */
.photo-filters-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.filter-chip {
    padding: 6px 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 20px;
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover {
    border-color: #64748b;
    color: #ffffff;
}

.filter-chip.active {
    background: var(--primary, #ec4899);
    border-color: var(--primary, #ec4899);
    color: #ffffff;
    font-weight: 700;
}

/* Photo Transform Buttons */
.photo-transform-btns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.btn-photo-transform {
    padding: 8px 4px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-photo-transform:hover {
    background: #1e293b;
    border-color: var(--primary, #ec4899);
    color: #ffffff;
}

/* Photo Quick Actions */
.photo-actions-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.btn-replace-photo, .btn-remove-photo {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-replace-photo {
    background: #1e1b4b;
    border: 1px solid #6366f1;
    color: #c7d2fe;
}

.btn-replace-photo:hover {
    background: #312e81;
    color: #ffffff;
}

.btn-remove-photo {
    background: #450a0a;
    border: 1px solid #ef4444;
    color: #fca5a5;
}

.btn-remove-photo:hover {
    background: #7f1d1d;
    color: #ffffff;
}

/* ================= MOBILE EDITOR RESPONSIVENESS ================= */
@media (max-width: 1024px) {
    .editor-right-sidebar {
        display: none; /* Can be toggled on mobile or stacked */
    }
}

@media (max-width: 768px) {
    .editor-topbar {
        padding: 0 10px;
        height: 54px;
    }
    .back-text, .zoom-value, .card-title-field {
        display: none;
    }
    .editor-workspace {
        flex-direction: column-reverse;
        height: calc(100vh - 54px);
    }
    .editor-left-sidebar {
        width: 100%;
        height: 240px;
        border-right: none;
        border-top: 1px solid #334155;
    }
    .editor-nav-tabs {
        width: 60px;
    }
    .editor-panels-container {
        flex: 1;
        width: auto;
    }
    .editor-center-stage {
        flex: 1;
    }
    .canvas-viewport {
        padding: 16px;
    }
    .floating-stage-bar {
        bottom: 10px;
        padding: 4px 10px;
    }
}
