/* =====================
   LIVE NOTE PREVIEW
   ===================== */
.note-preview-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: #FAF8F5;
    border-radius: var(--r-card);
    border: 1.5px dashed var(--dashed-line);
    min-height: 140px;
    margin-bottom: 12px;
    width: 100%;
}

.note-preview-area {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.note-preview-area .board-item {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: rotate(-2deg) !important;
    margin: 0 auto !important;
    box-shadow: 2px 6px 18px rgba(0, 0, 0, 0.12) !important;
    cursor: default !important;
}

/* =====================
   DECORATION / EDIT MODE
   ===================== */
.decor-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    border-radius: var(--r-card);
    background: #fdfdfd;
    border: 1.5px solid var(--border-light);
}

.decor-item-btn {
    position: relative;
    font-size: 1.8rem;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: var(--r-sm);
    transition: transform var(--t), background var(--t);
}

.decor-item-btn .premium-star-badge,
.skin-option-btn .premium-star-badge,
.premium-upload-area .premium-star-badge {
    right: 3px;
    bottom: 3px;
    width: 15px;
    height: 15px;
    font-size: 0.78rem;
    -webkit-text-stroke: 0.4px #7c3aed;
}

.premium-upload-area {
    position: relative;
}

.decor-item-btn:hover {
    transform: scale(1.18);
    background: #f5f5f5;
}

.decor-item-btn.selected-decor {
    background: #f0e6ff !important;
    border: 2px solid #7c3aed !important;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15);
}

.decor-item-btn:active {
    transform: scale(0.95);
}

/* Delete buttons on board items in edit mode */
.board-item .btn-item-delete {
    display: none;
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: 1.5px solid white;
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    z-index: 999;
    padding: 0;
    transform: scale(calc(1 / var(--item-scale, 1)));
    transform-origin: center center;
}

.board-item .btn-item-delete:hover {
    background: #dc2626;
    transform: scale(calc(1.1 / var(--item-scale, 1)));
}



/* Rotate buttons on board items in edit mode */
.board-item .btn-item-rotate {
    display: none;
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #7c3aed;
    color: white;
    border: 1.5px solid white;
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    cursor: alias;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    z-index: 999;
    padding: 0;
    transform: scale(calc(1 / var(--item-scale, 1)));
    transform-origin: center center;
}

.board-item .btn-item-rotate:hover {
    background: #6d28d9;
    transform: scale(calc(1.1 / var(--item-scale, 1)));
}

