/* ============================================
   GLOBAL MODAL CLOSE BUTTON STYLING
============================================ */
.modal-header .btn-close {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0.8rem;
    opacity: 0.85;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ef4444'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header .btn-close:hover {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23b91c1c'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") !important;
    transform: scale(1.15);
}

.modal-header .btn-close:focus {
    box-shadow: none !important;
    outline: none !important;
}

.modal-header .btn-close:active {
    box-shadow: none !important;
    outline: none !important;
    transform: scale(0.9);
}

/* =========================================
    Add New Button
============================================ */
.btn-action-add-new {
    background: var(--accent-blue);
    color: white !important;
    padding: 10px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
}

.btn-action-add-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.3);
}


.btn-action-add-new-mobile {
    background-color: var(--accent-blue);
    color: white;
    border-radius: 50%;
    position: fixed;
    bottom: 90px;
    /* High enough to clear the bottom nav bar */
    right: 20px;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    z-index: 1050;
    /* Ensures it stays on top of lists/tables */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    /* Adds a nice drop shadow */
}

.btn-action-add-new-mobile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.3);
}

/* =========================================
    Modal Buttons
============================================ */

.btn-action-modal-save {
    background-color: var(--accent-blue);
    color: white !important;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
    cursor: pointer;
}

.btn-action-modal-save:hover {
    background-color: #152c6e;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.3);
}

.btn-action-modal-save:active {
    transform: translateY(0);
}

/* Optional: Secondary/Cancel button for modals */
.btn-action-modal-cancel {
    background-color: #f1f5f9;
    color: #64748b !important;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.btn-action-modal-cancel:hover {
    background-color: #e2e8f0;
    color: #475569 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* =========================================
    Back Button
============================================ */
.btn-back {
    background-color: #ffffff;
    color: #475569 !important;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    text-decoration: none;
    cursor: pointer;
}

.btn-back:hover {
    background-color: #f8fafc;
    color: #1e293b !important;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.btn-back i {
    color: #64748b;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}

.btn-back:hover i {
    color: var(--accent-blue, #3b82f6);
    transform: translateX(-4px);
}

/* =========================================
    FORM INPUTS
============================================ */
.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--main-text-color);
}

.form-input-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border-radius: 12px;
    margin-bottom: 24px;
}

.form-input, .form-select, .form-input-textarea {
    background-color: #ffffff;
    /* Darker border color to stand out from the light background */
    border: 1.5px solid #d1d5db !important; 
    /* Added subtle shadow to give the input depth */
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); 
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    appearance: none;
}

.form-input, .form-select {
    height: 48px;
}

.form-input-textarea {
    min-height: 48px;
    height: auto;
    resize: vertical;
}

/* Prevent iOS Safari from auto-zooming on focus in modals and forms */
@media screen and (max-width: 768px) {
    .form-input,
    .form-select,
    .form-input-textarea,
    .form-control,
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

select.form-select {
    padding-right: 36px; /* Space for the dropdown arrow */
}

.form-input:focus, .form-select:focus, .form-input-textarea:focus {
    /* border-color: var(--accent-blue) !important; */
    box-shadow: var(--form-input-hover-box-shadow);
    /* Soft glow on focus */
    outline: none;
}

/* Error State */
.form-input.border-danger {
    border-color: #dc3545 !important;
}

/* Location Picker Clear (×) Button */
.location-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: #dc3545;
    z-index: 10;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: none; /* Hidden by default; shown via JS */
}

/* Wrapper */
.file-input-wrapper {
    position: relative;
    width: 100%;
}

/* File Input (extend your system) */
.file-input {
    padding-right: 40px !important;
    border-radius: 12px !important;
}

.file-input:focus {
    /* border-color: var(--accent-blue) !important; */
    box-shadow: var(--form-input-hover-box-shadow);
    /* Soft glow on focus */
    outline: none;
}

.clear-file-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    
    font-size: 18px;
    color: #94a3b8; /* subtle gray */

    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

/* Hover effect (like search clear) */
.clear-file-icon:hover {
    color: #ef4444;
}

