/* ============================================================
   sticker2.css - M-Stones Sticker Designer Pro
   Version: 11.0 (จัดระเบียบใหม่)
   ============================================================ */

/* ===== Base Layout ===== */
body {
    background: #111827;
    color: #f3f4f6;
    font-family: 'Sarabun', sans-serif;
    overflow: hidden;
    user-select: none;
}
.main-wrapper { display: flex; height: calc(100vh - 60px); }
.left-sidebar {
    width: 340px;
    background: #1f2937;
    border-right: 1px solid #374151;
    display: flex;
    flex-direction: column;
}
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 15px; }
.panel-section {
    background: #111827;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #374151;
}
.panel-title {
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #10b981;
    margin-bottom: 10px;
}
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f172a;
    position: relative;
}
.top-toolbar {
    height: 50px;
    background: #1f2937;
    border-bottom: 1px solid #374151;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 10px;
    flex-wrap: wrap;
}
.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 30px;
    background: repeating-conic-gradient(#1e293b 0% 25%, #0f172a 0% 50%) 0 0 / 20px 20px;
    position: relative;
}
#label-canvas {
    background: transparent;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
    cursor: crosshair;
}
.right-sidebar {
    width: 280px;
    background: #1f2937;
    border-left: 1px solid #374151;
    display: flex;
    flex-direction: column;
    padding: 15px;
}

