/* ============================================================
   Custom Size Popup — Styles
   ============================================================ */

body.csp-open {
    overflow: hidden;
}

/* Overlay */
#custom-size-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

#custom-size-popup.active {
    display: flex;
}

/* Modal box */
.csp-modal {
    width: 1100px;
    max-width: 95vw;
    background: #fff;
    border-radius: 16px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    display: flex;
    flex-direction: column;
}

/* Close button */
.csp-close {
    position: absolute;
    right: 18px;
    top: 14px;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    background: none;
    border: none;
    color: #555;
    z-index: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background .2s;
}
.csp-close:hover { background: #f0f0f0; color: #111; }

/* Content grid */
.csp-content {
    display: grid;
    grid-template-columns: 260px 1fr 200px;
    gap: 24px;
    padding: 28px;
    flex: 1;
}

/* Product column */
.csp-product img {
    width: 100%;
    border-radius: 12px;
    display: block;
}
.csp-product h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 12px 0 0;
    color: #111;
    line-height: 1.4;
}

/* Section heading */
.csp-section {
    margin-bottom: 24px;
}
.csp-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 14px;
    color: #111;
}

/* Field grid */
.csp-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

/* Floating-label field */
.csp-field {
    position: relative;
}
.csp-field input[type="number"],
.csp-field input[type="text"] {
    width: 100%;
    height: 52px;
    border: 1px solid #d0d0d0;
    border-radius: 10px;
    padding: 20px 14px 6px;
    font-size: 14px;
    color: #111;
    background: #fff;
    outline: none;
    transition: border-color .2s;
    box-sizing: border-box;
    -moz-appearance: textfield;
}
.csp-field input::-webkit-outer-spin-button,
.csp-field input::-webkit-inner-spin-button { -webkit-appearance: none; }
.csp-field input:focus { border-color: #111; }

.csp-field label {
    position: absolute;
    top: 16px;
    left: 14px;
    font-size: 13px;
    color: #888;
    pointer-events: none;
    transition: top .2s, font-size .2s, color .2s;
}
.csp-field input:focus + label,
.csp-field input:not(:placeholder-shown) + label {
    top: 6px;
    font-size: 10px;
    color: #555;
}

.csp-req { color: #e00; margin-left: 2px; }

/* Colors column */
.csp-colors h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 14px;
    color: #111;
}
.csp-color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.csp-color {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}
.csp-color input[type="radio"] { display: none; }
.csp-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    display: block;
    transition: outline .15s, border-color .15s;
}
.csp-color input:checked + .csp-swatch {
    outline: 3px solid #111;
    outline-offset: 2px;
    border-color: transparent;
}
.csp-color small {
    font-size: 11px;
    color: #555;
    text-align: center;
}

/* Footer */
.csp-footer {
    border-top: 1px solid #eee;
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

.csp-error-msg {
    flex: 1;
    color: #c00;
    font-size: 13px;
}

.csp-cancel {
    background: #f0f0f0;
    border: none;
    padding: 11px 24px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    color: #333;
    transition: background .2s;
}
.csp-cancel:hover { background: #e0e0e0; }

#csp-save-size {
    background: #111;
    color: #fff;
    border: none;
    padding: 11px 28px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s, opacity .2s;
}
#csp-save-size:hover { background: #333; }
#csp-save-size:disabled { opacity: .6; cursor: not-allowed; }

/* Responsive */
@media ( max-width: 991px ) {
    .csp-content {
        grid-template-columns: 1fr;
    }
    .csp-product img {
        max-width: 200px;
    }
}

@media ( max-width: 480px ) {
    .csp-grid {
        grid-template-columns: 1fr;
    }
    .csp-footer {
        flex-wrap: wrap;
    }
    #csp-save-size, .csp-cancel {
        width: 100%;
        text-align: center;
    }
}
