/* ============================================================
   FotoDigital Apparel Editor - T-Shirt / Felpe / Abbigliamento
   ============================================================ */

:root {
    --ap-primary: #8e44ad;
    --ap-primary-hover: #7d3c98;
    --ap-danger: #e74c3c;
    --ap-topbar-bg: #263238;
    --ap-topbar-height: 56px;
    --ap-canvas-bg: #f0f0f0;
    --ap-panel-bg: #ffffff;
    --ap-border: #e0e0e0;
    --ap-text: #333333;
    --ap-text-light: #888888;
    --ap-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ap-radius: 8px;
}

/* ── Reset ── */
.apparel-editor-page,
.apparel-editor-page *,
.apparel-editor-page *::before,
.apparel-editor-page *::after {
    box-sizing: border-box !important;
}
.apparel-editor-page {
    font-family: var(--ap-font) !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--ap-canvas-bg) !important;
    font-size: 13px !important;
    color: var(--ap-text) !important;
    line-height: 1.4 !important;
    letter-spacing: normal !important;
    min-height: 100vh !important;
    max-width: none !important;
}

/* Hide WP theme elements */
.apparel-editor-page .wp-site-blocks,
.apparel-editor-page .is-layout-constrained,
.apparel-editor-page .is-layout-flow,
.apparel-editor-page .has-global-padding,
.apparel-editor-page > header,
.apparel-editor-page > footer,
.apparel-editor-page .wp-block-template-part,
.apparel-editor-page .wp-block-navigation,
.apparel-editor-page .wp-block-header,
.apparel-editor-page .wp-block-footer {
    display: none !important;
}
.apparel-editor-page a {
    text-decoration: none !important;
    color: inherit;
}
.apparel-editor-page svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Fix admin bar offset */
html.admin-bar .apparel-editor-page {
    height: calc(100vh - 32px) !important;
}


/* ══════════════════════════════════════════════════════════════
   TOP BAR
   ══════════════════════════════════════════════════════════════ */
.ap-topbar {
    height: var(--ap-topbar-height);
    background: var(--ap-topbar-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    position: relative;
}

/* -- Left: Logo + product name -- */
.ap-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.ap-topbar-left img {
    max-height: 32px;
    width: auto;
    display: block;
}
.ap-topbar-left .ap-product-name {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -- Center: Color + Model + Size selectors -- */
.ap-topbar-center {
    display: flex;
    align-items: center;
    gap: 16px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.ap-selector-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ap-selector-group label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* -- Right: Price + CTA -- */
.ap-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.ap-topbar-price {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}
.ap-format-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,.5);
    font-size: 12px;
}
.ap-format-badge {
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.85);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
}


/* ══════════════════════════════════════════════════════════════
   SELECTORS (dropdown)
   ══════════════════════════════════════════════════════════════ */
.ap-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--ap-radius);
    padding: 8px 36px 8px 14px;
    font-size: 13px;
    font-family: var(--ap-font);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    min-width: 140px;
    transition: background 0.2s, border-color 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.ap-select:hover {
    background-color: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
}
.ap-select:focus {
    border-color: var(--ap-primary);
    box-shadow: 0 0 0 2px rgba(142, 68, 173, 0.3);
}
.ap-select option {
    background: #263238;
    color: #ffffff;
}


/* ══════════════════════════════════════════════════════════════
   ADD TO CART / BUY BUTTON
   ══════════════════════════════════════════════════════════════ */
