@import url('https://rsms.me/inter/inter.css');
:root {
    --tblr-font-sans-serif: 'Inter Var', -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
}

.font-sans-serif {
    font-family: var(--tblr-font-sans-serif)!important;
}

body {
    font-feature-settings: "cv03", "cv04", "cv11";
}

/* Input Saving Overlay Styles */
.input-saving-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: inputOverlayFadeIn 0.2s ease-out;
    transform: scale(1.02);
}

.input-saving-overlay.fade-out {
    animation: inputOverlayFadeOut 0.3s ease-out forwards;
}

@keyframes inputOverlayFadeIn {
    from { 
        opacity: 0; 
        transform: scale(1);
    }
    to { 
        opacity: 1; 
        transform: scale(1.02);
    }
}

@keyframes inputOverlayFadeOut {
    from { 
        opacity: 1; 
        transform: scale(1.02);
    }
    to { 
        opacity: 0; 
        transform: scale(1);
    }
}

.input-saving-overlay .spinner-border {
    width: 1.2rem;
    height: 1.2rem;
    border-width: 0.2em;
}

.input-saving-overlay .ti {
    font-size: 1.2rem;
    animation: inputIconFadeIn 0.2s ease-out;
}

@keyframes inputIconFadeIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

.input-saving-overlay .ti-check {
    color: #28a745;
}

.input-saving-overlay .ti-x {
    color: #dc3545;
}

/* Block interactions on all inputs while any save is in progress */
.is-saving input,
.is-saving select,
.is-saving textarea,
.is-saving .ts-wrapper {
    pointer-events: none;
    opacity: 0.7;
}

.min-w-300 {
    min-width: 300px!important;
}

.max-w-1300 {
    max-width: 1300px!important;
}

.h-fit {
    height: fit-content;
}

.w-fit {
    width: fit-content;
}

.bg-none {
    background: none;
}

.box-shadow-none {
    box-shadow: none;
}

.progress-bar {
    transition: width 2s cubic-bezier(0, 0, 0.09, 1.07);
}

.btn-danger:focus {
    box-shadow: 0 0 0 0.2rem rgba(220,53,69,.5)!important;
}

.text-gray-800-fg {
    color: #E9E9E9!important;
}

.text-gray-700-fg {
    color: #CCCCCC!important;
}

.text-gray-600-fg {
    color: #AAAAAA!important;
}

.hover-bg-grey:hover {
    background: #f5f5f5!important;
}

.square-card {
    width: 100%;
    padding: 0;
    padding-top: 100%;
    position: relative;
}

.square-card i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.table-responsive {
    overflow: visible;
}

/* Fade In Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Fade Out Animation */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Bounce In Animation */
@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Bounce Out Animation */
@keyframes bounceOut {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.9); opacity: 0.8; }
    70% { transform: scale(1.05); opacity: 0.5; }
    100% { transform: scale(0.3); opacity: 0; }
}

/* Flexible Pulse Animation - works with any button color */
@keyframes pulseSubtle {
    0%, 100% { 
        box-shadow: 0 0 0 0 var(--btn-pulse-color, rgba(47, 179, 68, 0.4));
    }
    50% { 
        box-shadow: 0 0 0 4px var(--btn-pulse-color, rgba(47, 179, 68, 0));
    }
}

.animate-pulse-subtle {
    animation: pulseSubtle 1.5s ease-in-out infinite;
}

/* Button color variables for pulse animation - Outline buttons */
.btn-outline-success.animate-pulse-subtle {
    --btn-pulse-color: rgba(47, 179, 68, 0.4);
}

.btn-outline-primary.animate-pulse-subtle {
    --btn-pulse-color: rgba(32, 107, 196, 0.4);
}

.btn-outline-danger.animate-pulse-subtle {
    --btn-pulse-color: rgba(220, 53, 69, 0.4);
}

.btn-outline-warning.animate-pulse-subtle {
    --btn-pulse-color: rgba(255, 193, 7, 0.4);
}

.btn-outline-info.animate-pulse-subtle {
    --btn-pulse-color: rgba(23, 162, 184, 0.4);
}

.btn-outline-secondary.animate-pulse-subtle {
    --btn-pulse-color: rgba(108, 117, 125, 0.4);
}

/* Button color variables for pulse animation - Filled buttons */
.btn-success.animate-pulse-subtle {
    --btn-pulse-color: rgba(47, 179, 68, 0.4);
}

.btn-primary.animate-pulse-subtle {
    --btn-pulse-color: rgba(32, 107, 196, 0.4);
}

.btn-danger.animate-pulse-subtle {
    --btn-pulse-color: rgba(220, 53, 69, 0.4);
}

.btn-warning.animate-pulse-subtle {
    --btn-pulse-color: rgba(255, 193, 7, 0.4);
}

.btn-info.animate-pulse-subtle {
    --btn-pulse-color: rgba(23, 162, 184, 0.4);
}

.btn-secondary.animate-pulse-subtle {
    --btn-pulse-color: rgba(108, 117, 125, 0.4);
}

.animate-fade-in {
    animation: fadeIn 0.5s forwards;
}

.animate-fade-out {
    animation: fadeOut 0.5s forwards;
}

.animate-bounce-in {
    animation: bounceIn 0.5s forwards;
}

.animate-bounce-out {
    animation: bounceOut 0.5s forwards;
}