/* ===== Layer List ===== */
.layer-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}
.layer-item {
    display: flex;
    align-items: center;
    background: #111827;
    border: 1px solid #374151;
    padding: 8px 12px;
    border-radius: 6px;
    justify-content: space-between;
    cursor: grab;
    transition: all 0.15s;
}
.layer-item:active { cursor: grabbing; }
.layer-item.selected {
    border-color: #10b981;
    background: #1e293b;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}
.layer-item .layer-name-text { cursor: text; }
.layer-item .layer-name-text:hover { color: #34d399; }
.layer-item[draggable="true"]:hover { background: #1e293b; }
.layer-drag-over { border-color: #f59e0b !important; background: #1e2a12 !important; }
.layer-item.group-item {
    background: #1e3a2f !important;
    border-color: #10b981 !important;
    border-left: 3px solid #10b981 !important;
}
.layer-item.group-item .layer-name-text {
    color: #34d399 !important;
    font-weight: bold !important;
}
.layer-item.dragging {
    opacity: 0.5;
    background: #374151 !important;
    border: 1px dashed #10b981 !important;
}
.layer-item.drag-over {
    border-top: 2px solid #f59e0b !important;
    background: #1e2a12 !important;
}

/* ===== Tool Buttons ===== */
.btn-tool {
    background: #374151;
    border: 1px solid #4b5563;
    color: #e5e7eb;
    padding: 6px 10px;
    font-size: 0.82rem;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
    position: relative;
    min-width: 32px;
    justify-content: center;
}
.btn-tool:hover, .btn-tool.active {
    background: #10b981 !important;
    color: #fff !important;
    border-color: #34d399 !important;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}
.btn-tool .badge {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 8px;
    padding: 2px 5px;
    min-width: 18px;
    border-radius: 10px;
    pointer-events: none;
}
.btn-tool.active .badge {
    border: 1px solid #fff;
    box-shadow: 0 0 8px rgba(255,255,255,0.3);
}
#brushSizeBadge { background: #0dcaf0 !important; color: #000 !important; }
#eraserSizeBadge { background: #ffc107 !important; color: #000 !important; }

/* ===== Shape Buttons ===== */
.shape-btn {
    background: #374151;
    border: 1px solid #4b5563;
    color: #e5e7eb;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    font-size: 0.7rem;
    transition: all 0.15s;
    min-width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.shape-btn.active {
    background: #8b5cf6 !important;
    border-color: #a78bfa !important;
    color: white !important;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
    transform: scale(1.05);
}
.shape-btn:hover {
    background: #4b5563;
    border-color: #6b7280;
    transform: scale(1.05);
}

/* ===== Eraser Shape Buttons ===== */
.eraser-shape-btn {
    background: #374151;
    border: 1px solid #4b5563;
    color: #e5e7eb;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    min-width: 32px;
    height: 28px;
}
.eraser-shape-btn.active {
    background: #f59e0b !important;
    color: #1f2937 !important;
    border-color: #f59e0b !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
    transform: scale(1.05);
}
.eraser-shape-btn:hover {
    background: #4b5563;
    border-color: #6b7280;
    transform: scale(1.05);
}
.eraser-shape-btn.active:hover {
    background: #d97706 !important;
    border-color: #d97706 !important;
}

/* ===== Cursor Indicator (Brush/Eraser) ===== */
#brush-cursor-indicator {
    position: fixed !important;
    pointer-events: none !important;
    display: none;
    z-index: 999999 !important;
    transform: translate(-50%, -50%);
    transition: none !important;
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
}
#brush-cursor-indicator.shape-circle {
    border-radius: 50%;
    background: rgba(249, 115, 22, 0.25);
    border: 2px solid rgba(249, 115, 22, 0.6);
}
#brush-cursor-indicator.shape-square {
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.25);
    border: 2px solid rgba(245, 158, 11, 0.6);
}
#brush-cursor-indicator.shape-triangle {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background: rgba(245, 158, 11, 0.25);
}
#brush-cursor-indicator.shape-pentagon {
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    background: rgba(245, 158, 11, 0.25);
}
#brush-cursor-indicator.shape-hexagon {
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: rgba(245, 158, 11, 0.25);
}
#brush-cursor-indicator.shape-octagon {
    clip-path: polygon(29.29% 0%, 70.71% 0%, 100% 29.29%, 100% 70.71%, 70.71% 100%, 29.29% 100%, 0% 70.71%, 0% 29.29%);
    background: rgba(245, 158, 11, 0.25);
}
#brush-cursor-indicator.shape-star4 {
    clip-path: polygon(50% 0%, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0% 50%, 35% 35%);
    background: rgba(245, 158, 11, 0.25);
}
#brush-cursor-indicator.shape-star5 {
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    background: rgba(245, 158, 11, 0.25);
}
#brush-cursor-indicator.shape-star6 {
    clip-path: polygon(50% 0%, 60% 35%, 93% 25%, 70% 50%, 93% 75%, 60% 65%, 50% 100%, 40% 65%, 7% 75%, 30% 50%, 7% 25%, 40% 35%);
    background: rgba(245, 158, 11, 0.25);
}
#brush-cursor-indicator.shape-star8 {
    clip-path: polygon(50% 0%, 59% 35%, 85% 15%, 65% 41%, 100% 50%, 65% 59%, 85% 85%, 59% 65%, 50% 100%, 41% 65%, 15% 85%, 35% 59%, 0% 50%, 35% 41%, 15% 15%, 41% 35%);
    background: rgba(245, 158, 11, 0.25);
}
#brush-cursor-indicator.shape-diamond {
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    background: rgba(245, 158, 11, 0.25);
}
#brush-cursor-indicator.shape-cross {
    clip-path: polygon(35% 0%, 65% 0%, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0% 65%, 0% 35%, 35% 35%);
    background: rgba(245, 158, 11, 0.25);
}
#brush-cursor-indicator.shape-arrow {
    clip-path: polygon(100% 50%, 35% 0%, 35% 30%, 0% 30%, 0% 70%, 35% 70%, 35% 100%);
    background: rgba(245, 158, 11, 0.25);
}
#brush-cursor-indicator.shape-heart {
    border: none !important;
    background-color: transparent !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 85 C20 65 0 50 0 28 C0 13 12 2 26 2 C36 2 45 8 50 17 C55 8 64 2 74 2 C88 2 100 13 100 28 C100 50 80 65 50 85Z' fill='rgba(245,158,11,0.85)'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* ===== Marquee Selection ===== */
