﻿/******************************************************************************************************
                                            MAIN PAGE CSS
******************************************************************************************************/
/* Prevent layout shift when validation summary is hidden */
#validationSummary {
    min-height: 1.5em;
}

/* Form control spacing */
.form-control {
    margin: 0 0 5px 0 !important;
}

.odd {
    margin: 0 !important;
    padding: 0 !important;
}

/* ------------------- DataTables tweaks ------------------- */
#searchResult tbody {
    display: none;
}

table.dataTable th, table.dataTable td {
    padding: 4px;
    border-bottom: 1px solid rgba(0,0,0,0.3);
    font-family: 'Arial, sans-serif' !important;
    font-size: 80%;
    font-weight: 400;
}

.table th, .table td {
    padding: 4px 8px;
}

div.dataTables_wrapper div.dataTables_info {
    padding-top: 0;
}

/* Links styled as images */
a.tableImg, a, .label a, .tooltip .tooltip-inner {
    text-decoration: none !important;
    border-bottom: none;
    background: none !important;
}

.tableImg.hidden {
    display: none !important;
}

/* ------------------- Floating/Compact Cart ------------------- */
#cartPanel {
    display: none;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-5px);
}

    #cartPanel.active {
        display: flex;
        visibility: visible;
        position: fixed;
        top: 20px;
        right: 20px;
        width: 320px;
        z-index: 1050;
        background: #fff;
        border-radius: 4px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.15);
        flex-direction: column;
        overflow: hidden;
        transition: opacity 0.25s ease, transform 0.25s ease;
        opacity: 1;
        transform: translateY(0);
    }

    /* ===== Cart Header ===== */
    #cartPanel .card-header {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 6px;
        padding: 0 6px 2px 6px;
    }

        #cartPanel .card-header > .d-flex {
            width: 100%;
        }

    /* Input + Button Row */
    #cartPanel .flex-grow-1 {
        flex: 1 1 auto;
        min-width: 0;
    }

#cartUserName {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
}

#btnEmailCart {
    flex: 0 0 auto;
    margin-left: 6px;
    flex-shrink: 0;
}

/* Generic button normalization */
.cart-btn {
    flex: 0 0 auto;
    min-width: 70px;
    max-width: 85px;
    height: 38px;
    white-space: normal !important;
    text-align: center;
    line-height: 1.2;
    padding: 0.3rem 0.4rem;
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Toggle Height Button (special sizing) */
#cartToggleHeight {
    min-width: unset !important;
    max-width: unset !important;
    height: auto !important;
    padding: 0.25rem 0.4rem !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
}

/* Cart Body */
#cartPanel .card-body {
    overflow-y: auto;
    flex-grow: 1;
}

#cartPanel.cart-minimized {
    height: auto;
    overflow: hidden;
}

#cartPanel.cart-half {
    height: 50vh;
}

#cartPanel.cart-full {
    height: 90vh;
}

/* Cart Item List */
#cartItems {
    padding: 0;
    margin: 0;
    list-style: none;
}

.cart-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1px 2px;
    margin: 0;
    line-height: 1.1;
    font-size: 0.85rem;
}

.cart-item-text {
    flex-grow: 1;
    margin: 0;
    padding: 0;
    line-height: 1.1;
    white-space: nowrap;
}

.foil-price {
    background: #fff3cd;
    color: #856404;
    padding: 0 3px;
    border-radius: 3px;
    font-size: 0.8rem;
}

.cart-list-item .remove-btn {
    padding: 0 4px;
    font-size: 0.85rem;
    margin-left: 4px;
}

/* Footer */
#cartPanelFooter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 4px;
    font-size: 0.85rem;
    border-top: 1px solid #ccc;
    margin-top: 2px;
    line-height: 1.1;
}

/* ================== Custom Button Styles ================== */

/* Outlined red button (custom variant) */
.btn-cart-outline-danger {
    background-color: transparent;
    color: #dc3545; /* Bootstrap's red */
    border: 1px solid #dc3545;
    transition: all 0.2s ease-in-out;
}

    .btn-cart-outline-danger:hover {
        background-color: #dc3545;
        color: white;
    }

    /* Optional: smaller font and padding to match your cart button sizing */
    .btn-cart-outline-danger.btn-sm {
        padding: 0.3rem 0.4rem;
        font-size: 0.82rem;
        line-height: 1.2;
    }

/* Optional variant for other colors if needed */
.btn-cart-outline-primary {
    background-color: transparent;
    color: #0d6efd;
    border: 1px solid #0d6efd;
}

    .btn-cart-outline-primary:hover {
        background-color: #0d6efd;
        color: white;
    }