.ap-btn-buy {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ap-primary);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--ap-font);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    white-space: nowrap;
}
.ap-btn-buy:hover {
    background: var(--ap-primary-hover);
    box-shadow: 0 2px 8px rgba(142, 68, 173, 0.4);
}
.ap-btn-buy:active {
    transform: scale(0.97);
}
.ap-btn-buy:disabled,
.ap-btn-buy.disabled {
    background: #9e9e9e;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}
.ap-btn-buy:disabled:hover,
.ap-btn-buy.disabled:hover {
    background: #9e9e9e;
    box-shadow: none;
    transform: none;
}
.ap-btn-buy svg {
    width: 16px;
    height: 16px;
    stroke: #ffffff;
}


/* ══════════════════════════════════════════════════════════════
   MAIN AREA (3-column layout)
   ══════════════════════════════════════════════════════════════ */
.ap-main {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
    background: var(--ap-canvas-bg);
}


/* ══════════════════════════════════════════════════════════════
   UPLOAD PANEL (Left)
   ══════════════════════════════════════════════════════════════ */
.ap-upload-panel {
    width: 260px;
    flex-shrink: 0;
    background: var(--ap-panel-bg);
    border-right: 1px solid var(--ap-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px 16px;
}
.ap-upload-panel h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--ap-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 14px 0;
    padding: 0;
}

/* Upload zone */
.ap-upload-zone {
    border: 2px dashed var(--ap-border);
    border-radius: var(--ap-radius);
    padding: 30px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 180px;
    justify-content: center;
}
.ap-upload-zone:hover {
    border-color: var(--ap-primary);
    background: rgba(142, 68, 173, 0.04);
}
.ap-upload-zone.dragover {
    border-style: solid;
    border-color: var(--ap-primary);
    background: rgba(142, 68, 173, 0.08);
}
.ap-upload-zone .ap-upload-icon {
    width: 48px;
    height: 48px;
    color: var(--ap-text-light);
    transition: color 0.2s;
}
.ap-upload-zone:hover .ap-upload-icon {
    color: var(--ap-primary);
}
.ap-upload-zone .ap-upload-text {
    font-size: 13px;
    color: var(--ap-text-light);
    line-height: 1.5;
}
.ap-upload-zone .ap-upload-text strong {
    color: var(--ap-primary);
    font-weight: 600;
}
.ap-upload-zone .ap-upload-hint {
    font-size: 11px;
    color: #aaaaaa;
}

/* Upload zone - has photo state */
.ap-upload-zone.has-photo {
    border-style: solid;
    border-color: var(--ap-border);
    padding: 12px;
    min-height: 0;
}
.ap-upload-zone.has-photo:hover {
    border-color: var(--ap-primary);
}

/* Photo preview inside upload zone */
.ap-photo-preview {
    position: relative;
    width: 100%;
    border-radius: calc(var(--ap-radius) - 2px);
    overflow: hidden;
}
.ap-photo-preview img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: calc(var(--ap-radius) - 2px);
}
.ap-photo-preview .ap-photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: calc(var(--ap-radius) - 2px);
}
.ap-photo-preview:hover .ap-photo-overlay {
    opacity: 1;
}
.ap-photo-overlay .ap-btn-change {
    background: #ffffff;
    color: var(--ap-text);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--ap-font);
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.2s;
}
.ap-photo-overlay .ap-btn-change:hover {
    background: #f0f0f0;
}

/* Hidden file input */
.ap-upload-panel input[type="file"] {
    display: none;
}


/* ══════════════════════════════════════════════════════════════
   PREVIEW AREA (Center) - Garment Preview (Studio Backdrop)
   ══════════════════════════════════════════════════════════════ */
.ap-preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    min-width: 0;
    overflow: hidden;
    position: relative;
    gap: 16px;
    /* Light gray studio backdrop */
    background:
        radial-gradient(ellipse at 50% 40%, rgba(255,255,255,0.5) 0%, transparent 70%),
        linear-gradient(180deg, #ececec 0%, #e0e0e0 100%);
}

/* Garment container - holds the SVG garment */
.ap-garment-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 450px;
    width: auto;
    flex-shrink: 0;
}

/* Garment SVG */
.ap-garment-svg {
    display: block;
    width: auto;
    height: 100%;
    max-height: 450px;
    object-fit: contain;
    transition: fill 0.3s ease;
}
.ap-garment-svg svg {
    width: auto;
    height: 100%;
    max-height: 450px;
    fill: currentColor;
    stroke: none;
}

/* Print area - positioned absolutely on top of the garment */
.ap-print-area {
    position: absolute;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s ease, height 0.3s ease, top 0.3s ease, left 0.3s ease;
}
.ap-print-area.empty {
    border: 2px dashed rgba(142, 68, 173, 0.4);
    border-radius: 4px;
}
.ap-print-area-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--ap-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    background: rgba(255,255,255,0.85);
    padding: 2px 8px;
    border-radius: 3px;
}

/* Canvas wrapper inside print area */
.ap-canvas-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ap-print-area canvas {
    display: block;
}