/* Customization & Edit Mode styles */
.board-canvas.edit-active .board-item {
    cursor: grab;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Hide top navbar during Edit Mode across all device/browser views */
body.board-editing-mode .top-nav,
body:has(#screen-board.edit-active) .top-nav,
#screen-board.edit-active ~ .top-nav,
.edit-active ~ .top-nav {
    display: none !important;
}

#screen-board.edit-active,
#screen-board.edit-active * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
}

.board-canvas .board-item a {
    pointer-events: none;
}

.board-canvas.edit-active .board-item a,
.board-canvas.edit-active .board-item button:not(.btn-item-delete):not(.btn-item-rotate):not(.btn-item-manage) {
    pointer-events: none;
    cursor: default;
}

.board-canvas.edit-active .board-item:active {
    cursor: grabbing;
}

.board-item.active-edit {
    outline: 2px dashed #7c3aed;
    outline-offset: 6px;
    border-radius: 4px;
}

@keyframes itemIdentifyPulse {
    0% {
        outline-color: #7c3aed;
        outline-width: 2px;
        transform: scale(var(--final-scale, 1)) rotate(calc(var(--final-rot-deg, 0) * 1deg));
        box-shadow: 0 0 0 rgba(124, 58, 237, 0);
    }
    30% {
        outline-color: #ff3366;
        outline-width: 6px;
        transform: scale(calc(var(--final-scale, 1) * 1.08)) rotate(calc(var(--final-rot-deg, 0) * 1deg));
        box-shadow: 0 0 20px rgba(255, 51, 102, 0.4);
    }
    100% {
        outline-color: #7c3aed;
        outline-width: 2px;
        transform: scale(var(--final-scale, 1)) rotate(calc(var(--final-rot-deg, 0) * 1deg));
        box-shadow: 0 0 0 rgba(124, 58, 237, 0);
    }
}

.item-identify-pulse {
    animation: itemIdentifyPulse 0.6s ease-in-out !important;
}

/* Manage folder button on board items in edit mode */
.board-item .btn-item-manage {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(calc(1 / var(--item-scale, 1)));
    transform-origin: center center;
    background: #7c3aed;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.board-item .btn-item-manage:hover {
    background: #6d28d9;
    transform: translate(-50%, -50%) scale(calc(1.1 / var(--item-scale, 1)));
}

.board-item .btn-item-manage:active {
    transform: translate(-50%, -50%) scale(calc(0.9 / var(--item-scale, 1)));
}

.board-canvas.edit-active .board-item.active-edit .btn-item-delete,
.board-canvas.edit-active .board-item.active-edit .btn-item-rotate,
.board-canvas.edit-active .board-item.active-edit .btn-item-manage {
    display: flex !important;
}

@keyframes itemWiggle {
    0% {
        translate: -1px -1px;
    }
    100% {
        translate: 1px 1px;
    }
}

/* Image-based decorations */
.item-decor.has-image {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-decor.has-image.is-large-decor {
    width: 120px;
    height: 120px;
}

.explore-decor.has-image {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =============================================
   VERTICAL LAYER PALETTE (Photoshop-style)
   ============================================= */
.layer-palette {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2000;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

.layer-palette.hidden {
    opacity: 0;
    transform: translateY(-50%) scale(0.92);
    pointer-events: none;
    display: block !important;
}

/* Redesigned Layer Control Toolbar Container */
.layer-palette-list.layer-control-toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 56px;
    min-width: 56px;
    background: rgba(22, 22, 28, 0.90);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 28px;
    padding: 10px 6px;
    box-shadow: 0 12px 38px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.2);
    gap: 0;
    max-height: none;
    overflow: visible;
}

/* Legacy/Fallback palette list */
.layer-palette-list:not(.layer-control-toolbar) {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(22, 22, 28, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 8px 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    max-height: 330px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 48px;
    align-items: center;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.layer-palette-list::-webkit-scrollbar {
    display: none;
    width: 0 !important;
    height: 0 !important;
}

/* 1. Position indicator label */
.layer-toolbar-position {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 26px;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    user-select: none;
    pointer-events: none;
    cursor: default;
    letter-spacing: -0.2px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Hairline Dividers */
.layer-toolbar-divider {
    width: 28px;
    height: 1px;
    background: rgba(255, 255, 255, 0.14);
    margin: 5px 0;
    flex-shrink: 0;
}

/* 2. Reorder pair container (matched stepper control, tight spacing) */
.layer-toolbar-reorder-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin: 0;
}

/* 3. Actions container */
.layer-toolbar-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin: 0;
}

/* Base button styles with 44x44px minimum touch targets */
.layer-toolbar-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    color: #ffffff;
    transition: background 0.18s ease, transform 0.15s ease, color 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.layer-toolbar-btn svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
    transition: transform 0.15s ease;
}

/* Both reorder buttons identical flat icon treatment, interaction states compensate */
.layer-toolbar-btn:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.10);
    transform: scale(1.05);
}

.layer-toolbar-btn:active:not(.disabled) {
    background: rgba(255, 255, 255, 0.16);
    transform: scale(0.92);
}

/* Disabled state: communicated by icon color only */
.layer-toolbar-btn.disabled {
    color: rgba(255, 255, 255, 0.25);
    cursor: default;
    pointer-events: none;
}

/* Delete button icon is red */
.layer-toolbar-btn.action-btn-delete {
    color: #ef4444;
}

.layer-toolbar-btn.action-btn-delete:hover {
    background: rgba(239, 68, 68, 0.12);
}

.layer-toolbar-btn.action-btn-delete:active {
    background: rgba(239, 68, 68, 0.20);
}

.layer-item-card {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: grab;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, transform 0.12s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.2s;
    user-select: none;
    touch-action: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Prevent native image drag previews and context menu conflicts on mobile/desktop children */
.layer-item-card * {
    pointer-events: none !important;
    -webkit-user-drag: none !important;
    user-drag: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.layer-item-card:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.06);
}

.layer-item-card.active-layer {
    border-color: #a78bfa; /* Lavender purple highlight for active element */
    background: rgba(167, 139, 250, 0.2);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.45);
}

.layer-item-card.dragging-layer {
    opacity: 0.5;
    cursor: grabbing;
    transform: scale(1.12);
    z-index: 10;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.25);
}