/* ------------------- Dropdowns ------------------- */
.readonly-select {
    border: none !important;
    background: transparent !important;
    color: inherit;
    pointer-events: none;
    font-weight: normal;
    padding-left: 0;
    appearance: none;
}

.colorYellow, .highlight-select {
    background-color: yellow !important;
}

/* Price Filter Button */
#btnTogglePriceFilter.btn-secondary:not(.btn-highlight) {
    background: white !important;
    color: black !important;
    border: 1px solid black !important;
    box-shadow: none !important;
    outline: none !important;
}

#btnTogglePriceFilter.btn-secondary.btn-highlight {
    background: yellow !important;
    border-color: yellow !important;
    color: black !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ------------------- Generic Button Styles ------------------- */
.btn-multiline {
    display: flex;
    flex-direction: column;
    align-items: center;
}

    .btn-multiline span {
        display: block;
    }

.btn-highlight {
    background: gold !important;
    border-color: #d4af37 !important;
    color: black !important;
    box-shadow: 0 0 5px rgba(255,215,0,0.6);
}

/* ------------------- Gallery Page ------------------- */
:root {
    --gallery-img-width: 100px;
    --gallery-img-height: 140px;
}

@media (min-width:768px) {
    :root {
        --gallery-img-width: 150px;
        --gallery-img-height: 210px;
    }
}

@media (min-width:1200px) {
    :root {
        --gallery-img-width: 220px;
        --gallery-img-height: 308px;
    }
}

@media (max-width:768px) {
    :root {
        --gallery-img-width: 120px;
        --gallery-img-height: 168px;
    }

    .gallery-container.vertical {
        grid-template-columns: repeat(auto-fit,minmax(120px,1fr));
    }

    .gallery-container.horizontal {
        gap: 1px;
    }
}

/* Gallery Items */
.gallery-container.horizontal {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 2px;
    padding-bottom: 2px;
}

    .gallery-container.horizontal .gallery-item {
        flex: 0 0 auto;
        width: var(--gallery-img-width);
    }

        .gallery-container.horizontal .gallery-item img {
            width: 100%;
            height: var(--gallery-img-height);
            object-fit: contain;
        }

.gallery-container.vertical {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(auto-fit,minmax(var(--gallery-img-width),1fr));
    gap: 2px;
}

    .gallery-container.vertical .gallery-item {
        width: 100%;
    }

.gallery-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s ease-in-out;
    transform-origin: top center;
    width: var(--gallery-img-width);
    box-sizing: border-box;
    padding: 2px;
    margin: 0;
}

    .gallery-item img {
        width: 100%;
        aspect-ratio: 5/7;
        object-fit: cover;
        border-radius: 5px;
        max-width: var(--gallery-img-width);
        max-height: var(--gallery-img-height);
        -webkit-user-drag: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        pointer-events: auto;
        transform: none !important;
        transition: none !important;
    }

    .gallery-item p {
        margin: 2px 0;
        padding: 0;
        font-size: 0.9em;
        text-align: center;
        white-space: nowrap;
    }

    .gallery-item:hover {
        transform: none !important;
    }

    /* Gallery Buttons */
    .gallery-item .btn-group .btn {
        width: auto !important;
        min-width: 0 !important;
        padding: 0.25rem 0.5rem;
        white-space: nowrap;
        font-size: 0.85rem;
        line-height: 1.1;
    }

    .gallery-item .data-price {
        font-weight: 500;
    }

    /* Add To Cart initial state (filled green) */
    .gallery-item .btn-group .add-to-cart.initial {
        background: #198754;
        border-color: #198754;
        color: white;
    }

        .gallery-item .btn-group .add-to-cart.initial:hover {
            background: #157347;
            border-color: #157347;
        }
    /* Remove button outline */
    .gallery-item .btn-group .remove-from-cart {
        color: #dc3545;
        border-color: #dc3545;
    }

/* Foil cell highlight */
.foil-cell, table.dataTable tr.highlighted-row {
    background-color: #FFFFE0 !important;
}

/* Tooltip fade speed */
.tooltip.fade {
    transition: opacity 0.3s ease-in-out;
}

/* Custom scrollbar for gallery */
.gallery-container::-webkit-scrollbar {
    height: 8px;
}

.gallery-container::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 5px;
}

/* Manual price highlight */
.manual-price {
    font-weight: bold;
    color: yellow;
    background: red;
}