/* Placeholder overlay */
.ap-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    color: var(--ap-text-light);
    pointer-events: none;
    z-index: 2;
}
.ap-placeholder h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 12px 0 4px;
    color: var(--ap-text);
}
.ap-placeholder p {
    font-size: 13px;
    margin: 0;
}
.ap-placeholder-icon {
    opacity: 0.3;
}

/* Garment info below the preview */
.ap-garment-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border-radius: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.ap-garment-info-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ap-text);
}
.ap-garment-info-type {
    font-size: 11px;
    color: var(--ap-text-light);
}


/* ══════════════════════════════════════════════════════════════
   TOOLS PANEL (Right)
   ══════════════════════════════════════════════════════════════ */
.ap-tools-panel {
    width: 220px;
    flex-shrink: 0;
    background: var(--ap-panel-bg);
    border-left: 1px solid var(--ap-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0;
}

/* Section inside tools panel */
.ap-tools-section {
    padding: 16px;
    border-bottom: 1px solid var(--ap-border);
}
.ap-tools-section:last-child {
    border-bottom: none;
}
.ap-tools-section h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--ap-text-light);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 0 12px 0;
    padding: 0;
}

/* -- Zoom slider -- */
.ap-zoom-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ap-zoom-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--ap-border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.ap-zoom-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--ap-primary);
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}
.ap-zoom-row input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--ap-primary-hover);
    transform: scale(1.15);
}
.ap-zoom-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--ap-primary);
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}
.ap-zoom-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--ap-text);
    min-width: 38px;
    text-align: center;
    background: #f5f5f5;
    border-radius: 4px;
    padding: 3px 6px;
}

/* -- Rotate / Flip buttons -- */
.ap-rotate-row {
    display: flex;
    gap: 8px;
}
.ap-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius);
    background: #ffffff;
    color: var(--ap-text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: var(--ap-font);
}
.ap-btn-icon:hover {
    background: #f5f5f5;
    border-color: var(--ap-primary);
    color: var(--ap-primary);
}
.ap-btn-icon:active {
    background: #eeeeee;
}
.ap-btn-icon svg {
    width: 18px;
    height: 18px;
}

/* -- Center / Flip button -- */
.ap-btn-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius);
    background: #ffffff;
    color: var(--ap-text);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--ap-font);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ap-btn-outline:hover {
    background: #f5f5f5;
    border-color: var(--ap-primary);
    color: var(--ap-primary);
}
.ap-btn-outline:active {
    background: #eeeeee;
}
.ap-btn-outline svg {
    width: 14px;
    height: 14px;
}


/* ══════════════════════════════════════════════════════════════
   GARMENT COLOR SELECTOR
   ══════════════════════════════════════════════════════════════ */
.ap-color-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.ap-color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    outline: none;
    padding: 0;
    position: relative;
}
.ap-color-btn:hover {
    transform: scale(1.15);
    border-color: rgba(0, 0, 0, 0.2);
}
.ap-color-btn.active {
    border-color: var(--ap-primary);
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.3);
}
.ap-color-btn[data-color="#ffffff"],
.ap-color-btn[data-color="white"] {
    border-color: var(--ap-border);
}
.ap-color-btn[data-color="#ffffff"].active,
.ap-color-btn[data-color="white"].active {
    border-color: var(--ap-primary);
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.3);
}

/* Color name tooltip */
.ap-color-btn::after {
    content: attr(data-label);
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 600;
    color: var(--ap-text-light);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}
.ap-color-btn:hover::after {
    opacity: 1;
}

/* Background color swatches (for print area background) */
.ap-color-swatches {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}
.ap-color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
    outline: none;
    padding: 0;
}
.ap-color-swatch:hover {
    transform: scale(1.12);
    border-color: rgba(0, 0, 0, 0.15);
}
.ap-color-swatch.active {
    border-color: var(--ap-primary);
    box-shadow: 0 0 0 2px rgba(142, 68, 173, 0.3);
}
.ap-color-swatch[data-color="#ffffff"],
.ap-color-swatch[data-color="white"] {
    border-color: var(--ap-border);
}

/* Custom color picker */
.ap-color-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.ap-color-custom label {
    font-size: 11px;
    color: var(--ap-text-light);
    white-space: nowrap;
}
.ap-color-custom input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    border: 1px solid var(--ap-border);
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
    background: #ffffff;
}
.ap-color-custom input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
.ap-color-custom input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}


/* ══════════════════════════════════════════════════════════════
   LOADING OVERLAY
   ══════════════════════════════════════════════════════════════ */