/* =========================================
    MEDIA QUERIES For Modal
============================================ */

@media (max-width: 767.98px) {
    /* 1. Push the modal to the top of the screen on mobile */
    .modal-dialog-centered {
        align-items: flex-start !important;
        margin-top: 15px !important;
    }
}


/* =========================================
    Edit Delete Square Buttons
============================================ */

/* Base style for the square icon button */
.btn-action-base {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f1f5f9;
    background: #ffffff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.85rem;
}

/* Edit / Primary Action */
.btn-action-edit {
    color: var(--accent-blue);
    background: #eff6ff;
    border-color: #dbeafe;
}

.btn-action-edit:hover {
    background: #dbeafe;
    border-color: #bfdbfe;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(30, 58, 138, 0.1);
}

/* Delete / Danger Action */
.btn-action-delete {
    color: #ef4444;
    background: #fff1f2;
    border-color: #ffe4e6;
}

.btn-action-delete:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.1);
}

/* View / Receipt Action */
.btn-action-receipt {
    color: #0d9488;
    background: #f0fdfa;
    border-color: #ccfbf1;
}

.btn-action-receipt:hover {
    background: #ccfbf1;
    border-color: #99f6e4;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 148, 136, 0.1);
}

/* View / Info Action */
.btn-action-view {
    color: var(--accent-blue);
    background: #eff6ff;
    border-color: #dbeafe;
}

.btn-action-view:hover {
    background: #dbeafe;
    border-color: #bfdbfe;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(30, 58, 138, 0.1);
}

/* Print / Secondary Action */
.btn-action-print {
    color: #475569;
    background: #f8fafc;
    border-color: #e2e8f0;
}

.btn-action-print:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(71, 85, 105, 0.1);
}

/* Shipping Label / Tag Action */
.btn-action-tag {
    color: #0284c7;
    background: #f0f9ff;
    border-color: #e0f2fe;
}

.btn-action-tag:hover {
    background: #e0f2fe;
    border-color: #bae6fd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(2, 132, 199, 0.15);
}

/* Copy Action */
.btn-action-copy {
    color: #6366f1;
    background: #e0e7ff;
    border-color: #c7d2fe;
}

.btn-action-copy:hover {
    background: #c7d2fe;
    border-color: #a5b4fc;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.1);
}



/* =========================================
    Search Input
============================================ */

.search-wrapper {
    position: relative;
    flex: 1;
    /* min-width: 250px; */
}

.icon-search {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--light-text-color);
}

.search-input {
    width: 100%;
    padding: 0.625rem 0.75rem 0.625rem 2.5rem;
    border: 1px solid var(--searh-input-border);
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    /* border-color: var(--accent-blue); */
    outline: none;
    box-shadow: var(--form-input-hover-box-shadow);
    /* Soft blue glow */
}


/* =========================================
    Filter Button
============================================ */

.btn-action-filter {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px; /* 0.5rem */
    padding: 0.75rem 0.85rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); /* shadow-sm */
    transition: all 0.2s ease;
}

.btn-action-filter:hover {
    box-shadow: var(--form-input-hover-box-shadow);
    /* Soft blue glow */

}

.btn-action-filter i {
    color: #64748b; /* text-muted */
}


/* =========================================
    Form Select (Dropdown)
============================================ */

.form-select-wrapper {
    position: relative;
}

.form-select {
    /* 1. Reset Default Browser Styles */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Hides the default ugly arrow */

    /* 2. Box Styling */
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 40px 10px 16px;
    /* Right padding creates space for the arrow */
    font-size: 0.875rem;
    font-family: inherit;
    color: #334155;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

/* Hover State */
.form-select:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

/* Focus State (When clicked) */
.form-select:focus {
    outline: none;
    background-color: #ffffff;
    /* Your blue color */
    box-shadow: var(--form-input-hover-box-shadow);

    /* Soft blue glow */

    /* Optional: Rotate arrow on focus using a different SVG (Only works in some browsers, simpler to just change border) */
}

/* Option styling (Limited support, but good for dark mode consistency) */
.form-select option {
    color: #334155;
    background: #ffffff;
    padding: 10px;
}

/* Arrow Rotation Animation */
.arrow-icon {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy rotation */
}

/* ============================================
    PAGINATION
=============================================== */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    font-size: 0.85rem;
    color: #64748b;
}

