.font-loaded-body,
.cpc-canvas-wrapper,
.cpc-preset-field input,
.cpc-preset-field select,
.cpc-upload-label,
.cpc-preset-upload-trigger,
.cpc-upload-filename,
.cpc-add-text,
.cpc-text-input {
    font-family: 'Product Sans', 'Inter', 'Segoe UI', sans-serif;
}

@font-face {
    font-family: 'Product Sans';
    src: url('../fonts/ProductSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

.cpc-canvas-wrapper {
    border: 1px solid #e2e8f0;
    padding: 14px;
    margin: 16px 0;
    background: #f8fafc;
    touch-action: none;
}

.cpc-helper {
    display: none;
}

.cpc-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(145deg, #0ea5e9, #2563eb);
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 10px;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.18);
    letter-spacing: 0.01em;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cpc-upload-label input {
    display: none;
}

.cpc-product-canvas {
    display: block;
    width: 100%;
    max-width: 720px;
    height: auto;
    border: 1px dashed #cbd5e1;
    background: #fff;
    margin-top: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.cpc-instructions {
    margin-top: 8px;
    font-size: 13px;
    color: #475569;
}

.woocommerce-product-gallery__image.cpc-canvas-wrapper {
    box-sizing: border-box;
    padding: 12px;
    background: #f8fafc;
}

@media (max-width: 768px) {
    .cpc-canvas-wrapper.cpc-sticky-mobile {
        position: sticky;
        top: 0;
        z-index: 20;
    }

    .cpc-canvas-wrapper.cpc-fixed-mobile {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 999;
        margin: 0;
        padding: 0;
        background: #fff;
        box-sizing: border-box;
    }

    .cpc-canvas-wrapper.cpc-fixed-mobile .cpc-product-canvas {
        margin-top: 5px;
    }

    .cpc-canvas-placeholder {
        display: block;
        height: 0;
    }

    /* inputs en página para miniaturas */
    .cpc-vector-thumbs {
        grid-template-columns: repeat(4, 80px);
        gap: 8px;
        margin-top: 8px;
    }

    .cpc-font-thumbs {
        grid-template-columns: repeat(4, 80px);
        gap: 8px;
        margin-top: 8px;
    }

    .cpc-image-thumbs {
        grid-template-columns: repeat(4, 80px);
        gap: 8px;
        margin-top: 8px;
    }

    .cpc-vector-thumb {
        width: 80px;
        height: 80px;
    }

    .cpc-font-thumb {
        width: 80px;
        height: 80px;
    }

    .cpc-image-thumb {
        width: 80px;
        height: 80px;
    }
}

.cpc-controls {
    border: 1px solid #e2e8f0;
    padding: 12px;
    margin-bottom: 12px;
    background: #f8fafc;
    display: grid;
    gap: 8px;
}

.cpc-text-row {
    display: flex;
    gap: 8px;
}

.cpc-text-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d9e1ec;
    border-radius: 12px;
    background: #f9fbfd;
    color: #0f172a;
    font-size: 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cpc-add-text {
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cpc-vector-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 80px);
    gap: 8px;
    margin-top: 8px;
    justify-content: start;
}

.cpc-font-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 80px);
    gap: 8px;
    margin-top: 8px;
    justify-content: start;
}

.cpc-image-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 80px);
    gap: 8px;
    margin-top: 8px;
    justify-content: start;
}

