/* ==========================================================================
   WTD Modal Styles - Flower Swatches Edition
   ========================================================================== */

/* Inherit theme font throughout */
.wtd-modal,
.wtd-modal * {
    font-family: inherit;
    box-sizing: border-box;
}

.wtd-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wtd-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.wtd-modal-container {
    position: relative;
    width: 94vw;
    max-width: 1300px;
    max-height: 94vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: wtdSlideUp 0.3s ease-out;
}

@keyframes wtdSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.wtd-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #FF6B9D, #FF9AAE);
    flex-shrink: 0;
}

.wtd-modal-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}

.wtd-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}

.wtd-modal-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Body - 2 column: preview (larger) + options */
.wtd-modal-body {
    display: grid;
    grid-template-columns: 3fr 2fr;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Preview Column - fills full left side */
.wtd-preview-column {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: #f7f7f7;
    border-right: 1px solid #eee;
    overflow: hidden;
}

.wtd-side-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    background: #eee;
    border-radius: 8px;
    padding: 3px;
    flex-shrink: 0;
    align-self: center;
}

.wtd-side-tab {
    padding: 7px 18px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: #666;
    transition: all 0.2s;
    font-family: inherit;
}

.wtd-side-tab.active {
    background: #fff;
    color: #FF6B9D;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.wtd-side-tab:hover:not(.active) {
    color: #333;
}

.wtd-canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}



#wtd-preview-canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background: #fff;
    touch-action: none;
    display: block;
}

.wtd-drag-hint {
    text-align: center;
    font-size: 11px;
    color: #aaa;
    margin: 6px 0 0;
    font-style: italic;
    flex-shrink: 0;
}