.marquee-selection {
    position: absolute;
    border: 2px dashed #10b981;
    background: rgba(16, 185, 129, 0.1);
    pointer-events: none;
    z-index: 10000;
    display: none;
}

/* ===== Select2 Theme ===== */
.select2-container--default .select2-selection--single {
    background-color: #212529;
    border: 1px solid #6c757d;
    color: white;
    height: 32px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: white;
    line-height: 30px;
    font-size: 0.85rem;
}
.select2-dropdown {
    background-color: #212529;
    border: 1px solid #6c757d;
    color: white;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #10b981;
}
.select2-search__field {
    background-color: #343a40 !important;
    color: white !important;
    border: 1px solid #6c757d !important;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #1f2937; }
::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #6b7280; }

/* ===== Utilities ===== */
.text-emerald-400 { color: #34d399; }
.fs-7 { font-size: 0.7rem; }
.border-purple { border-color: #8b5cf6 !important; }

/* ===== Shadow & Gradient Panels ===== */
#shadowWrapper, #gradientWrapper {
    background: #1a1a2e;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #374151;
    margin-bottom: 8px;
}
#shadowWrapper label, #gradientWrapper label { font-size: 0.75rem; }
#shadowWrapper input[type="range"],
#gradientWrapper input[type="range"] {
    accent-color: #10b981;
    height: 4px;
}
#shadowWrapper .form-check-input:checked,
#gradientWrapper .form-check-input:checked {
    background-color: #10b981;
    border-color: #10b981;
}

/* ===== Fonts ===== */
@font-face {
    font-family: 'BLK BangLi-Ko-Sa-Na';
    src: local('BLK BangLi-Ko-Sa-Na'), url('fonts/BLK-BangLi-Ko-Sa-Na.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'TS-Country-EXTRA-NP';
    src: local('TS-Country-EXTRA-NP'), url('fonts/TS-Country-EXTRA-NP.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'FontNongnam';
    src: local('FontNongnam'), url('fonts/FontNongnam.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'JS Angsumalin';
    src: local('JS Angsumalin'), url('fonts/JS-Angsumalin.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'JS Chalit';
    src: local('JS Chalit'), url('fonts/JS-Chalit.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'JS Chawlewhieng';
    src: local('JS Chawlewhieng'), url('fonts/JS-Chawlewhieng.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* ===== Print Styles ===== */
@media print {
    @page { margin: 0; size: auto; }
    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100% !important;
        overflow: visible !important;
    }
    body > *:not(.main-wrapper) { display: none !important; }
    .main-wrapper > :not(.workspace) { display: none !important; }
    .workspace > :not(.canvas-container) { display: none !important; }
    .canvas-container {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: auto !important;
        height: auto !important;
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        display: block !important;
        transform: none !important;
    }
    #label-canvas {
        box-shadow: none !important;
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 100% !important;
        display: block !important;
    }
    #brush-cursor-indicator, .marquee-selection { display: none !important; }
    ::-webkit-scrollbar { display: none; }
}

/* ===== Crop Mode ===== */
.crop-overlay-info {
    position: absolute;
    background: #10b981;
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    pointer-events: none;
    z-index: 10001;
}
#tool-crop.active {
    background: #0891b2 !important;
    border-color: #06b6d4 !important;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

/* ===== Image Tools Panel ===== */
#imageToolsWrapper {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid #374151;
}
#imageToolsWrapper .shape-btn {
    min-width: 36px;
    height: 32px;
    font-size: 0.9rem;
}
#imageToolsWrapper .shape-btn:hover {
    background: #0891b2 !important;
    border-color: #06b6d4 !important;
    transform: scale(1.08);
}
#imageToolsWrapper [data-filter] {
    transition: all 0.2s;
}
#imageToolsWrapper [data-filter]:hover {
    transform: scale(1.05);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* ===== Align Buttons ===== */
#alignWrapper .btn-outline-info {
    border-color: #0891b2;
    color: #22d3ee;
}
#alignWrapper .btn-outline-info:hover {
    background: #0891b2;
    color: #fff;
}
#alignWrapper .btn-outline-warning {
    border-color: #d97706;
    color: #fbbf24;
}
#alignWrapper .btn-outline-warning:hover {
    background: #d97706;
    color: #fff;
}