.cpc-vector-thumb {
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    width: 80px;
    height: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cpc-image-thumb {
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    width: 80px;
    height: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cpc-vector-thumb img {
    max-width: 90%;
    max-height: 90%;
    display: block;
}

.cpc-image-thumb img {
    max-width: 90%;
    max-height: 90%;
    display: block;
}

.cpc-font-thumb {
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    width: 80px;
    height: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cpc-font-thumb span {
    font-size: 20px;
    color: #0f172a;
    line-height: 1;
    display: block;
}

.cpc-image-thumb.active,
.cpc-font-thumb.active,
.cpc-vector-thumb.active {
    border-color: #0f172a;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12);
}

/* Estilos inputs en página (preset) */
.cpc-preset-field input[type="text"],
.cpc-preset-field select,
.cpc-preset-upload {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9e1ec;
    border-radius: 12px;
    background: #f9fbfd;
    color: #0f172a;
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cpc-preset-field input[type="text"]:focus,
.cpc-preset-field select:focus {
    border-color: #2563eb;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
    background: #fff;
}

.cpc-preset-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin-bottom: 6px;
}

.cpc-char-counter {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

.cpc-preset-upload {
    cursor: pointer;
}

.cpc-upload-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cpc-preset-upload {
    display: none;
}

.cpc-preset-upload-trigger {
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    background: linear-gradient(145deg, #0ea5e9, #2563eb);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cpc-preset-upload-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.24);
}

.cpc-upload-filename {
    font-size: 14px;
    color: #475569;
}

.cpc-calendar-inline {
    width: 100%;
}

.cpc-calendar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.cpc-calendar-display {
    padding: 5px 10px;
    background: #0f1320;
    border: 0 solid #1f2937;
    border-radius: 10px;
    min-width: 220px;
    color: #e5e7eb;
    font-size: 11px;
    line-height: 1.25;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    text-align: center;
}

.cpc-calendar-toggle {
    border: 0;
    border-radius: 10px;
    padding: 3px 12px;
    background: linear-gradient(90deg, #a3aae8, #8e6398);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease;
    border-color: transparent;
    text-transform: none;
}

.cpc-calendar-toggle:hover {
    opacity: 0.92;
}

.cpc-calendar-picker {
    margin-top: 10px;
}

.cpc-calendar-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.cpc-calendar-close {
    border: 0;
    border-radius: 10px;
    padding: 3px 12px;
    background: #0f1320;
    border-color: #273043;
    color: #e5e7eb;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.cpc-calendar-close:hover {
    opacity: 0.92;
}

.cpc-dtp-root {
    --bg: #12141a;
    --panel: #161b26;
    --muted: #7a8599;
    --text: #eef2f8;
    --ring: rgba(90, 162, 255, 0.6);
    --grad-a: #6ae1c3;
    --grad-b: #6aa7ff;
    background: var(--panel);
    color: var(--text);
    border-radius: 18px;
    padding: 14px;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.25;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.cpc-dtp-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.cpc-dtp-select {
    background: #0f1320;
    color: var(--text);
    border: 1px solid #23283a;
    padding: 8px 10px;
    border-radius: 10px;
}

.cpc-dtp-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--ring);
}

.cpc-dtp-nav {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.cpc-dtp-btn,
.cpc-dtp-btn-primary {
    border: 1px solid #273043;
    background: #0d1220;
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
}

.cpc-dtp-btn-primary {
    border: 0;
    background: linear-gradient(90deg, var(--grad-a), var(--grad-b));
    color: #0b1020;
    font-weight: 700;
}

.cpc-dtp-btn:hover {
    background: #131a2c;
}

.cpc-dtp-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.cpc-dtp-dow {
    text-align: center;
    color: var(--muted);
    font-weight: 600;
    padding: 6px 0;
}

.cpc-dtp-day {
    height: 25px;
    border-radius: 11px;
    border: 1px solid #20263a;
    background: #0b1020;
    color: var(--text);
    display: grid;
    place-items: center;
    cursor: pointer;
    margin-bottom: 0;
    margin-right: 0em;
    min-height: 1.9em;
    font-size: 0.95em;
}

.cpc-dtp-day:hover {
    background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
    color: #0b1020;
    border-color: transparent;
}

.cpc-dtp-day--outside {
    color: #5a647a;
    opacity: 0.7;
}

.cpc-dtp-day--selected {
    background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
    color: #0b1020;
    border-color: transparent;
    font-weight: 800;
}

.cpc-dtp-day--selected:hover {
    background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
    color: #0b1020;
    border-color: transparent;
}

.cpc-dtp-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.cpc-preset-upload::-webkit-file-upload-button {
    padding: 10px 14px;
    margin-right: 10px;
    border: none;
    border-radius: 10px;
    background: #0f172a;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cpc-preset-upload::file-selector-button {
    padding: 10px 14px;
    margin-right: 10px;
    border: none;
    border-radius: 10px;
    background: #0f172a;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cpc-preset-upload:hover::file-selector-button,
.cpc-preset-upload:hover::-webkit-file-upload-button,
.cpc-upload-label:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.2);
}

.cpc-preset-upload:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.cpc-photo-confirm {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.55);
    z-index: 9999;
}

.cpc-photo-confirm.is-open {
    display: flex;
}

.cpc-photo-confirm-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.25);
    color: #0f172a;
}

.cpc-photo-confirm-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.cpc-photo-confirm-message {
    margin: 0;
    font-size: 14px;
    color: #475569;
}

.cpc-photo-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.cpc-photo-confirm-actions button {
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.cpc-photo-confirm-cancel {
    background: #e2e8f0;
    color: #0f172a;
}

.cpc-photo-confirm-continue {
    background: #2563eb;
    color: #fff;
}

.cpc-submit-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.42);
    z-index: 10000;
}

.cpc-submit-overlay.is-open {
    display: flex;
}

.cpc-submit-overlay-card {
    min-width: 220px;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
    color: #0f172a;
}

.cpc-submit-overlay-spinner {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 3px solid rgba(37, 99, 235, 0.18);
    border-top-color: #2563eb;
    animation: cpc-submit-spin 0.8s linear infinite;
    flex: 0 0 auto;
}

.cpc-submit-overlay-text {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

@keyframes cpc-submit-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}
