/*
 * Product page: the Kixxl builder buttons, the upload modal and the design
 * library. Loaded by Kixxl_WC_Gang_Sheet_Button::add_custom_button_styles().
 */

.uppy-Dashboard-AddFiles-info { display:block !important; }
/* Some third-party product-page plugins hide the whole add-to-cart
   form inline. Our buttons live inside that form, so keep it
   visible whenever a Kixxl button was rendered into it. */
form.cart:has(#kixxl-custom-button, #kixxl-upload-button, #kixxl-upload-by-size-button) {
    display: block !important;
}
#kixxl-custom-button, #kixxl-upload-button, #kixxl-upload-by-size-button {
    margin-right: 10px;
    display: none;
    width: 300px;
    background-color: #008558; /* Green background */
    color: white; /* White text */
    border: none; /* No border */
    padding: 15px 32px; /* Padding for button size */
    text-align: center; /* Center text */
    text-decoration: none; /* No underline */
    font-size: 16px; /* Font size */
    cursor: pointer; /* Pointer cursor on hover */
    border-radius: 5px; /* Rounded corners */
    margin-bottom: 10px;
    box-sizing: border-box; /* Ensure padding is included in width */
}
#kixxl-custom-button:hover, #kixxl-upload-button:hover, #kixxl-upload-by-size-button:hover {
    background-color: #006946; /* Darker green on hover */
}
.kixxl-confirmation-content,
.kixxl-confirmation-content * {
    margin: 0;
    line-height: 1.5;
}
.kixxl-confirmation-content p,
.kixxl-confirmation-content h1,
.kixxl-confirmation-content h2,
.kixxl-confirmation-content h3,
.kixxl-confirmation-content h4,
.kixxl-confirmation-content h5,
.kixxl-confirmation-content h6 {
    padding: 0;
}
.kixxl-confirmation-content ul,
.kixxl-confirmation-content ol {
    padding-left: 20px;
}
.kixxl-confirmation-content ul ul,
.kixxl-confirmation-content ul ol,
.kixxl-confirmation-content ol ul,
.kixxl-confirmation-content ol ol {
    padding-left: 16px;
}

/* Design library: an alternative to uploading, offered under Uppy's browse line. */
.kixxl-library-trigger-row {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    width: 100%;
}
.kixxl-library-link {
    font-family: Inter, arial;
    font-size: 14px;
    font-weight: 600;
    color: #2C6ECB;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}
.kixxl-library-link:hover {
    color: #1F4F94;
}
/* Sits above the upload modal, which is itself at z-index 999. */
.kixxl-library-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
/* Themes seldom set border-box globally, and the panel is sized in percentages. */
.kixxl-library-modal,
.kixxl-library-modal *,
.kixxl-library-modal *::before,
.kixxl-library-modal *::after {
    box-sizing: border-box;
}
.kixxl-library-panel {
    font-family: Inter, arial;
    width: 100%;
    max-width: 780px;
    height: 100%;
    max-height: 640px;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.kixxl-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    margin-bottom: 16px;
}
.kixxl-library-title {
    font-family: Inter, arial;
    font-weight: 700;
    font-size: 18px;
    color: #1A1D2E;
}
.kixxl-library-close {
    font-size: 22px;
    line-height: 1;
    color: #5E7C99;
    cursor: pointer;
}
.kixxl-library-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    margin-bottom: 16px;
}
.kixxl-library-search,
.kixxl-library-category-trigger {
    height: 42px;
    padding: 0 14px;
    border: solid thin #DCE1EB;
    border-radius: 8px;
    background: #F7F8FA;
    color: #354557;
    font-family: inherit;
    font-size: 14px;
}
/* min-width:0 lets the fields shrink instead of pushing the row past the panel. */
.kixxl-library-search {
    flex: 1 1 220px;
    min-width: 0;
}
/* Only the positioning context for the menu now; the box styles moved
   to the trigger so the closed control still looks like the field. */
.kixxl-library-category {
    position: relative;
    flex: 0 1 200px;
    min-width: 0;
}
/* Themes style bare buttons heavily; reset the parts that would stop
   the closed control reading as the field it replaces. */
.kixxl-library-category-trigger {
    margin: 0;
    line-height: 1;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
/* The label truncates rather than widening the control; the full name
   is on the title attribute. */
.kixxl-library-category-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kixxl-library-category-chevron {
    flex: 0 0 auto;
}
.kixxl-library-category-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
}
/* left/right pin the menu to the trigger, so a long category name can
   never push it wider than the field or outside the panel. */
.kixxl-library-category-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 2;
    max-height: 260px;
    overflow-y: auto;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: white;
    border: solid thin #DCE1EB;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
