/**
 * SGK Custom to cart — Customization to cart
 *
 * @Module      SGK Custom to cart
 * @Description Lets customers add a product with its customizations directly into the cart, and edit saved customizations from the cart.
 * @Version     1.0.1
 * @Author      SwissGeek | Web Developer Freelance <https://swissgeek.dev/>
 * @Copyright   2010-2026 SwissGeek | Web Developer Freelance <https://swissgeek.dev/>
 * @Support     Support Requests <https://admin.swissgeek.dev/forms/ticket?styled=1&with_logo=1>
 * @Blog        Breaking News <https://news.swissgeek.dev/> <https://news.prestageek.ch/>
 * @Addons      Developments <https://prestageek.ch/> <https://add.swissgeek.dev/>
 * @License     Proprietary — Commercial license. International Registered Trademark
 *              & Property of SwissGeek. Valid for one (1) website or project per
 *              purchased license. Redistribution, resale or sublicensing is
 *              prohibited. Full terms: <https://swissgeek.dev/license/>
 */

/* ── Product page customization box ──────────────────────────────────────── */
.sgc-product-customization {
    margin: 2.5rem 0;
}

.sgc-product-customization .product-customization-item {
    margin: 1.25rem 0;
    list-style: none;
}

.sgc-product-customization ul {
    padding-left: 0;
    margin: 0;
}

.sgc-product-customization .product-message {
    width: 100%;
    min-height: 3.125rem;
    padding: 0.625rem;
    resize: vertical;
    background: #f6f6f6;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.sgc-product-customization .product-message:focus {
    background-color: #fff;
    outline: 2px solid #555;
}

.sgc-product-customization .customization-message {
    margin-top: 1.25rem;
    word-break: break-word;
}

.sgc-product-customization small {
    color: #7a7a7a;
}

.sgc-char-count {
    display: block;
    margin-top: 4px;
}

.sgc-product-customization img {
    max-width: 100%;
    height: auto;
}

/* ── File picker (product page & cart modal share .custom-file) ──────────── */
.custom-file {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 2.625rem;
    margin-top: 1.25rem;
    line-height: 2.625rem;
    color: #7a7a7a;
    text-indent: 0.625rem;
    background: #f6f6f6;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.custom-file .js-file-name {
    display: inline-block;
    max-width: calc(100% - 8rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.custom-file .sgc-choose-file {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
}

.custom-file input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: pointer;
    opacity: 0;
}

/* ── Loader overlay ──────────────────────────────────────────────────────── */
#sgc-loader {
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 1100;
    width: 100%;
    height: 100%;
    background: rgba(51, 51, 51, 0.5);
}

#sgc-loader .sgc-loader-text {
    margin-bottom: 10px;
    color: #ededed;
    font-weight: 600;
}

/* ── Inline validation feedback ──────────────────────────────────────────── */
.sgc-module-error,
.sgc-module-success {
    margin-top: 10px;
}

.sgc-module-error ul,
.sgc-module-success ul {
    margin: 0;
    padding-left: 1.1rem;
}

.sgc-error-border {
    border: 2px solid rgba(255, 0, 27, 0.75) !important;
}

/* ── Cart edit modal (self-controlled, no Bootstrap JS dependency) ───────── */
.sgc-cust-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1090;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 16px;
    overflow-y: auto;
}

.sgc-cust-modal.is-open {
    display: flex;
}

.sgc-cust-modal__overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 30, 0.55);
}

.sgc-cust-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 640px;
    margin: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 18px 60px -12px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.sgc-cust-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #ececec;
}

.sgc-cust-modal__title {
    margin: 0;
    font-size: 1.1rem;
}

.sgc-cust-modal__close {
    border: 0;
    background: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: #555;
    padding: 0 4px;
}

.sgc-cust-modal__close:hover {
    color: #000;
}

.sgc-cust-modal__body {
    padding: 18px 20px;
    max-height: 64vh;
    overflow-y: auto;
}

.sgc-cust-modal__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 20px;
    border-top: 1px solid #ececec;
    background: #fafafa;
}

.sgc-cust-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f1f1;
}

.sgc-cust-line:last-child {
    border-bottom: 0;
}

.sgc-cust-line__label {
    flex: 0 0 28%;
    max-width: 28%;
    font-weight: 600;
    word-break: break-word;
}

.sgc-cust-line__value {
    flex: 1 1 60%;
    min-width: 0;
    word-break: break-word;
}

.sgc-cust-image {
    max-width: 120px;
    height: auto;
    border-radius: 4px;
}

.sgc-cust-text {
    width: 100%;
    min-height: 3rem;
    padding: 0.5rem;
    resize: vertical;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.sgc-allowed-char,
.sgc-allowed-images {
    display: block;
    margin-top: 4px;
    color: #7a7a7a;
    font-size: 0.85em;
}

.sgc-edit-actions {
    display: inline-flex;
    gap: 10px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 575px) {
    .sgc-cust-line__label,
    .sgc-cust-line__value {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .sgc-cust-modal__footer {
        justify-content: stretch;
    }

    .sgc-cust-modal__footer .btn,
    .sgc-edit-actions {
        flex: 1 1 100%;
    }

    .sgc-edit-actions .btn {
        flex: 1 1 auto;
    }

    .custom-file .js-file-name {
        max-width: calc(100% - 7rem);
    }
}