/* Dynamic Thumbnail mini previews */
.mini-decor {
    font-size: 1.15rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-decor img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.mini-sticky {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}

.mini-sticky.yellow { background: #FFF9A0; }
.mini-sticky.pink   { background: #FFD0E0; }
.mini-sticky.blue   { background: #C8EEFF; }

.mini-tape {
    width: 24px;
    height: 7px;
    background: #f3f0e8;
    border: 1px solid #d4cebe;
    transform: rotate(-12deg);
    box-shadow: 0 1px 1px rgba(0,0,0,0.12);
}

.mini-cd {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle, #2d2d2d 35%, #0f0f12 36%);
    border: 1px solid #1a1a24;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-cd::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffffff;
}



/* Dynamic Thumbnail mini preview for picture */
.mini-picture {
    width: 22px;
    height: 22px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eee;
}

.mini-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Mini Folder/Pocket Preview */
.mini-folder {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
    background: #fdf6e2;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-folder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Mini Q&A Card Preview */
.mini-qa {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mini-qa span {
    width: 100%;
    height: 50%;
}

.mini-qa span.pink { background: var(--sticky-pink); }
.mini-qa span.blue { background: var(--sticky-blue); }
.mini-qa span.yellow { background: var(--sticky-yellow); }
.mini-qa span.green { background: var(--sticky-green); }
.mini-qa span.lavender { background: #dfccfb; }
.mini-qa span.purple { background: #e5beff; }
.mini-qa span.default { background: #fafafa; }
.mini-qa span.white { background: #ffffff; }

/* Polaroid Picture board item */
.item-board-picture {
    width: 120px;
    height: 140px;
    background: #ffffff;
    padding: 6px 6px 8px;
    border-radius: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15), 0 2px 5px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.item-board-picture img {
    width: 100%;
    height: 100%;
    flex: 1 1 auto;
    min-height: 0;
    object-fit: cover;
    border-radius: 2px;
    pointer-events: none;
}

/* Transparent Sticker Cutout Picture */
.item-board-picture.item-picture-cutout {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 140px !important;
    height: 140px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.item-board-picture.item-picture-cutout img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    border-radius: 0 !important;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.28)) !important;
}

.picture-title-label {
    font-family: var(--font-hand), monospace;
    font-size: 0.72rem;
    font-weight: normal;
    text-align: center;
    color: #2c2c2c;
    margin-top: 4px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.2;
}

.popout-picture-caption {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    max-width: 80%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'DM Sans', sans-serif;
    z-index: 10;
}

/* User Tagging Pills */
.tag-user-pill {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: transform var(--t), background var(--t), border-color var(--t), color var(--t);
    outline: none;
}

.tag-user-pill:hover {
    transform: scale(1.05);
}

.tag-user-pill.active {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Show camera badge on profile circle in edit mode */
#board-profile-camera-icon {
    top: 50%;
    left: 50%;
    bottom: auto;
    right: auto;
    width: 36px;
    height: 36px;
    background: rgba(25, 20, 33, 0.75); /* slightly transparent to see face */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.board-canvas.edit-active #board-profile-camera-icon {
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1.2) !important;
}

.board-canvas.edit-active .board-profile-circle {
    cursor: pointer;
}


/* Position Undo and Done buttons at the bottom corners during edit mode */
body.board-editing-mode #btn-undo-board-edit {
    position: absolute !important;
    top: auto !important;
    bottom: 16px !important;
    left: 16px !important;
    right: auto !important;
    z-index: 100 !important;
}

body.board-editing-mode #btn-edit-board {
    position: absolute !important;
    top: auto !important;
    bottom: 16px !important;
    left: auto !important;
    right: 16px !important;
    transform: none !important;
    z-index: 100 !important;
}

/* Edit Mode Header Controls & Under-Wall Pagination Stepper */
#screen-board.edit-active .board-user-row,
#screen-board.edit-active #btn-share-wall {
    display: none !important;
}

#screen-board.edit-active .edit-only-header {
    display: flex !important;
}

.edit-mode-header-left {
    display: flex;
    align-items: center;
}

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

.edit-header-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 14px;
    border-radius: 999px;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    border: 1.5px solid var(--nav-pill-border);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.edit-header-add-btn {
    background: #ffffff !important;
    color: #111827 !important;
    border: 1.5px solid rgba(0, 0, 0, 0.15) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.edit-header-add-btn:hover {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #111827 !important;
    transform: scale(1.04) !important;
}

.edit-header-add-btn:active {
    transform: scale(0.95) !important;
}

.edit-header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid rgba(239, 68, 68, 0.25) !important;
    background: #ffffff !important;
    color: #ef4444;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.edit-header-icon-btn:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
    transform: scale(1.08);
}

.edit-header-icon-btn:active {
    transform: scale(0.92);
}

/* Edit Mode Under-Wall Page Stepper Pagination — Option 1: Translucent Glass Capsule */
.edit-mode-bottom-pagination {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 3px 8px;
    margin: 8px auto 0;
    background: rgba(255, 255, 255, 0.78) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.6) !important;
    border-radius: 999px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    z-index: 99 !important;
    pointer-events: auto !important;
}

.edit-pagination-pill {
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 700;
    color: #111827 !important;
    background: transparent !important;
    border: none !important;
    padding: 0 4px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    letter-spacing: -0.01em;
    text-shadow: none !important;
}

.edit-page-arrow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: transparent !important;
    border: none !important;
    color: #374151;
    cursor: pointer;
    box-shadow: none !important;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.edit-page-arrow-btn:hover {
    background: rgba(0, 0, 0, 0.08) !important;
    color: #000000;
    transform: scale(1.1);
}

.edit-page-arrow-btn.disabled,
.edit-page-arrow-btn:disabled {
    opacity: 0.25 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.edit-page-arrow-btn.hidden {
    display: none !important;
}