.kixxl-library-category-option {
    padding: 9px 10px;
    border-radius: 6px;
    font-size: 14px;
    color: #354557;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kixxl-library-category-option:hover {
    background: #F0F2F5;
}
.kixxl-library-category-option.selected {
    background: #EAF1FB;
    color: #2C6ECB;
    font-weight: 600;
}
.kixxl-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    align-content: start;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Without min-height:0 the grid grows past the panel rather than scrolling inside it. */
    flex: 1 1 auto;
    min-height: 0;
    padding-right: 4px;
}
@media screen and (max-width: 480px) {
    .kixxl-library-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
.kixxl-library-card {
    display: flex;
    flex-direction: column;
    border: solid thin #DCE1EB;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.kixxl-library-card:hover {
    border-color: #2C6ECB;
    box-shadow: 0 2px 8px rgba(44, 110, 203, 0.15);
}
/* A fixed box keeps every card the same height whatever the artwork's ratio. */
.kixxl-library-thumb {
    height: 120px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* The checkerboard shows through transparent artwork, as the admin gallery does. */
    background: repeating-conic-gradient(#F0F0F0 0% 25%, white 0% 50%) 50% / 16px 16px;
    border-radius: 4px;
    margin-bottom: 8px;
}
/* object-fit keeps the aspect ratio even under themes that force a size onto every img. */
.kixxl-library-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.kixxl-library-name {
    font-size: 12px;
    font-weight: 600;
    color: #1A1D2E;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kixxl-library-size {
    font-size: 11px;
    color: #5E7C99;
    margin-top: 2px;
}
/* The picked artwork in the preview, sized to sit where the
   file-type glyph sits for a manual upload. */
.kixxl-preview-thumb {
    width: 160px;
    height: 160px;
}
/* Artwork column of the quantity-only preview. `flex: 0 0 46%` rather
   than a grow value: allowed to grow it swallows the details column. */
.kixxl-preview-thumb-box {
    flex: 0 0 46%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 1px solid #DCE1EB;
    border-radius: 10px;
}
.kixxl-preview-thumb-box .kixxl-preview-thumb {
    width: 100%;
    height: 200px;
    margin-bottom: 0;
}
@media screen and (max-width: 560px) {
    /* Stack the artwork above the details rather than squeezing both. */
    .kixxl-preview-thumb-box {
        flex-basis: auto;
        width: 100%;
    }
}
.kixxl-preview-file {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.kixxl-preview-file-label {
    font-size: 13px;
    color: #5E7C99;
    margin-bottom: 4px;
}
/* Library filenames are long and unspaced, so wrap mid-word rather
   than letting one push the column wider than the modal. */
.kixxl-preview-file-name {
    font-size: 15px;
    font-weight: 700;
    color: #1A1D2E;
    overflow-wrap: anywhere;
}
/* Quantity stepper, shown only when the size fields are hidden and the
   right column would otherwise hold a single spin box. */
.kixxl-quantity-counter {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border: 1px solid #DCE1EB;
    border-radius: 8px;
    background: white;
    overflow: hidden;
}
.kixxl-quantity-step {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #354557;
    font-family: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.kixxl-quantity-step:hover:not(:disabled) {
    background: #F0F2F5;
}
.kixxl-quantity-step:disabled {
    color: #B6BFCC;
    cursor: default;
}
/* Themes commonly style number inputs; reset to a plain centred field
   with only the dividers showing, and drop the native spinners that
   the buttons replace. */
.kixxl-quantity-input {
    width: 56px;
    height: 38px;
    flex: 0 0 56px;
    min-width: 0;
    border: none;
    border-left: 1px solid #DCE1EB;
    border-right: 1px solid #DCE1EB;
    border-radius: 0;
    outline: none;
    box-shadow: none;
    background: transparent;
    text-align: center;
    font-family: inherit;
    font-size: 14px;
    color: #354557;
    padding: 0;
    margin: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}
.kixxl-quantity-input::-webkit-outer-spin-button,
.kixxl-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
.kixxl-library-empty,
.kixxl-library-loading {
    grid-column: 1 / -1;
    flex: 0 0 auto;
    text-align: center;
    padding: 24px 0;
    color: #5E7C99;
    font-size: 14px;
}
/* Upload modal loading indicator. */
.kixxl-loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    margin: 10px 0;
    border: 3px solid #DCE1EB;
    border-top-color: #2C6ECB;
    border-radius: 50%;
    animation: kixxl-spin 0.8s linear infinite;
}
@keyframes kixxl-spin {
    to { transform: rotate(360deg); }
}
