/**
 * StickerWorks Custom Lab - Frontend CSS Stylesheet
 */

:root {
    --sw-bg-dark: #0f172a;
    --sw-panel-bg: #1e293b;
    --sw-card-bg: #334155;
    --sw-primary: #0ea5e9;
    --sw-primary-hover: #0284c7;
    --sw-accent: #38bdf8;
    --sw-text: #f8fafc;
    --sw-text-muted: #cbd5e1;
    --sw-border: #475569;
    --sw-success: #22c55e;
    --sw-radius: 14px;
    --sw-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

/* DYNAMIC CONTAINER FIT */
.sw-lab-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--sw-bg-dark);
    color: var(--sw-text);
    border-radius: var(--sw-radius);
    padding: 24px;
    box-shadow: var(--sw-shadow);
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.sw-lab-container * {
    box-sizing: border-box;
}

/* HIGH-CONTRAST FORM INPUT & TOGGLE TEXT OVERRIDES */
#sw-sticker-lab select,
#sw-sticker-lab input[type="text"],
#sw-sticker-lab input[type="number"],
#sw-sticker-lab input[type="email"],
#sw-sticker-lab input[type="tel"],
#sw-sticker-lab textarea,
.sw-select,
.sw-template-input {
    color: #ffffff !important;
    background-color: #1e293b !important;
    border: 1px solid #475569 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    border-radius: 6px !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #ffffff !important;
}

#sw-sticker-lab select option {
    background-color: #1e293b !important;
    color: #ffffff !important;
}

#sw-sticker-lab label,
#sw-sticker-lab .sw-toggle-label,
#sw-sticker-lab .sw-view-toggles label,
#sw-sticker-lab .sw-view-toggles,
#sw-sticker-lab .sw-section-header label,
#sw-sticker-lab .sw-lock-aspect,
#sw-sticker-lab .sw-glass-lbl {
    color: #f1f5f9 !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    -webkit-text-fill-color: #f1f5f9 !important;
}

#sw-sticker-lab ::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #94a3b8 !important;
}

/* CANVAS TOOLBAR & FOOTER HIGH CONTRAST */
#sw-sticker-lab .sw-canvas-toolbar,
#sw-sticker-lab .sw-canvas-toolbar *,
#sw-sticker-lab .sw-view-toggles,
#sw-sticker-lab .sw-view-toggles *,
#sw-sticker-lab .sw-canvas-footer-info,
#sw-sticker-lab .sw-canvas-footer-info * {
    color: #f1f5f9 !important;
}

#sw-sticker-lab #sw-zoom-level {
    color: #38bdf8 !important;
    font-weight: 700 !important;
    font-size: 13px !important;
}

/* Icon Category Tabs */
.sw-icon-cat-btn {
    background: #0f172a !important;
    border: 1px solid #475569 !important;
    color: #94a3b8 !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
}

.sw-icon-cat-btn:hover {
    color: #ffffff !important;
    border-color: #38bdf8 !important;
}

.sw-icon-cat-btn.active {
    background: #0ea5e9 !important;
    color: #ffffff !important;
    border-color: #0ea5e9 !important;
}

/* Header & Tabs */
.sw-lab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--sw-border);
    padding-bottom: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
    width: 100%;
}

.sw-brand-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sw-logo-icon {
    font-size: 32px;
}

.sw-brand-title h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #fff !important;
}

.sw-brand-title p {
    margin: 2px 0 0 0;
    font-size: 13px;
    color: var(--sw-text-muted) !important;
}

.sw-mode-tabs {
    display: flex;
    background: var(--sw-panel-bg);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--sw-border);
    gap: 4px;
}

.sw-tab-btn {
    background: transparent;
    border: none;
    color: #cbd5e1 !important;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sw-tab-btn:hover {
    color: var(--sw-text) !important;
    background: rgba(255, 255, 255, 0.05);
}

.sw-tab-btn.active {
    background: var(--sw-primary);
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.4);
}

/* Main Workspace Grid */
.sw-lab-workspace {
    display: grid;
    grid-template-columns: minmax(400px, 1fr) minmax(320px, 420px);
    gap: 24px;
    width: 100%;
    align-items: stretch;
}

@media (max-width: 992px) {
    .sw-lab-workspace {
        grid-template-columns: 1fr;
    }
}

/* Canvas Area (Spacious Workspace Filling Available Panel) */
.sw-canvas-wrapper {
    background: var(--sw-panel-bg);
    border-radius: var(--sw-radius);
    border: 1px solid var(--sw-border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: 100% !important;
    min-height: 540px;
}

.sw-canvas-toolbar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    gap: 8px;
}

