/* ==========================================================================
   WP LabelMaker - 3D Label Designer Public Styles
   ========================================================================== */

/* Reset within our container to avoid theme conflicts */
#wplm-customizer *,
#wplm-customizer *::before,
#wplm-customizer *::after {
    box-sizing: border-box;
}

/* ---------- Main Layout ---------- */

.wplm-customizer {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

/* ---------- 3D Preview Panel ---------- */

.wplm-preview {
    flex: 1 1 58%;
    min-width: 320px;
    min-height: 450px;
    background: linear-gradient(135deg, #e8ecf1 0%, #f5f7fa 100%);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid #dde1e6;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.wplm-preview canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Loading overlay */
.wplm-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #e8ecf1 0%, #f5f7fa 100%);
    z-index: 10;
    font-size: 14px;
    color: #666;
    transition: opacity 0.4s ease;
}

.wplm-loading.wplm-hidden {
    opacity: 0;
    pointer-events: none;
}

.wplm-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #dde1e6;
    border-top-color: #1a5276;
    border-radius: 50%;
    animation: wplm-spin 0.8s linear infinite;
}

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

/* ---------- Controls Panel ---------- */

.wplm-controls {
    flex: 1 1 38%;
    min-width: 300px;
    max-height: 700px;
    overflow-y: auto;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #dde1e6;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.wplm-controls-title {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.01em;
}

/* ---------- Control Groups ---------- */

.wplm-control-group {
    margin-bottom: 18px;
}

.wplm-control-group > label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---------- Select ---------- */

.wplm-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: auto;
}

.wplm-select:hover,
.wplm-select:focus {
    border-color: #1a5276;
    outline: none;
}

/* ---------- Mode Toggle (styled radio buttons) ---------- */

.wplm-mode-toggle {
    display: flex;
    gap: 8px;
}

.wplm-radio-label {
    flex: 1;
    cursor: pointer;
}

.wplm-radio-label input[type="radio"] {
    display: none;
}

.wplm-radio-btn {
    display: block;
    padding: 10px 14px;
    border: 2px solid #d0d5dd;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    color: #555;
    background: #fff;
}

.wplm-radio-btn:hover {
    border-color: #95afc0;
    background: #f8f9fa;
}

.wplm-radio-label input[type="radio"]:checked + .wplm-radio-btn {
    background: #1a5276;
    color: #fff;
    border-color: #1a5276;
}

/* ---------- Text Input ---------- */

.wplm-text-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wplm-text-input:focus {
    border-color: #1a5276;
    outline: none;
}

.wplm-text-input::placeholder {
    color: #aaa;
    text-transform: none;
    letter-spacing: normal;
}

.wplm-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #999;
}

/* ---------- Warning / Error Messages ---------- */

.wplm-warning {
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.wplm-text-error {
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ---------- Color Picker ---------- */

.wplm-color-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.wplm-color-input {
    width: 44px;
    height: 44px;
    border: 2px solid #d0d5dd;
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
    background: none;
}

.wplm-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.wplm-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}

.wplm-color-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.wplm-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s, border-color 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.wplm-swatch:hover {
    transform: scale(1.15);
}

.wplm-swatch.active {
    border-color: #333;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #333;
}

.wplm-swatch-light {
    border-color: #ccc !important;
}

.wplm-swatch-light.active {
    border-color: #333 !important;
}

/* ---------- Divider Line ---------- */

.wplm-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

/* ---------- Action Buttons ---------- */

.wplm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wplm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    line-height: 1;
    white-space: nowrap;
}

.wplm-btn svg {
    flex-shrink: 0;
}

.wplm-btn-outline {
    background: #fff;
    color: #555;
    border: 1px solid #d0d5dd;
}

.wplm-btn-outline:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #333;
}

.wplm-btn-primary {
    background: #1a5276;
    color: #fff;
    flex: 1;
    justify-content: center;
}

.wplm-btn-primary:hover {
    background: #154360;
}

.wplm-btn-primary:disabled {
    background: #ddd;
    color: #999;
    cursor: not-allowed;
}

.wplm-btn-cart {
    width: 100%;
    background: #27ae60;
    color: #fff;
    justify-content: center;
    padding: 12px 16px;
    font-size: 14px;
}

.wplm-btn-cart:hover {
    background: #219a52;
}