.ap-loading {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.ap-loading.active {
    opacity: 1;
    visibility: visible;
}
.ap-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: ap-spin 0.8s linear infinite;
}
.ap-loading-text {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

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


/* ══════════════════════════════════════════════════════════════
   GENERIC UTILITIES
   ══════════════════════════════════════════════════════════════ */
.ap-hidden {
    display: none !important;
}

/* General button reset */
.apparel-editor-page button {
    font-family: var(--ap-font);
}


/* ══════════════════════════════════════════════════════════════
   SCROLLBAR STYLING (panels)
   ══════════════════════════════════════════════════════════════ */
.ap-upload-panel::-webkit-scrollbar,
.ap-tools-panel::-webkit-scrollbar {
    width: 5px;
}
.ap-upload-panel::-webkit-scrollbar-track,
.ap-tools-panel::-webkit-scrollbar-track {
    background: transparent;
}
.ap-upload-panel::-webkit-scrollbar-thumb,
.ap-tools-panel::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 3px;
}
.ap-upload-panel::-webkit-scrollbar-thumb:hover,
.ap-tools-panel::-webkit-scrollbar-thumb:hover {
    background: #aaaaaa;
}


/* ══════════════════════════════════════════════════════════════
   RESPONSIVE - Tablet (under 1024px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .ap-main {
        flex-direction: column;
    }

    .ap-upload-panel {
        width: 100%;
        flex-shrink: 0;
        border-right: none;
        border-bottom: 1px solid var(--ap-border);
        padding: 12px 16px;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        overflow-y: visible;
        overflow-x: auto;
    }
    .ap-upload-panel h3 {
        margin: 0;
        white-space: nowrap;
    }
    .ap-upload-zone {
        min-height: 0;
        padding: 12px 20px;
        flex-direction: row;
        min-width: 200px;
    }
    .ap-upload-zone .ap-upload-icon {
        width: 28px;
        height: 28px;
    }

    .ap-preview-area {
        flex: 1;
        padding: 16px;
    }

    .ap-garment-wrap {
        max-height: 320px;
    }
    .ap-garment-svg,
    .ap-garment-svg svg {
        max-height: 320px;
    }

    .ap-tools-panel {
        width: 100%;
        flex-shrink: 0;
        border-left: none;
        border-top: 1px solid var(--ap-border);
        flex-direction: row;
        overflow-y: visible;
        overflow-x: auto;
        padding: 0;
    }
    .ap-tools-section {
        border-bottom: none;
        border-right: 1px solid var(--ap-border);
        min-width: 160px;
        padding: 12px 16px;
    }
    .ap-tools-section:last-child {
        border-right: none;
    }

    /* Topbar adjustments */
    .ap-topbar-center {
        position: static;
        transform: none;
    }
    .ap-select {
        min-width: 120px;
    }
}


/* ══════════════════════════════════════════════════════════════
   RESPONSIVE - Mobile (under 768px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    :root {
        --ap-topbar-height: 48px;
    }

    .ap-topbar {
        padding: 0 12px;
        gap: 8px;
        flex-wrap: wrap;
        height: auto;
        min-height: var(--ap-topbar-height);
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .ap-topbar-left .ap-product-name {
        display: none;
    }
    .ap-topbar-center {
        position: static;
        transform: none;
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    .ap-selector-group label {
        display: none;
    }
    .ap-select {
        min-width: 100px;
        font-size: 12px;
        padding: 6px 30px 6px 10px;
    }
    .ap-topbar-price {
        font-size: 14px;
    }
    .ap-btn-buy {
        padding: 8px 14px;
        font-size: 11px;
    }

    /* Panels full-width, stacked */
    .ap-upload-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }
    .ap-upload-zone {
        flex-direction: column;
        min-width: 0;
    }

    .ap-preview-area {
        padding: 12px;
    }

    .ap-garment-wrap {
        max-height: 260px;
    }
    .ap-garment-svg,
    .ap-garment-svg svg {
        max-height: 260px;
    }

    .ap-tools-panel {
        flex-direction: column;
    }
    .ap-tools-section {
        border-right: none;
        border-bottom: 1px solid var(--ap-border);
        min-width: 0;
        width: 100%;
    }
    .ap-tools-section:last-child {
        border-bottom: none;
    }
}
