/* WC PDF Print Upload - Frontend Styles
 * Aligned with SewDirect theme design system.
 * Uses WordPress/theme CSS custom properties where available.
 */

/* ── Theme compatibility for PDF Print products ───────────────────── */

/* Hide the main product gallery on mobile only. */
@media (max-width: 768px) {
    body.wcppu-pdf-print-product .patter-woo-image-gallery {
        display: none !important;
    }
}

/* ── Wrapper ────────────────────────────────────── */

#wcppu-upload-wrapper {
    margin-bottom: 24px;
    font-family: 'Outfit', sans-serif;
}

/* ── Cart form layout ───────────────────────────── */

.wcppu-cart-form {
    display: flex;
    flex-direction: column;
}

.wcppu-cart-form .single_add_to_cart_button {
    align-self: stretch;
    margin-top: 8px;
}

/* ── Error message ──────────────────────────────── */

#wcppu-error {
    display: none;
    background: #fef0f0;
    border: 1px solid var(--wp--preset--color--secondary, #d0481e);
    color: var(--wp--preset--color--secondary-dark, #b03815);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ── Drop zone ──────────────────────────────────── */

#wcppu-drop-zone {
    border: 2px dashed var(--wp--preset--color--border, #e2e8f0);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    margin-bottom: 16px;
}

#wcppu-drop-zone:hover,
#wcppu-drop-zone.wcppu-drag-over {
    border-color: var(--wp--preset--color--primary, #116973);
    background-color: var(--wp--preset--color--primary-light, #e6f0f1);
}

#wcppu-drop-zone p {
    margin: 0 0 8px;
    color: var(--wp--preset--color--dark-grey, #64748b);
    font-size: 0.875rem;
    line-height: 1.5;
}

#wcppu-drop-zone .wcppu-hint {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--wp--preset--color--muted, #94a3b8);
}

/* ── Upload button ──────────────────────────────── */

#wcppu-upload-btn {
    display: inline-block;
    padding: 12px clamp(1.25rem, 0.5rem + 2vw, 2rem);
    background: var(--wp--preset--color--primary, #116973);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.2;
    transition: background-color 0.2s ease;
}

#wcppu-upload-btn:hover {
    background: var(--wp--preset--color--primary-medium, #0d525a);
}

/* ── File cards ─────────────────────────────────── */

.wcppu-file-card {
    border: 1px solid var(--wp--preset--color--border, #e2e8f0);
    border-radius: 12px;
    margin-bottom: 16px;
    /* overflow visible so tooltips can pop out over the card edge. */
}

.wcppu-file-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    padding: 12px 16px;
    background: var(--wp--preset--color--light, #f1f5f9);
    border-bottom: 1px solid var(--wp--preset--color--border, #e2e8f0);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    gap: 8px;
}

.wcppu-file-header-text {
    display: block;
    min-width: 0;
}

.wcppu-file-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wp--preset--color--primary, #116973);
    line-height: 1.3;
    margin-bottom: 2px;
}

.wcppu-file-name {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--wp--preset--color--dark, #1a202c);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wcppu-file-status {
    color: var(--wp--preset--color--dark-grey, #64748b);
    font-size: 0.8125rem;
    font-style: italic;
    flex-shrink: 0;
    align-self: center;
}

.wcppu-remove-file {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--wp--preset--color--muted, #94a3b8);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.wcppu-remove-file:hover {
    color: var(--wp--preset--color--secondary, #d0481e);
}

/* ── Upload progress ────────────────────────────── */

.wcppu-progress {
    height: 3px;
    background: var(--wp--preset--color--border, #e2e8f0);
}

.wcppu-progress-bar {
    height: 100%;
    background: var(--wp--preset--color--primary, #116973);
    width: 0;
    transition: width 0.2s ease;
}

.wcppu-uploading .wcppu-file-header {
    background: var(--wp--preset--color--primary-light, #e6f0f1);
}

/* ── Thumbnail grid ─────────────────────────────── */

.wcppu-thumb-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px 16px;
}

.wcppu-thumb-item {
    position: relative;
    display: flex;
    flex-direction: column;
}

.wcppu-thumb {
    display: block;
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--wp--preset--color--border, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.wcppu-thumb:hover,
.wcppu-thumb:focus {
    border-color: var(--wp--preset--color--primary, #116973);
    box-shadow: 0 2px 8px rgba(17, 105, 115, 0.15);
    outline: none;
    transform: translateY(-1px);
}

.wcppu-thumb-canvas-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    background: #f8fafc;
    padding: 8px;
}

.wcppu-thumb-canvas-wrap canvas {
    max-width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.wcppu-thumb-placeholder {
    font-size: 0.75rem;
    color: var(--wp--preset--color--muted, #94a3b8);
    font-style: italic;
}

.wcppu-thumb-error {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--wp--preset--color--secondary, #d0481e);
}

.wcppu-thumb-overlay {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--wp--preset--color--light, #f1f5f9);
    border-top: 1px solid var(--wp--preset--color--border, #e2e8f0);
    font-size: 0.75rem;
}

.wcppu-thumb-label {
    font-weight: 600;
    color: var(--wp--preset--color--dark, #1a202c);
}

.wcppu-thumb-size {
    color: var(--wp--preset--color--dark-grey, #64748b);
}

.wcppu-thumb-actions {
    position: relative;
    margin-top: 8px;
    display: flex;
    justify-content: center;
}

.wcppu-thumb-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    background: #ffffff;
    color: var(--wp--preset--color--secondary, #d0481e);
    border: 1px solid var(--wp--preset--color--secondary, #d0481e);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.wcppu-thumb-remove:hover,
.wcppu-thumb-remove:focus {
    background: var(--wp--preset--color--secondary, #d0481e);
    color: #ffffff;
    outline: none;
}

.wcppu-thumb-remove-icon {
    font-size: 1rem;
    line-height: 1;
}

.wcppu-thumb-remove-label {
    white-space: nowrap;
}

/* ── Coachmark overlay (shown once, click to dismiss) ───── */

#wcppu-coachmark {
    position: fixed;
    inset: 0;
    z-index: 10050;
}

.wcppu-coachmark-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.wcppu-coachmark-card {
    position: fixed;
    width: min(320px, calc(100vw - 24px));
    background: #ffffff;
    color: var(--wp--preset--color--dark, #1a202c);
    border-radius: 12px;
    padding: 16px 18px 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.35);
    font-size: 0.875rem;
    line-height: 1.5;
}

.wcppu-coachmark-close {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: var(--wp--preset--color--dark-grey, #64748b);
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.wcppu-coachmark-close:hover,
.wcppu-coachmark-close:focus {
    background: rgba(15, 23, 42, 0.08);
    color: var(--wp--preset--color--secondary, #d0481e);
    outline: none;
}

.wcppu-coachmark-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #ffffff;
    transform: rotate(45deg);
}

.wcppu-coachmark-card--below .wcppu-coachmark-arrow {
    top: -8px;
    box-shadow: -2px -2px 4px rgba(15, 23, 42, 0.06);
    border-top-left-radius: 3px;
}

.wcppu-coachmark-card--above .wcppu-coachmark-arrow {
    bottom: -8px;
    box-shadow: 2px 2px 4px rgba(15, 23, 42, 0.06);
    border-bottom-right-radius: 3px;
}

.wcppu-coachmark-title {
    margin: 0 0 6px;
    padding-right: 22px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--wp--preset--color--primary, #116973);
}

.wcppu-coachmark-body {
    margin: 0 0 12px;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--wp--preset--color--dark, #1a202c);
}

.wcppu-coachmark-dismiss {
    display: inline-block;
    padding: 8px 14px;
    background: var(--wp--preset--color--primary, #116973);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.wcppu-coachmark-dismiss:hover,
.wcppu-coachmark-dismiss:focus {
    background: var(--wp--preset--color--primary-medium, #0d525a);
    outline: none;
}

/* ── Removed thumbnail state ────────────────────── */

.wcppu-thumb-item-removed .wcppu-thumb {
    opacity: 0.4;
    filter: grayscale(0.6);
}

.wcppu-thumb-removed-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(148, 163, 184, 0.95);
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: none;
}

.wcppu-thumb-restore {
    margin-top: 8px;
    background: none;
    border: 1px solid var(--wp--preset--color--primary, #116973);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.75rem;
    color: var(--wp--preset--color--primary, #116973);
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.wcppu-thumb-restore:hover {
    background: var(--wp--preset--color--primary, #116973);
    color: #ffffff;
}

/* ── Modal ──────────────────────────────────────── */

#wcppu-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
}

#wcppu-modal.wcppu-modal-open {
    display: block;
}

.wcppu-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.wcppu-modal-dialog {
    background: #ffffff;
    border-radius: 12px;
    max-width: 960px;
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.wcppu-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--wp--preset--color--border, #e2e8f0);
    background: var(--wp--preset--color--light, #f1f5f9);
}

.wcppu-modal-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--wp--preset--color--dark, #1a202c);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 12px;
}

.wcppu-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--wp--preset--color--dark-grey, #64748b);
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s ease;
}

.wcppu-modal-close:hover {
    color: var(--wp--preset--color--secondary, #d0481e);
}

.wcppu-modal-canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: auto;
    background: #f8fafc;
    min-height: 200px;
}

.wcppu-modal-canvas-wrap canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.wcppu-modal-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--wp--preset--color--border, #e2e8f0);
    justify-content: flex-end;
}

.wcppu-btn {
    background: none;
    border: 1px solid var(--wp--preset--color--primary, #116973);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.8125rem;
    color: var(--wp--preset--color--primary, #116973);
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.wcppu-btn:hover {
    background: var(--wp--preset--color--primary, #116973);
    color: #ffffff;
}

.wcppu-btn-danger {
    border-color: var(--wp--preset--color--secondary, #d0481e);
    color: var(--wp--preset--color--secondary, #d0481e);
}

.wcppu-btn-danger:hover {
    background: var(--wp--preset--color--secondary, #d0481e);
    color: #ffffff;
}

body.wcppu-modal-lock {
    overflow: hidden;
}

/* ── Summary ────────────────────────────────────── */

#wcppu-summary {
    display: none;
    background: var(--wp--preset--color--primary-light, #e6f0f1);
    border: 1px solid var(--wp--preset--color--primary, #116973);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

#wcppu-summary p {
    margin: 0 0 4px;
    font-size: 0.875rem;
    color: var(--wp--preset--color--dark, #1a202c);
}

/* Total price line — use WooCommerce .price class for consistent styling. */
#wcppu-summary .wcppu-total-line {
    font-size: 0.875rem;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

#wcppu-summary .wcppu-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--wp--preset--color--primary-dark, #083339);
}

#wcppu-summary .wcppu-price .woocommerce-price-suffix {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--wp--preset--color--text-light, #5a6b7c);
}

#wcppu-summary .wcppu-pricing-note {
    font-size: 0.75rem;
    color: var(--wp--preset--color--text-light, #5a6b7c);
    margin-top: 8px;
}

/* ── "From" price label on product page ─────────── */

.wcppu-price-from {
    font-size: 0.8em;
    color: var(--wp--preset--color--dark-grey, #64748b);
    font-weight: 400;
}

/* ── Hide default WooCommerce quantity for this type ── */

.product-type-pdf_print .quantity {
    display: none !important;
}