.wplm-btn-cart:disabled {
    background: #b8d4c5;
    color: #fff;
    cursor: not-allowed;
}

/* ---------- Status Messages ---------- */

.wplm-status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.wplm-status.wplm-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.wplm-status.wplm-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.wplm-status.wplm-sending {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ---------- Processing overlay ---------- */

.wplm-processing {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wplm-processing-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #bfdbfe;
    border-top-color: #1e40af;
    border-radius: 50%;
    animation: wplm-spin 0.6s linear infinite;
}

/* ---------- Checkbox Label ---------- */

.wplm-checkbox-label {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px !important;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
}

.wplm-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #1a5276;
    cursor: pointer;
    margin: 0;
}

/* ---------- Dimensions Panel ---------- */

.wplm-dims-panel {
    margin-top: 10px;
    padding: 12px 14px;
    background: #f8f9fb;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
}

.wplm-dims-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
}

.wplm-dim-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 12px;
    color: #555;
    border-bottom: 1px solid #eef0f3;
}

.wplm-dim-item:last-child,
.wplm-dim-item:nth-last-child(2):nth-child(odd) {
    border-bottom: none;
}

.wplm-dim-label {
    font-weight: 500;
    color: #666;
}

.wplm-dim-value {
    font-weight: 700;
    color: #1a1a2e;
    font-variant-numeric: tabular-nums;
}

.wplm-dims-title {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 700;
    color: #1a5276;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-bottom: 4px;
    margin-top: 8px;
    border-bottom: 1px solid #d0d5dd;
}

.wplm-dims-title:first-child {
    margin-top: 0;
}

/* ---------- Hidden utility ---------- */

.wplm-hidden {
    display: none !important;
}

/* ---------- Custom scrollbar for controls ---------- */

.wplm-controls::-webkit-scrollbar {
    width: 6px;
}

.wplm-controls::-webkit-scrollbar-track {
    background: transparent;
}

.wplm-controls::-webkit-scrollbar-thumb {
    background: #d0d5dd;
    border-radius: 3px;
}

.wplm-controls::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .wplm-customizer {
        flex-direction: column;
        gap: 16px;
    }

    .wplm-preview {
        min-height: 320px;
        flex-basis: auto;
    }

    .wplm-controls {
        max-height: none;
        flex-basis: auto;
    }

    .wplm-actions {
        flex-direction: column;
    }

    .wplm-btn {
        justify-content: center;
    }

    .wplm-mode-toggle {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .wplm-controls {
        padding: 16px;
    }

    .wplm-preview {
        min-height: 260px;
    }
}

/* ============================================================
   Email Gate Modal
   ============================================================ */
.wplm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wplm-modal-overlay.wplm-hidden {
    display: none;
}

.wplm-modal {
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.wplm-modal-title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}

.wplm-modal-desc {
    margin: 0 0 18px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.wplm-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.wplm-modal-actions .wplm-btn {
    flex: 1;
    justify-content: center;
}

.wplm-email-form .wplm-control-group {
    margin-bottom: 12px;
}

/* ============================================================
   Restore Banner ("Continue Designing")
   ============================================================ */
.wplm-restore-banner {
    margin-bottom: 16px;
    padding: 12px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
}

.wplm-restore-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.wplm-restore-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: #1e40af;
    min-width: 0;
}

.wplm-restore-text strong {
    font-weight: 700;
    font-size: 13px;
}

.wplm-restore-text span {
    font-size: 12px;
    color: #3b82f6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.wplm-restore-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.wplm-restore-btn {
    padding: 6px 14px;
    background: #1a5276;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.wplm-restore-btn:hover {
    background: #154360;
}

.wplm-restore-dismiss {
    padding: 6px 14px;
    background: transparent;
    color: #64748b;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.wplm-restore-dismiss:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* ============================================================
   Popular Designs Suggestions
   ============================================================ */
.wplm-popular-designs {
    margin-bottom: 14px;
}

.wplm-popular-label {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.wplm-popular-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.wplm-popular-chip {
    display: inline-block;
    padding: 4px 12px;
    background: #f0f4f8;
    color: #1a5276;
    border: 1px solid #dde5ed;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wplm-popular-chip:hover {
    background: #1a5276;
    color: #fff;
    border-color: #1a5276;
}
