:root {
    --primary-light: #caebfa;
    --danger-light: #ffc6c6;
    --success-light: #daffdc;
    --warning-light: #ffeacfff;
}

.badge i {
    font-size: .8rem;
    /* margin-right: .5rem; */
}

.head-title {
    display: grid;
    gap: .5rem;
    /* padding-bottom: 1rem; */
    text-align: center;
}

.head-title:has(.head-actions) {
    display: grid;
    align-items: center;
}

.head-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

@media (min-width: 605px) {
    .head-title{
        text-align: start;
    }
    .head-title:has(.head-actions) {
        display: grid;
        grid-template-columns: 1fr max-content;
    }

    .head-actions {
        display: flex;
        align-items: center;
        gap: .5rem;
    }
}

.head-actions h1 {
    text-align: center;
}

.pointer {
    cursor: pointer;
}

/* comentado por temas de overflow */
td.nowrap {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

div.form-control {
    display: flex;
    padding: 0 0;
}

div.form-control input {
    flex: 1;
    padding: .375rem .75rem;
    background-color: inherit;
    color: inherit;
    border: none;
    border-radius: inherit;
}

.form-control-badge.danger {
    background-color: var(--danger-light);
    color: var(--danger);
    font-weight: bold;
    border-radius: 4px;
    align-self: center;
    margin: .375rem .5rem;
    margin-right: 0;
    padding: .2rem .3rem;
}

/* Custom Button Spinner using custom-loader */
.btn[data-custom-spinner="true"],
*[data-custom-spinner="true"] {
    color: transparent !important;
    position: relative;
    pointer-events: none;
}

*[data-custom-spinner="true"]::after {
    content: "";
    position: absolute;
    width: 35px;
    aspect-ratio: 1;
    top: 50%;
    left: 50%;
    margin-top: -17.5px;
    margin-left: -17.5px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    animation:
        l20-1 0.8s infinite linear alternate,
        l20-2 1.6s infinite linear;
}

.btn[data-custom-spinner="true"]::after {
    width: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border-width: 3px;
}

/* Summary Stats Card */
.summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #555;
    gap: .5rem;
}

.summary-stats>div,
.summary-stat {
    box-shadow: 0 0px 2px rgba(0, 0, 0, 0.2);
    background-color: var(--bgCardColor);
    grid-column: span 2;
    border-radius: .5rem;
    padding: .3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

.summary-stats>div>span:first-child,
.summary-stat>span:first-child {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--primary);
}

/* Tippy Options Menu */
.rack-options-menu {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    padding: 0;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--text);
    font-size: 0.9rem;
}

.option-item:hover {
    text-decoration: none;
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

/* Rack Grid System */
.rack-grid-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.rack-grid {
    display: grid;
    gap: 0.5rem;
    /* min-width: 600px; */
    /* Ensure readability */
    margin: 0 auto;
    justify-content: center;
}

.rack-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-weight: bold;
    color: #555;
    position: relative;
    transition: all 0.2s;
    max-width: 100px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.rack-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.rack-cell.has-products {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.rack-cell .badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    /* var(--danger) might not be defined in correct scope */
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Modal */
.custom-modal-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text);
    font-size: 1.2rem;
}

.custom-modal-subtitle {
    font-size: 1rem;
    color: var(--text-secundary);
}

/* HTML: <div class="custom-loader"></div> */
.custom-loader {
    width: 35px;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 4px solid var(--primary);
    animation:
        l20-1 0.8s infinite linear alternate,
        l20-2 1.6s infinite linear;
}

@keyframes l20-1 {
    0% {
        clip-path: polygon(50% 50%, 0 0, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%)
    }

    12.5% {
        clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0%)
    }

    25% {
        clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 100%, 100% 100%, 100% 100%)
    }

    50% {
        clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100%)
    }

    62.5% {
        clip-path: polygon(50% 50%, 100% 0, 100% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100%)
    }

    75% {
        clip-path: polygon(50% 50%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 50% 100%, 0% 100%)
    }

    100% {
        clip-path: polygon(50% 50%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 0% 100%)
    }
}

@keyframes l20-2 {
    0% {
        transform: scaleY(1) rotate(0deg)
    }

    49.99% {
        transform: scaleY(1) rotate(135deg)
    }

    50% {
        transform: scaleY(-1) rotate(0deg)
    }

    100% {
        transform: scaleY(-1) rotate(-135deg)
    }
}

/* Spinner Colors based on button class (using custom-loader) */
.btn-primary[data-custom-spinner="true"]::after,
.btn-secondary[data-custom-spinner="true"]::after,
.btn-success[data-custom-spinner="true"]::after,
.btn-danger[data-custom-spinner="true"]::after,
.btn-info[data-custom-spinner="true"]::after,
.btn-dark[data-custom-spinner="true"]::after {
    border-color: #fff;
    border-top-color: transparent;
}

.btn-light[data-custom-spinner="true"]::after,
.btn-warning[data-custom-spinner="true"]::after {
    border-color: #343a40;
    border-top-color: transparent;
}

.btn-outline-primary[data-custom-spinner="true"]::after {
    border-color: var(--primary);
    border-top-color: transparent;
}