.sw-zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sw-zoom-controls button {
    background: var(--sw-card-bg);
    border: 1px solid var(--sw-border);
    color: #fff !important;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.sw-toggle-label {
    font-size: 13px;
    color: #f1f5f9 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
}

.sw-toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #0ea5e9;
    cursor: pointer;
}

/* Canvas Stage (Stretches 100% to Fill Workspace Column) */
.sw-canvas-stage {
    position: relative;
    width: 100% !important;
    height: 480px !important;
    background-color: #0d1322;
    background-image: radial-gradient(#334155 1.5px, transparent 1.5px);
    background-size: 20px 20px;
    border-radius: 10px;
    border: 2px dashed var(--sw-border);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin: 0 auto;
}

#sw-main-canvas {
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 650px) {
    .sw-canvas-stage {
        height: 380px !important;
    }
}

.sw-contour-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 8;
    transition: opacity 0.2s ease;
}

/* Cutline Overlay Scaled for enlarged canvas */
.sw-cutline-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: 2px dashed #f43f5e;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
    transition: all 0.3s ease;
    z-index: 10;
}

.sw-cutline-overlay.shape-die_cut { width: 420px; height: 420px; max-width: 90%; max-height: 90%; border-radius: 24px; }
.sw-cutline-overlay.shape-kiss_cut { width: 440px; height: 440px; max-width: 92%; max-height: 92%; border-radius: 4px; border-style: solid; border-color: #38bdf8; }
.sw-cutline-overlay.shape-circle { width: 420px; height: 420px; max-width: 90%; max-height: 90%; border-radius: 50%; }
.sw-cutline-overlay.shape-square { width: 420px; height: 420px; max-width: 90%; max-height: 90%; border-radius: 4px; }
.sw-cutline-overlay.shape-rounded { width: 420px; height: 420px; max-width: 90%; max-height: 90%; border-radius: 48px; }
.sw-cutline-overlay.shape-oval { width: 460px; height: 320px; max-width: 94%; max-height: 80%; border-radius: 50%; }

.sw-canvas-footer-info {
    margin-top: 16px;
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--sw-text-muted) !important;
    flex-wrap: wrap;
    justify-content: center;
}

/* Control Panel */
.sw-control-panel {
    background: var(--sw-panel-bg);
    border-radius: var(--sw-radius);
    border: 1px solid var(--sw-border);
    padding: 20px;
    width: 100%;
}

.sw-tab-content {
    display: none;
}

.sw-tab-content.active {
    display: block;
}

.sw-panel-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sw-panel-section h3, .sw-template-field-heading {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 700;
    color: #38bdf8 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dropzone */
.sw-dropzone {
    border: 2px dashed var(--sw-border);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sw-dropzone:hover, .sw-dropzone.highlight {
    border-color: var(--sw-primary);
    background: rgba(14, 165, 233, 0.08);
}

.sw-upload-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
}

.sw-dropzone h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    color: #fff !important;
}

.sw-dropzone p {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: var(--sw-text-muted) !important;
}

/* Shape Pills */
.sw-shape-pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.sw-shape-btn {
    background: var(--sw-card-bg);
    border: 1px solid var(--sw-border);
    color: #cbd5e1 !important;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.sw-shape-btn:hover {
    color: #fff !important;
    border-color: var(--sw-primary);
}

.sw-shape-btn.active {
    background: var(--sw-primary);
    border-color: var(--sw-primary);
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.4);
}

.sw-shape-icon {
    font-size: 18px;
}

/* Dimensions Inputs */
.sw-dim-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sw-dim-field {
    flex: 1;
}

.sw-dim-field label {
    display: block;
    font-size: 11px;
    color: var(--sw-text-muted) !important;
    margin-bottom: 4px;
}

.sw-input-suffix {
    display: flex;
    align-items: center;
    background: var(--sw-card-bg);
    border: 1px solid var(--sw-border);
    border-radius: 6px;
    padding: 0 8px;
}