.pagination-group {
    display: flex;
    gap: 5px;
}

.page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: #eff6ff;
}

.page-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.page-btn:disabled {
    background: #f8fafc;
    color: #cbd5e1;
    cursor: not-allowed;
}


/* =========================================
   UNIVERSAL MODAL STYLING
   (Applies to every modal in the project)
============================================ */

/* 1. The Glass/Blur Backdrop */
.modal-backdrop.show {
    opacity: 0.3;
    /* Lighter dark overlay */
    backdrop-filter: blur(5px);
    /* The modern blur effect */
    -webkit-backdrop-filter: blur(5px);
}

/* 2. The Modal Card Itself */
.modal-content {
    /* background-color: #ffffff; */
    border: none;
    /* Remove default Bootstrap border */
    border-radius: 20px;
    /* Big rounded corners */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    /* Soft, deep shadow */
    overflow: hidden;
    /* Keeps content inside rounded corners */
}

/* 3. Header Styling */
.modal-header {
    border-bottom: none;
    /* Remove line */
    padding: 24px 24px 0 24px;
}

.modal-title {
    font-weight: 700;
    color: var(--main-text-color);
    font-size: 1.25rem;
}

/* 4. Body Styling */
.modal-body {
    padding: 24px;
    overflow-x: hidden;
}

/* 5. Footer Styling */
.modal-footer {
    border-top: none;
    /* Remove line */
    padding: 0 24px 24px 24px;
    gap: 10px;
    /* Space between buttons */
}


/* --- SEARCH BAR CLEAR BUTTON --- */
.admin-search-clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
    z-index: 10;
}

.admin-search-clear-btn:hover {
    color: #ef4444; /* Red on hover */
}

/* Make sure text doesn't slide under the X button */
.search-input {
    padding-right: 40px !important;
}

/* --- FULL TABLE OVERLAY SPINNER --- */
#grid-overlay-spinner {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.6); /* Soft white fade over the table */
    z-index: 15;
    border-radius: var(--table-radius, 8px);
    
    /* Center the spinner */
    align-items: center;
    justify-content: center;
}

/* Force flexbox when HTMX is loading */
#grid-overlay-spinner.htmx-request {
    display: flex !important; 
}

/* --- ORDER HISTORY SPINNER (customer details page) --- */
#oh-spinner {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    z-index: 15;
    border-radius: var(--table-radius, 8px);
    align-items: center;
    justify-content: center;
}
#oh-spinner.htmx-request {
    display: flex !important;
}

/* =========================================
    CUSTOM TOOLTIP COMPONENT
============================================ */

/* --- Custom Tooltip Component --- */
.has-custom-tooltip {
    position: relative !important;
}

.has-custom-tooltip .custom-tooltip {
    position: absolute;
    bottom: 100%; /* Show above the element */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    visibility: hidden;
    background: #1f2937; /* Dark Gray */
    color: #ffffff;
    text-align: center;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1050;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    letter-spacing: 0.3px;
    font-family: 'Inter', 'Poppins', sans-serif;
}

/* Tooltip Arrow */
.has-custom-tooltip .custom-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.has-custom-tooltip:hover .custom-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-10px);
}
/* Location Picker Typeahead Dropdown */
.pos-input-wrapper {
    position: relative;
}
.pos-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    margin-top: 4px;
    z-index: 9999;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 200px;
    overflow-y: auto;
    display: none;
}
.pos-dropdown-menu.show { display: block; }
.pos-dropdown-menu .pos-dropdown-item {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--main-text-color);
    transition: background 0.15s;
}
.pos-dropdown-menu .pos-dropdown-item:hover {
    background: #f1f5f9;
}
.pos-dropdown-menu .pos-dropdown-no-result {
    padding: 8px 14px;
    color: #94a3b8;
    font-size: 0.85rem;
    pointer-events: none;
}
