/**
 * Card Maker Module Styles
 * Plugin: WP Copy Text Button
 * Prefix: .wctb-cm- (card maker specific), .wctb- (shared)
 * Large, high-visibility pop-up presentation with zero scrolling.
 */

/* ── Make Card Button (Frontend) ─────────────────────────────────── */
.wctb-cardmaker-btn {
    margin-left: 4px !important;
}

.wctb-cardmaker-btn:hover {
    background-color: #c5a55a;
    color: #ffffff;
    border-color: #c5a55a;
}

/* ── Modal Overlay ────────────────────────────────────────────────── */
.wctb-cm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 12, 18, 0.84);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    overflow: hidden; /* NO scrolling on overlay */
}

.wctb-cm-overlay.wctb-cm-active {
    display: flex;
}

/* ── Modal Container (Generous & High Visibility) ─────────────────── */
.wctb-cm-modal {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.15);
    animation: wctb-cm-popIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-sizing: border-box;
    overflow: hidden; /* NO scrolling on modal */
    display: flex;
    flex-direction: column;
    max-height: 94vh;
    max-width: 980px;
    width: 95vw;
}

@keyframes wctb-cm-popIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Modal Header ─────────────────────────────────────────────────── */
.wctb-cm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 26px;
    border-bottom: 1px solid #ede7de;
    background: #faf8f5;
    flex-shrink: 0;
}

.wctb-cm-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #241e19;
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: -0.2px;
}

.wctb-cm-close {
    background: none;
    border: none;
    font-size: 26px;
    color: #8c827a;
    cursor: pointer;
    padding: 2px 8px;
    line-height: 1;
    border-radius: 8px;
    transition: color 0.15s, background-color 0.15s;
}

.wctb-cm-close:hover {
    color: #1f1a16;
    background-color: #eee7dc;
}

/* ── Modal Body: Desktop Large Side-by-Side ───────────────────────── */
.wctb-cm-body {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 32px;
    padding: 22px 30px;
    box-sizing: border-box;
}

/* Preview Wrap (Large 500x500 area on desktop) */
.wctb-cm-preview-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 500px;
    height: 500px;
    background: #f7f4ed;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.wctb-cm-preview-wrap canvas {
    display: block;
    max-width: 490px;
    max-height: 490px;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    background-color: #f7f4ee;
    transition: width 0.18s ease, height 0.18s ease;
}

/* Controls Column */
.wctb-cm-controls {
    display: flex;
    flex-direction: column;
    gap: 13px;
    width: 320px;
    flex-shrink: 0;
}

/* Style Indicator Badge */
.wctb-cm-style-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #f4ede2;
    color: #634b28;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: 1px solid #e7dcce;
    width: fit-content;
}

.wctb-cm-style-badge svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
    flex-shrink: 0;
}

.wctb-cm-clear-photo {
    background: none;
    border: none;
    color: #8c6d23;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    padding: 0 4px;
    margin-left: 2px;
    line-height: 1;
    border-radius: 50%;
    transition: color 0.15s;
}

.wctb-cm-clear-photo:hover {
    color: #ef4444;
}

/* More Style & Photo Row (Positioned ABOVE Size) */
.wctb-cm-btn-row {
    display: flex;
    gap: 8px;
}

.wctb-cm-style-btn,
.wctb-cm-upload-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: #ffffff;
    color: #2c251e;
    border: 1.5px solid #dcd3c5;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
}

.wctb-cm-style-btn:hover,
.wctb-cm-upload-btn:hover {
    background: #fbf7ef;
    border-color: #c5a55a;
    color: #8c6d23;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(197, 165, 90, 0.18);
}

.wctb-cm-style-btn:active,
.wctb-cm-upload-btn:active {
    transform: translateY(0);
}

.wctb-cm-style-btn svg,
.wctb-cm-upload-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* Format / Size Segmented Control */
.wctb-cm-ratio-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wctb-cm-ratio-group label {
    font-size: 11.5px;
    font-weight: 700;
    color: #594f47;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.wctb-cm-ratio-tabs {
    display: flex;
    background: #eee8de;
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
}

.wctb-cm-ratio-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 8px 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: #65584e;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: all 0.15s ease;
    text-align: center;
    white-space: nowrap;
}

.wctb-cm-ratio-btn:hover {
    color: #1a1613;
}

.wctb-cm-ratio-btn.active {
    background: #ffffff;
    color: #8c6d23;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* Sender Name Group */
.wctb-cm-sender-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wctb-cm-sender-group label {
    font-size: 11.5px;
    font-weight: 700;
    color: #594f47;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.wctb-cm-sender-group input {
    padding: 9px 13px;
    border: 1.5px solid #dfd8cc;
    border-radius: 9px;
    font-size: 14px;
    font-family: Georgia, 'Times New Roman', serif;
    color: #241d18;
    background: #fdfcfb;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.wctb-cm-sender-group input:focus {
    border-color: #c5a55a;
    box-shadow: 0 0 0 3px rgba(197, 165, 90, 0.18);
    background: #ffffff;
}

.wctb-cm-sender-group input::placeholder {
    color: #b5aba1;
    font-style: italic;
}

/* Download Button */
.wctb-cm-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #c5a55a 0%, #d4b86a 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: all 0.15s ease;
    box-shadow: 0 4px 14px rgba(197, 165, 90, 0.35);
    width: 100%;
    margin-top: 2px;
}