.btn-outline-danger[data-custom-spinner="true"]::after {
    border-color: var(--danger);
    border-top-color: transparent;
}

.btn {
    border-radius: .5rem;
    font-weight: 600;
    letter-spacing: .2px;
    transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease, border-color .12s ease, color .12s ease;
}

.btn:focus,
.btn.focus {
    box-shadow: 0 0 0 .2rem rgba(29, 143, 196, 0.25) !important;
}

.btn:not(:disabled):not(.disabled):active {
    transform: translateY(1px);
}

.btn-primary {
    border-color: var(--primary) !important;
    background-color: var(--primary) !important;
    box-shadow: 0 10px 20px -12px rgba(29, 143, 196, 0.65);
}

.btn-primary:hover,
.btn-primary:focus {
    filter: brightness(0.95);
    box-shadow: 0 14px 26px -14px rgba(29, 143, 196, 0.75);
}

.btn:hover i {
    color: #fff !important;
}

.btn-danger {
    border-color: var(--danger) !important;
    background-color: var(--danger) !important;
    box-shadow: 0 10px 20px -12px rgba(239, 62, 85, 0.55);
}

.btn-danger:hover,
.btn-danger:focus {
    filter: brightness(0.95);
    box-shadow: 0 14px 26px -14px rgba(239, 62, 85, 0.7);
}

.btn-success {
    box-shadow: 0 10px 20px -12px rgba(32, 160, 104, 0.55);
}

.btn-success:hover,
.btn-success:focus {
    filter: brightness(0.95);
    box-shadow: 0 14px 26px -14px rgba(32, 160, 104, 0.7);
}

.btn-warning {
    box-shadow: 0 10px 20px -12px rgba(251, 173, 76, 0.55);
}

.btn-warning:hover,
.btn-warning:focus {
    filter: brightness(0.98);
    box-shadow: 0 14px 26px -14px rgba(251, 173, 76, 0.7);
}

.btn-info {
    box-shadow: 0 10px 20px -12px rgba(35, 204, 239, 0.55);
}

.btn-info:hover,
.btn-info:focus {
    filter: brightness(0.96);
    box-shadow: 0 14px 26px -14px rgba(35, 204, 239, 0.7);
}

.btn-dark {
    box-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.55);
}

.btn-dark:hover,
.btn-dark:focus {
    filter: brightness(1.05);
    box-shadow: 0 14px 26px -14px rgba(0, 0, 0, 0.7);
}

.btn-light {
    box-shadow: 0 10px 20px -12px rgba(255, 255, 255, 0.35);
}

.btn-light:hover,
.btn-light:focus {
    filter: brightness(0.98);
}

.btn-outline-primary,
.btn-outline-danger,
.btn-outline-success,
.btn-outline-warning,
.btn-outline-info,
.btn-outline-dark {
    border-width: 2px;
    border-radius: .5rem;
    font-weight: 600;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 14px 26px -14px rgba(29, 143, 196, 0.75);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
    background-color: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #fff !important;
    box-shadow: 0 14px 26px -14px rgba(239, 62, 85, 0.7);
}

.btn:disabled,
.btn.disabled {
    transform: none;
    box-shadow: none !important;
}

.form-control {
    border-radius: .5rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background-color: rgba(255, 255, 255, 0.75);
    color: var(--text);
    transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease, color .12s ease;
}

.form-control::placeholder {
    color: rgba(0, 0, 0, 0.45);
}

.form-control:hover {
    border-color: rgba(0, 0, 0, 0.18);
}

.form-control:focus {
    border-color: var(--primary);
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--text);
    box-shadow: none !important;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: rgba(255, 255, 255, 0.55) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    opacity: .65 !important;
    cursor: not-allowed !important;
}

textarea.form-control {
    min-height: 42px;
}

select.form-control {
    cursor: pointer;
}

/* No afectar selectize (usa su propio input interno) */
.selectize-input,
.selectize-input input {
    box-shadow: none !important;
}

/* Scrollbar moderno y delgado - aplicar a cualquier contenedor scrolleable */
.scroll-thin {
    scrollbar-width: thin;
    scrollbar-color: var(--bgColorThird) transparent;
}

.scroll-thin::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.scroll-thin::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-thin::-webkit-scrollbar-thumb {
    background-color: var(--bgColorThird);
    border-radius: 10px;
}

.scroll-thin::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secundary);
}

/* Order Code Tag Component */
.code-tag {
    display: inline-flex;
    align-items: center;
    background-color: var(--bgCardColor);
    border: 1px solid var(--bgColorThird);
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.72rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: 24px;
}

.code-tag:hover {
    transform: translateY(-1px);
    border-color: var(--primary-alpha);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.code-tag__id {
    padding: 0 10px;
    color: var(--text);
    font-weight: 700;
    background-color: rgba(0, 0, 0, 0.02);
    height: 100%;
    display: flex;
    align-items: center;
}

.code-tag__origin {
    padding: 0 10px;
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.6rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.3px;
    background-color: var(--primary);
}

.code-tag__origin i {
    font-size: .7rem;
}

.code-tag__origin.is-web {
    background-color: var(--primary);
}

.code-tag__origin.is-venta {
    background-color: var(--primary);
}