/* ===== Grid & Guide Buttons ===== */
#btnToggleGrid, #btnToggleSnap, #btnToggleGuides {
    font-size: 0.75rem;
    padding: 4px 10px;
    transition: all 0.2s;
}
#btnToggleGrid.active {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #fff !important;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}
#btnToggleSnap.active {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #1f2937 !important;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}
#btnToggleGuides.active {
    background: #ec4899 !important;
    border-color: #ec4899 !important;
    color: #fff !important;
    box-shadow: 0 0 8px rgba(236, 72, 153, 0.4);
}
#btnToggleMeasure.active {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #1f2937 !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}
#gridSizeSelect {
    font-size: 0.75rem;
    height: 30px;
}

/* ===== Emboss / Deboss ===== */
#embossWrapper {
    background: linear-gradient(135deg, #1a1a2e 0%, #2d1b3d 100%);
    border: 1px solid #f59e0b !important;
}
#embossWrapper .btn-outline-warning {
    border-color: #d97706;
    color: #fbbf24;
}
#embossWrapper .btn-outline-warning:hover,
#embossWrapper .btn-outline-warning.active {
    background: #d97706;
    color: #fff;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}
#embossWrapper .btn-outline-info {
    border-color: #0891b2;
    color: #22d3ee;
}
#embossWrapper .btn-outline-info:hover,
#embossWrapper .btn-outline-info.active {
    background: #0891b2;
    color: #fff;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}
#embossWrapper input[type="range"] {
    accent-color: #f59e0b;
    height: 4px;
}

/* ===== ✨ NEW: Kiss-Cut Border Panel ===== */
#kissCutPanel {
    background: linear-gradient(135deg, #1a1a2e 0%, #1e293b 100%);
    border: 1px solid #f59e0b !important;
}
#kissCutPanel .form-range {
    accent-color: #f59e0b;
}

/* ===== ✨ NEW: QR Code Panel ===== */
#qrCodePanel {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    border: 1px solid #10b981 !important;
}

/* ===== ✨ NEW: Measurement Tool Overlay ===== */
.measure-overlay {
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
/* ===== ✨ NEW: 3D Effect Panel ===== */
#effect3DWrapper {
    background: linear-gradient(135deg, #1a1a2e 0%, #2d1b3d 100%);
    border: 1px solid #a855f7 !important;
}

#effect3DWrapper .btn-outline-warning {
    border-color: #d97706;
    color: #fbbf24;
}
#effect3DWrapper .btn-outline-warning:hover,
#effect3DWrapper .btn-outline-warning.active {
    background: #d97706;
    color: #fff;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

#effect3DWrapper .btn-outline-info {
    border-color: #0891b2;
    color: #22d3ee;
}
#effect3DWrapper .btn-outline-info:hover,
#effect3DWrapper .btn-outline-info.active {
    background: #0891b2;
    color: #fff;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

#effect3DWrapper .btn-outline-success {
    border-color: #059669;
    color: #34d399;
}
#effect3DWrapper .btn-outline-success:hover,
#effect3DWrapper .btn-outline-success.active {
    background: #059669;
    color: #fff;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

#effect3DWrapper input[type="range"] {
    accent-color: #a855f7;
    height: 4px;
}

#effect3DWrapper [data-3d-preset] {
    transition: all 0.2s;
    font-size: 0.7rem;
}
#effect3DWrapper [data-3d-preset]:hover {
    background: #a855f7 !important;
    color: #fff !important;
    border-color: #c084fc !important;
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.5);
}