/* Options Column */
.wtd-options-column {
    padding: 16px 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Option Groups - visual grouping */
.wtd-option-group {
    margin-bottom: 16px;
    padding: 14px;
    background: #fafafa;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
}

.wtd-option-group:last-of-type {
    margin-bottom: 12px;
}

.wtd-group-header {
    margin-bottom: 10px;
}

.wtd-group-title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sections */
.wtd-section {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eee;
}

.wtd-section:last-child,
.wtd-section-inline:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.wtd-section h3 {
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wtd-section-inline {
    margin-bottom: 12px;
    padding-bottom: 12px;
}

.wtd-inline-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

/* Size Options */
.wtd-size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wtd-size-option {
    cursor: pointer;
}

.wtd-size-option input {
    display: none;
}

.wtd-size-option .wtd-size-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    background: #fff;
}

.wtd-size-option .wtd-size-price {
    font-size: 12px;
    color: #888;
    margin-left: 4px;
}

.wtd-size-option input:checked + .wtd-size-label {
    border-color: #FF6B9D;
    background: #fff0f5;
    color: #FF6B9D;
}

.wtd-size-option input:checked + .wtd-size-label + .wtd-size-price {
    color: #FF6B9D;
}

/* Color Swatches (material color - circle) */
.wtd-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wtd-color-swatch {
    cursor: pointer;
    text-align: center;
}

.wtd-color-swatch input {
    display: none;
}

.wtd-swatch {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wtd-color-swatch input:checked + .wtd-swatch {
    border-color: #333;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.wtd-swatch-name {
    display: block;
    font-size: 10px;
    color: #888;
    margin-top: 4px;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   FLOWER-SHAPED IMAGE SWATCHES (Thread Color & Icon Color)
   ========================================================================== */

.wtd-flower-swatches {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.wtd-flower-swatch {
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: filter 0.25s ease, transform 0.25s ease;
    /* Base subtle depth via drop-shadow (works through clip-path) */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.wtd-flower-swatch:hover {
    transform: scale(1.07);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.wtd-flower-swatch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* 5-petal scalloped flower using CSS radial gradient masks */
.wtd-flower-shape {
    display: block;
    width: 72px;
    height: 72px;
    --g: /37.02% 37.02% radial-gradient(#000 calc(71% - 1px),#0000 71%) no-repeat;
    mask: 100% 50% var(--g),65.451% 97.553% var(--g),9.549% 79.389% var(--g),9.549% 20.611% var(--g),65.451% 2.447% var(--g),radial-gradient(100% 100%,#000 25.476%,#0000 calc(25.476% + 1px));
    -webkit-mask: 100% 50% var(--g),65.451% 97.553% var(--g),9.549% 79.389% var(--g),9.549% 20.611% var(--g),65.451% 2.447% var(--g),radial-gradient(100% 100%,#000 25.476%,#0000 calc(25.476% + 1px));
    overflow: hidden;
    position: relative;
    transition: all 0.25s ease;
    box-shadow: none; /* shadow on outer wrapper instead */
}


.wtd-flower-shape img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wtd-flower-fallback {
    display: block;
    width: 100%;
    height: 100%;
}

/* Selected state — use filter:drop-shadow on wrapper (box-shadow is clipped by clip-path) */
.wtd-flower-swatch input:checked ~ .wtd-flower-shape {
    transform: scale(1.1);
    filter: brightness(1.06);
}

/* Selected glow on the wrapper (survives clip-path) */
.wtd-flower-swatch input:checked + .wtd-flower-shape,
.wtd-flower-swatch:has(input:checked) {
    filter: drop-shadow(0 0 6px rgba(255, 107, 157, 0.7)) drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.wtd-flower-swatch input:checked ~ .wtd-flower-name {
    color: #FF6B9D;
    font-weight: 700;
}

.wtd-flower-name {
    display: block;
    font-size: 10px;
    color: #666;
    margin-top: 5px;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s;
    line-height: 1.3;
}

/* Shared Color Palette Group */
.wtd-color-palette-group {
    background: #fef9fb;
    border-color: #fce4ec;
}

.wtd-color-hint {
    font-size: 11px;
    color: #999;
    font-style: italic;
    margin: 0 0 10px 0;
    padding: 6px 10px;
    background: #f0f0f0;
    border-radius: 6px;
    text-align: center;
    transition: all 0.2s;
}

/* Text Input */
.wtd-input-group {
    position: relative;
}

.wtd-input-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.wtd-input-group input[type="text"]:focus {
    border-color: #FF6B9D;
}

.wtd-char-count {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #aaa;
}

/* Font Options */
.wtd-font-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
}

.wtd-font-option {
    cursor: pointer;
}

.wtd-font-option input {
    display: none;
}

.wtd-font-preview {
    display: block;
    padding: 7px 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.wtd-font-option input:checked + .wtd-font-preview {
    border-color: #FF6B9D;
    background: #fff0f5;
}

.wtd-font-option:hover .wtd-font-preview {
    border-color: #ccc;
}

/* Price Display */
.wtd-section-price {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.wtd-price-display {
    background: linear-gradient(135deg, #fff0f5, #fce4ec);
    padding: 14px 18px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wtd-price-label {
    font-size: 15px;
    font-weight: 600;
    color: #555;
}

.wtd-price-value {
    font-size: 20px;
    font-weight: 700;
    color: #FF6B9D;
}

/* Footer */
.wtd-modal-footer {
    display: flex;
    gap: 12px;
    padding: 14px 24px;
    border-top: 1px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
}

.wtd-btn {
    flex: 1;
    padding: 13px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.wtd-btn-cancel {
    background: #f0f0f0;
    color: #666;
}

.wtd-btn-cancel:hover {
    background: #e0e0e0;
}

.wtd-btn-submit {
    background: linear-gradient(135deg, #FF6B9D, #FF9AAE);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
}

.wtd-btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.4);
}

.wtd-btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Toast notification */
.wtd-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: #fff;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: wtdToastIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wtd-toast a {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}

.wtd-toast.wtd-toast-error {
    background: #f44336;
}

@keyframes wtdToastIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Cart swatch */
.wtd-cart-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    vertical-align: middle;
    border: 1px solid #ddd;
}

/* Icon Picker */
.wtd-icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wtd-icon-pick {
    width: 52px;
    height: 52px;
    padding: 5px;
    border: 2px solid #eee;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wtd-icon-pick:hover {
    border-color: #FF6B9D;
    transform: scale(1.08);
}

.wtd-icon-pick:active {
    transform: scale(0.95);
}

.wtd-icon-pick img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.wtd-remove-selected-icon {
    margin-top: 10px;
    padding: 6px 14px;
    border: 1px solid #f44336;
    border-radius: 6px;
    background: #fff;
    color: #f44336;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.wtd-remove-selected-icon:hover {
    background: #f44336;
    color: #fff;
}

/* Icon Color Section Subtitle */
.wtd-section-subtitle {
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Delete Selected Element Button */
.wtd-delete-selected {
    margin-top: 8px;
    padding: 7px 18px;
    border: 1px solid #f44336;
    border-radius: 8px;
    background: #fff;
    color: #f44336;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.wtd-delete-selected:hover {
    background: #f44336;
    color: #fff;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Large tablet (1024-1279px) */
@media (max-width: 1279px) {
    .wtd-modal-body {
        grid-template-columns: 1fr 1fr;
    }

    .wtd-flower-shape {
        width: 60px;
        height: 60px;
    }
}

/* Tablet (768-1023px) */
@media (max-width: 1023px) {
    .wtd-modal-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .wtd-preview-column {
        border-right: none;
        border-bottom: 1px solid #eee;
        padding: 12px;
        max-height: 42vh;
        min-height: 250px;
    }

    .wtd-options-column {
        padding: 14px 16px;
    }

    .wtd-flower-swatches {
        grid-template-columns: repeat(4, 1fr);
    }

    .wtd-flower-shape {
        width: 62px;
        height: 62px;
    }

    .wtd-option-group {
        padding: 12px;
    }
}

/* Mobile (max-width: 767px) */
@media (max-width: 767px) {
    .wtd-modal-container {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .wtd-modal-header {
        padding: 10px 14px;
    }

    .wtd-modal-header h2 {
        font-size: 15px;
    }

    .wtd-modal-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .wtd-preview-column {
        padding: 8px;
        max-height: 50vh;
        min-height: 200px;
    }

    .wtd-options-column {
        padding: 10px 12px;
    }

    .wtd-option-group {
        padding: 10px;
        margin-bottom: 10px;
    }

    .wtd-flower-swatches {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .wtd-flower-shape {
        width: 56px;
        height: 56px;
    }

    .wtd-flower-name {
        font-size: 9px;
        max-width: 60px;
    }

    .wtd-font-options {
        max-height: 140px;
    }

    .wtd-font-preview {
        padding: 6px 10px;
        font-size: 13px;
    }

    .wtd-modal-footer {
        padding: 10px 14px;
    }

    .wtd-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .wtd-price-value {
        font-size: 18px;
    }

    .wtd-icon-pick {
        width: 46px;
        height: 46px;
    }

    .wtd-size-option .wtd-size-label {
        padding: 6px 12px;
        font-size: 13px;
    }

    .wtd-input-group input[type="text"] {
        padding: 10px 14px;
        font-size: 16px;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    .wtd-flower-swatches {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .wtd-flower-shape {
        width: 48px;
        height: 48px;
    }

    .wtd-flower-name {
        font-size: 8px;
        max-width: 52px;
    }
}

/* Trash Zone Overlay */
.wtd-trash-zone {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(255, 60, 60, 0.9);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}

.wtd-trash-zone.wtd-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.wtd-trash-zone.wtd-hover {
    transform: translateX(-50%) translateY(0) scale(1.2);
    background: rgba(255, 20, 20, 1);
    box-shadow: 0 6px 20px rgba(255, 0, 0, 0.5);
}

.wtd-trash-zone svg {
    width: 28px;
    height: 28px;
}