.wctb-cm-download-btn:hover {
    background: linear-gradient(135deg, #b8963f 0%, #c5a55a 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(197, 165, 90, 0.44);
}

.wctb-cm-download-btn:active {
    transform: translateY(0);
}

.wctb-cm-download-btn svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Body Scroll Lock ─────────────────────────────────────────────── */
body.wctb-cm-modal-open {
    overflow: hidden;
}

/* ── Mid-range Desktop / Laptops (769px - 940px) ──────────────────── */
@media (min-width: 769px) and (max-width: 940px) {
    .wctb-cm-modal {
        max-width: 820px;
    }

    .wctb-cm-body {
        gap: 22px;
        padding: 18px 22px;
    }

    .wctb-cm-preview-wrap {
        width: 400px;
        height: 400px;
    }

    .wctb-cm-preview-wrap canvas {
        max-width: 390px;
        max-height: 390px;
    }

    .wctb-cm-controls {
        width: 280px;
        gap: 11px;
    }
}

/* ── Tablets / Small Screens (641px - 768px) ─────────────────────── */
@media (min-width: 641px) and (max-width: 768px) {
    .wctb-cm-modal {
        max-width: 660px;
    }

    .wctb-cm-body {
        gap: 18px;
        padding: 16px 18px;
    }

    .wctb-cm-preview-wrap {
        width: 320px;
        height: 320px;
    }

    .wctb-cm-preview-wrap canvas {
        max-width: 310px;
        max-height: 310px;
    }

    .wctb-cm-controls {
        width: 250px;
        gap: 10px;
    }
}

/* ── Short Vertical Laptop Screens (height <= 660px) ──────────────── */
@media (min-width: 641px) and (max-height: 660px) {
    .wctb-cm-body {
        padding: 10px 20px;
        gap: 18px;
    }

    .wctb-cm-preview-wrap {
        width: 350px;
        height: 350px;
    }

    .wctb-cm-preview-wrap canvas {
        max-width: 340px;
        max-height: 340px;
    }

    .wctb-cm-controls {
        gap: 9px;
    }
}

/* ── Responsive Mobile: Big Preview & High Visibility (<= 640px) ───── */
@media (max-width: 640px) {
    .wctb-cm-overlay {
        padding: 6px;
    }

    .wctb-cm-modal {
        width: 98vw;
        max-width: 480px;
        max-height: 97vh;
        border-radius: 16px;
    }

    .wctb-cm-header {
        padding: 8px 14px;
    }

    .wctb-cm-header h2 {
        font-size: 15px;
    }

    .wctb-cm-close {
        font-size: 24px;
        padding: 1px 6px;
    }

    .wctb-cm-body {
        flex-direction: column;
        gap: 8px;
        padding: 8px 12px 12px;
        align-items: stretch;
    }

    /* Big image preview frame on mobile */
    .wctb-cm-preview-wrap {
        width: 100%;
        height: min(48vh, 360px);
        min-height: 220px;
        background: #f8f6f0;
        border-radius: 12px;
    }

    .wctb-cm-preview-wrap canvas {
        max-height: min(47vh, 350px);
        max-width: 98%;
        border-radius: 10px;
    }

    .wctb-cm-controls {
        width: 100%;
        gap: 6px;
    }

    .wctb-cm-style-badge {
        align-self: center;
        padding: 3px 10px;
        font-size: 11px;
    }

    .wctb-cm-btn-row {
        gap: 6px;
    }

    .wctb-cm-style-btn,
    .wctb-cm-upload-btn {
        padding: 7px 8px;
        font-size: 12px;
        border-radius: 8px;
    }

    .wctb-cm-ratio-group label,
    .wctb-cm-sender-group label {
        font-size: 10px;
    }

    .wctb-cm-ratio-tabs {
        padding: 2px;
    }

    .wctb-cm-ratio-btn {
        padding: 5px 2px;
        font-size: 11px;
    }

    .wctb-cm-sender-group input {
        padding: 6px 10px;
        font-size: 12.5px;
    }

    .wctb-cm-download-btn {
        padding: 9px 14px;
        font-size: 13.5px;
        border-radius: 8px;
        margin-top: 1px;
    }

    .wctb-cm-style-btn svg,
    .wctb-cm-upload-btn svg,
    .wctb-cm-download-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* ── Accessibility: Reduced Motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .wctb-cm-modal {
        animation: none;
    }

    .wctb-cm-style-btn:hover,
    .wctb-cm-upload-btn:hover,
    .wctb-cm-download-btn:hover,
    .wctb-cm-preview-wrap canvas {
        transition: none !important;
        transform: none !important;
    }
}