.fslightbox-container {
    font-family: inherit !important;
    background: rgba(94, 94, 94, 0.24) !important;
    -webkit-backdrop-filter: blur(10px)!important;
    backdrop-filter: blur(10px) !important;
}

/* TomSelect Create Option Styling */
.create-option {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border: 2px dashed #28a745 !important;
    border-radius: 6px !important;
    padding: 10px 15px !important;
    margin: 4px 0 !important;
    color: #495057 !important;
    font-style: normal !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    overflow: hidden !important;
}

.create-option::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(40, 167, 69, 0.1), transparent);
    transition: left 0.5s ease;
}

.create-option:hover::before {
    left: 100%;
}

.create-option:hover {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%) !important;
    border-color: #155724 !important;
    border-style: solid !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3) !important;
}

.create-option strong {
    color: #28a745 !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

.create-option:hover strong {
    color: #155724 !important;
}

.create-option:active {
    transform: translateY(0) scale(0.98) !important;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.2) !important;
}

/* Enhanced visual feedback */
.ts-dropdown .create-option {
    animation: slideInFromTop 0.3s ease-out;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header-tabs .nav-link {
    min-height: 40px;
}

/* Timeline Edit Button - Inline icon, hidden by default */
.timeline-edit-btn {
    opacity: 0;
    cursor: pointer;
    margin-left: 0.35rem;
    font-size: 0.75rem;
    color: var(--tblr-secondary);
    transition: opacity 0.15s ease-in-out, color 0.15s ease-in-out;
}

.timeline-event-editable:hover .timeline-edit-btn {
    opacity: 1;
}

.timeline-edit-btn:hover {
    color: var(--tblr-primary);
}

/* Timeline action buttons (save/cancel) */
.timeline-action-btn {
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    color: var(--tblr-secondary);
    transition: color 0.15s ease-in-out;
}

.timeline-action-save:hover {
    color: var(--tblr-success);
}

.timeline-action-cancel:hover {
    color: var(--tblr-danger);
}

/* Timeline note edit form styling */
.timeline-note-edit textarea {
    font-size: 0.8125rem;
    resize: vertical;
    min-height: 2.5rem;
}

.keyboard-hint {
    margin-top: 0.35rem;
    font-size: 0.6875rem;
    color: var(--tblr-secondary);
    opacity: 0.7;
}

.keyboard-hint kbd {
    font-size: 0.625rem;
    padding: 0.1rem 0.3rem;
    background: var(--tblr-bg-surface-secondary);
    border: 1px solid var(--tblr-border-color);
    border-radius: 0.2rem;
    font-family: inherit;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

.keyboard-hint span {
    margin-left: 0.25rem;
}

/* Timeline note button (add/edit) */
.timeline-note-btn {
    opacity: 0;
    cursor: pointer;
    margin-left: 0.5rem;
    margin-right: 0.15rem;
    font-size: 0.75rem;
    color: var(--tblr-secondary);
    text-underline-offset: 2px;
    transition: opacity 0.15s ease-in-out, color 0.15s ease-in-out;
}

.timeline-event-editable:hover .timeline-note-btn:not(.d-none) {
    opacity: 1;
}

.timeline-note-btn:hover {
    color: var(--tblr-primary);
}

/* Transport company TomSelect: single line, no wrap, ellipsis */
.transport-company-select + .ts-wrapper {
    width: 100%;
}

.transport-company-select + .ts-wrapper .ts-control {
    white-space: nowrap;
    overflow: hidden;
    flex-wrap: nowrap !important;
    height: auto;
    min-height: 0;
}

.transport-company-select + .ts-wrapper .ts-control > .item {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

.transport-company-select + .ts-wrapper .ts-control input {
    position: absolute !important;
    width: 0 !important;
    min-width: 0 !important;
    opacity: 0 !important;
}

/* Unit Select TomSelect: keep control small but dropdown wide enough for full names */
.unit-select-ts + .ts-wrapper {
    min-width: 65px !important;
    max-width: 65px !important;
}

.unit-select-ts + .ts-wrapper .ts-control {
    padding-right: 18px !important;
    text-align: center;
}

.unit-select-ts + .ts-wrapper .ts-dropdown {
    width: auto !important;
    min-width: 160px !important;
    max-width: 250px !important;
}

.unit-select-ts + .ts-wrapper .ts-dropdown .option {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

/* Row saving overlay effect */
.row-saving {
    position: relative;
    pointer-events: none;
}

.row-saving::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 5;
    animation: rowOverlayFadeIn 0.15s ease-out;
}

@keyframes rowOverlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Product external link button - Hidden by default, shows on hover */
.product-link-btn {
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.15s ease-in-out, color 0.15s ease-in-out;
}

tr:hover .product-link-btn, .list-group-item:hover .product-link-btn {
    opacity: 1;
}

/* Product Image Upload Dropzone */
.dropzone-placeholder {
    transition: all 0.2s ease-in-out;
    border: 2px dashed var(--tblr-border-color);
}

.dropzone-placeholder:hover {
    background-color: var(--tblr-bg-surface-secondary) !important;
    border-color: var(--tblr-primary) !important;
    color: var(--tblr-primary) !important;
}

.dropzone-placeholder i {
    transition: transform 0.2s ease-in-out;
}

.dropzone-placeholder:hover i {
    transform: scale(1.1);
    color: var(--tblr-primary) !important;
}

.border-dashed {
    border-style: dashed !important;
}