.sw-input-suffix input {
    width: 100%;
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    padding: 8px 4px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

.sw-input-suffix span {
    font-size: 12px;
    color: var(--sw-text-muted) !important;
}

.sw-dim-x {
    font-size: 18px;
    color: var(--sw-text-muted) !important;
    margin-top: 18px;
}

/* UNIFIED GLASSMORPHISM CARD AT BOTTOM (Quantity + Pricing + Actions) */
.sw-lab-bottom-glass-card {
    background: rgba(30, 41, 59, 0.75) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 16px !important;
    padding: 24px !important;
    margin-top: 24px !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    width: 100% !important;
}

.sw-glass-title {
    margin: 0 0 16px 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #38bdf8 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.sw-glass-card-body {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 24px;
    align-items: center;
}

@media (max-width: 1050px) {
    .sw-glass-card-body {
        grid-template-columns: 1fr;
    }
}

.sw-glass-qty-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.sw-qty-btn {
    background: var(--sw-card-bg);
    border: 1px solid var(--sw-border);
    color: #fff !important;
    padding: 8px 4px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sw-qty-btn.active {
    background: var(--sw-primary);
    border-color: var(--sw-primary);
}

.sw-qty-num {
    font-size: 14px;
    font-weight: 700;
}

.sw-qty-discount {
    font-size: 10px;
    color: #22c55e;
    font-weight: 600;
}

.sw-qty-btn.active .sw-qty-discount {
    color: #fff;
}

.sw-custom-qty {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--sw-text-muted) !important;
}

.sw-custom-qty input {
    width: 90px;
}

/* Glass Pricing Stat Box */
.sw-glass-price-section {
    background: rgba(9, 13, 22, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sw-price-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.sw-price-lbl {
    color: var(--sw-text-muted) !important;
    font-size: 12px;
}

.sw-unit-val {
    color: #fff !important;
    font-size: 15px;
}

.sw-savings-badge {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.sw-total-stat {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 8px;
    margin-top: 4px;
}

.sw-total-val {
    color: #38bdf8 !important;
    font-size: 20px;
    font-weight: 800;
}

.sw-shipping-badge {
    font-size: 11px;
    color: #22c55e;
    font-weight: 600;
    text-align: center;
    margin-top: 4px;
}

.sw-glass-action-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Action Buttons */
.sw-btn {
    border: none;
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.sw-btn-primary {
    background: var(--sw-primary);
    color: #fff !important;
}

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

.sw-btn-secondary {
    background: var(--sw-card-bg);
    color: #fff !important;
    border: 1px solid var(--sw-border);
}

.sw-btn-secondary:hover {
    background: var(--sw-border);
}

.sw-btn-cart {
    background: #16a34a !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.sw-btn-cart:hover {
    background: #15803d !important;
}

.sw-btn-lg {
    padding: 14px 20px;
    font-size: 16px;
}

.sw-btn-block {
    width: 100%;
}

.sw-btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

/* Modal */
.sw-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.sw-modal-backdrop.active {
    display: flex;
}

.sw-modal-card {
    background: var(--sw-panel-bg);
    border: 1px solid var(--sw-border);
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 24px;
    box-shadow: var(--sw-shadow);
}

.sw-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--sw-text-muted) !important;
    font-size: 24px;
    cursor: pointer;
}

.sw-modal-header h2 {
    margin: 0 0 4px 0;
    font-size: 20px;
    color: #fff !important;
}

.sw-modal-header p {
    margin: 0 0 20px 0;
    font-size: 13px;
    color: var(--sw-text-muted) !important;
}

.sw-modal-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}

@media (max-width: 700px) {
    .sw-modal-grid {
        grid-template-columns: 1fr;
    }
}

.sw-mockup-display {
    background: #090d16;
    border: 1px solid var(--sw-border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    position: relative;
}

.sw-mockup-display img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.sw-mockup-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: var(--sw-primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.sw-mockup-specs {
    margin-top: 12px;
    font-size: 13px;
    color: var(--sw-text-muted) !important;
}

.sw-mockup-specs p {
    margin: 4px 0;
}

.sw-form-group {
    margin-bottom: 12px;
}

.sw-alert {
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 12px;
}

.sw-alert-success { background: rgba(34, 197, 94, 0.2); color: #22c55e; border: 1px solid #22c55e; }
.sw-alert-error { background: rgba(239, 68, 68, 0.2); color: #ef4444; border: 1px solid #ef4444; }

/* Tools Row & Clipart */
.sw-tools-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.sw-input-with-btn {
    display: flex;
    gap: 8px;
}

.sw-input-with-btn input {
    flex: 1;
}

.sw-clipart-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.sw-clipart-item {
    background: var(--sw-card-bg) !important;
    border: 1px solid var(--sw-border) !important;
    color: #fff !important;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    transition: all 0.2s ease;
}

.sw-clipart-item:hover {
    border-color: var(--sw-primary) !important;
    background: rgba(14, 165, 233, 0.2) !important;
}
