/**
 * Al Barr Modern UI Suite - Dialogs & Custom Select System
 * Provides rich, responsive, accessible custom window dialogs
 * and universal select components for storefront & admin panel.
 */

/* ============================================================
   1. CUSTOM WINDOW DIALOGS (Alert, Confirm, Prompt)
   ============================================================ */

.albar-dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 35, 20, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.albar-dialog-backdrop.albar-dialog-active {
    opacity: 1;
    pointer-events: auto;
}

.albar-dialog-card {
    background: #ffffff;
    border-radius: 24px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(10, 53, 33, 0.25), 0 0 0 1px rgba(1, 136, 73, 0.08);
    padding: 28px 24px 22px 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    transform: scale(0.92) translateY(12px);
    transition: transform 0.24s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.albar-dialog-backdrop.albar-dialog-active .albar-dialog-card {
    transform: scale(1) translateY(0);
}

/* Icon Badge */
.albar-dialog-icon-wrapper {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

/* Types */
.albar-dialog-type-info .albar-dialog-icon-wrapper {
    background: #e0f2fe;
    color: #0284c7;
}

.albar-dialog-type-success .albar-dialog-icon-wrapper {
    background: #dcfce7;
    color: #018849;
}

.albar-dialog-type-warning .albar-dialog-icon-wrapper {
    background: #fef3c7;
    color: #d97706;
}

.albar-dialog-type-danger .albar-dialog-icon-wrapper {
    background: #fee2e2;
    color: #ef4444;
}

.albar-dialog-type-prompt .albar-dialog-icon-wrapper {
    background: #f3e8ff;
    color: #9333ea;
}

.albar-dialog-title {
    font-family: var(--font-secondary, "Outfit", sans-serif);
    font-size: 1.25rem;
    font-weight: 800;
    color: #0a3521;
    margin: 0 0 8px 0;
    line-height: 1.25;
}

.albar-dialog-message {
    font-family: var(--font-primary, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    font-size: 0.92rem;
    color: #475569;
    line-height: 1.5;
    margin: 0 0 20px 0;
    word-break: break-word;
    white-space: pre-line;
    max-height: 40vh;
    overflow-y: auto;
}

/* Prompt Input Field */
.albar-dialog-prompt-wrap {
    width: 100%;
    margin-bottom: 20px;
}

.albar-dialog-prompt-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1.5px solid #cbd5e1;
    font-size: 0.95rem;
    font-family: inherit;
    color: #0f172a;
    background: #f8fafc;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.albar-dialog-prompt-input:focus {
    border-color: #018849;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(1, 136, 73, 0.12);
}

/* Action Buttons */
.albar-dialog-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.albar-dialog-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 14px;
    font-family: var(--font-secondary, "Outfit", sans-serif);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.albar-dialog-btn:active {
    transform: scale(0.97);
}

.albar-dialog-btn-primary {
    background: #018849;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(1, 136, 73, 0.25);
}

.albar-dialog-btn-primary:hover {
    background: #00733d;
    box-shadow: 0 6px 18px rgba(1, 136, 73, 0.35);
}

.albar-dialog-btn-danger {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}

.albar-dialog-btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

.albar-dialog-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.albar-dialog-btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Close X button */
.albar-dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f8fafc;
    border: none;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.15s, color 0.15s;
}

.albar-dialog-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}


/* ============================================================
   2. UNIVERSAL CUSTOM SELECT COMPONENT
   ============================================================ */

/* Native select is hidden visually while staying focusable for forms */
select.albar-native-select-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.albar-custom-select {
    position: relative;
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font-primary, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    text-align: left;
    user-select: none;
    vertical-align: middle;
}

/* Inherit width or display if wrapper was flex/inline */
.albar-custom-select.inline-mode {
    width: auto;
    min-width: 140px;
}

/* Body scroll lock during active mobile bottom sheet */
body.albar-select-body-locked {
    overflow: hidden !important;
    touch-action: none;
}

/* Backdrop for Mobile Bottom Sheet Mode */
.albar-select-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 100004;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s cubic-bezier(0.32, 0.72, 0, 1);
}

.albar-select-backdrop.albar-backdrop-active {
    opacity: 1;
    pointer-events: auto;
}

/* Trigger Box */
.albar-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 9px 14px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    color: #0f172a;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, transform 0.12s ease;
    outline: none;
    text-align: left;
}

.albar-custom-select.inline-mode .albar-select-trigger {
    min-height: 38px;
    padding: 7px 13px;
    font-size: 0.84rem;
    border-radius: 10px;
}

.albar-select-trigger:hover {
    border-color: #cbd5e1;
    background: #fbfcfd;
}

.albar-select-trigger:active {
    transform: scale(0.99);
}

.albar-custom-select.albar-select-open .albar-select-trigger,
.albar-select-trigger:focus-visible {
    border-color: #018849;
    box-shadow: 0 0 0 3.5px rgba(1, 136, 73, 0.16);
    background: #ffffff;
}

.albar-select-trigger-content {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.albar-select-trigger-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0f172a;
    font-weight: 600;
    font-size: 0.88rem;
}

.albar-custom-select.inline-mode .albar-select-trigger-label {
    font-size: 0.84rem;
}

.albar-select-trigger.is-placeholder .albar-select-trigger-label {
    color: #94a3b8;
    font-weight: 500;
}

.albar-select-trigger-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    background: #eef7f2;
    color: #018849;
    flex-shrink: 0;
}

/* Chevron arrow */
.albar-select-chevron {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    color: #64748b;
    transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1), color 0.2s ease;
}

.albar-custom-select.albar-select-open .albar-select-chevron {
    transform: rotate(180deg);
    color: #018849;
}

/* Dropdown Menu (Desktop & Tablet: Viewport-Aware Floating Position) */
.albar-select-dropdown {
    position: fixed;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 12px;
    box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.16), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
    z-index: 1000000;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px) scale(0.99);
    transform-origin: top center;
    transition: opacity 0.15s cubic-bezier(0.16, 1, 0.3, 1), transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.15s ease;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    pointer-events: none;
}

.albar-select-dropdown.albar-dropdown-open,
.albar-custom-select.albar-select-open .albar-select-dropdown {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto !important;
}

/* Upwards opening when near bottom */
.albar-select-dropdown.albar-dropdown-dropup,
.albar-custom-select.albar-select-dropup .albar-select-dropdown {
    transform-origin: bottom center;
    transform: translateY(4px) scale(0.99);
}

.albar-select-dropdown.albar-dropdown-dropup.albar-dropdown-open,
.albar-custom-select.albar-select-dropup.albar-select-open .albar-select-dropdown {
    transform: translateY(0) scale(1) !important;
}

/* Mobile Bottom Sheet Header (Visible only in mobile mode) */
.albar-select-sheet-header {
    display: none;
    padding: 10px 16px 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
    position: relative;
    touch-action: none;
    user-select: none;
}

.albar-select-drag-handle {
    width: 38px;
    height: 4.5px;
    border-radius: 999px;
    background: #cbd5e1;
    margin: 0 auto 10px auto;
    cursor: grab;
}

.albar-select-sheet-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.albar-select-sheet-title {
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.01em;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.albar-select-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    padding: 0;
    flex-shrink: 0;
}

.albar-select-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.albar-select-close-btn:active {
    transform: scale(0.92);
}

/* Quick Search Box */
.albar-select-search-wrap {
    padding: 9px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    flex-shrink: 0;
}

.albar-select-search-icon {
    flex-shrink: 0;
    color: #64748b;
}

.albar-select-search-input {
    width: 100%;
    padding: 7px 28px 7px 10px;
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    font-size: 0.84rem;
    font-family: inherit;
    background: #ffffff;
    color: #0f172a;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.albar-select-search-input:focus {
    border-color: #018849;
    box-shadow: 0 0 0 2.5px rgba(1, 136, 73, 0.15);
}

.albar-select-search-clear {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.albar-select-search-clear:hover {
    background: #cbd5e1;
    color: #0f172a;
}

.albar-select-search-count {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
    white-space: nowrap;
}

/* Options Container */
.albar-select-options-list {
    max-height: 290px;
    overflow-y: auto;
    padding: 6px;
    margin: 0;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.albar-select-options-list::-webkit-scrollbar {
    width: 6px;
}

.albar-select-options-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.albar-select-options-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Optgroup Header */
.albar-select-group-header {
    padding: 9px 12px 5px 12px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    background: #ffffff;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
}

.albar-select-group-header:first-child {
    border-top: none;
    margin-top: 0;
}

/* Individual Option (App-like Item Row) */
.albar-select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.86rem;
    color: #334155;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease, transform 0.1s ease;
    user-select: none;
    box-sizing: border-box;
}

.albar-select-option:hover,
.albar-select-option.albar-option-highlighted {
    background: #f0fdf4;
    color: #018849;
}

.albar-select-option:active {
    transform: scale(0.985);
    background: #e6f7ee;
}

.albar-select-option.albar-option-selected {
    background: #e6f7ee;
    color: #018849;
    font-weight: 700;
}

.albar-select-option.albar-option-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    background: transparent !important;
    color: #94a3b8 !important;
}

.albar-select-option-label {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
    min-width: 0;
}

.albar-select-option-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Search match mark highlight */
mark.albar-select-highlight {
    background: #fef08a;
    color: #854d0e;
    font-weight: 700;
    padding: 0 2px;
    border-radius: 3px;
}

.albar-select-option-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.74rem;
    color: #64748b;
    font-weight: 600;
    margin-left: auto;
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.albar-select-option.albar-option-selected .albar-select-option-meta {
    background: #d1fae5;
    color: #065f46;
}

/* App-Style Selection Indicator (Radio / Check Pill) */
.albar-select-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.18s cubic-bezier(0.32, 0.72, 0, 1);
    background: transparent;
    box-sizing: border-box;
}

.albar-select-option.albar-option-selected .albar-select-indicator {
    background: #018849;
    border-color: #018849;
    box-shadow: 0 2px 6px rgba(1, 136, 73, 0.28);
}

.albar-select-check-icon {
    width: 12px;
    height: 12px;
    color: #ffffff;
    stroke-width: 3.2;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.albar-select-option.albar-option-selected .albar-select-check-icon {
    opacity: 1;
    transform: scale(1);
}

.albar-select-no-results {
    padding: 22px 14px;
    text-align: center;
    font-size: 0.84rem;
    color: #64748b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.albar-select-no-results-icon {
    width: 28px;
    height: 28px;
    color: #cbd5e1;
    margin-bottom: 2px;
}

/* Thumbnail in option & trigger */
.albar-select-option-thumb,
.albar-select-trigger-thumb {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    object-fit: cover;
    background: #f1f5f9;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
}

/* Invalid / Validation failed state */
.albar-custom-select.albar-select-invalid .albar-select-trigger {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
    animation: albar-select-shake 0.3s ease;
}

@keyframes albar-select-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Disabled state */
.albar-custom-select.albar-select-disabled .albar-select-trigger {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

/* ============================================================
   RESPONSIVE DESIGN & MOBILE BOTTOM SHEET MODE
   ============================================================ */
@media (max-width: 640px) {
    .albar-dialog-card {
        padding: 24px 18px 18px 18px;
        border-radius: 20px;
    }

    .albar-dialog-title {
        font-size: 1.15rem;
    }

    .albar-dialog-message {
        font-size: 0.88rem;
    }

    .albar-dialog-btn {
        padding: 11px 16px;
        font-size: 0.88rem;
    }

    /* Mobile Trigger Box: Generous 44px touch height */
    .albar-select-trigger {
        min-height: 44px;
        padding: 9px 13px;
        font-size: 0.88rem;
    }

    .albar-custom-select.inline-mode .albar-select-trigger {
        min-height: 40px;
        padding: 8px 12px;
        font-size: 0.86rem;
    }

    /* Transform Dropdown into an App-Style Native Mobile Bottom Sheet */
    .albar-select-dropdown {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        border-radius: 24px 24px 0 0 !important;
        max-height: 84vh !important;
        box-shadow: 0 -16px 48px rgba(15, 23, 42, 0.28) !important;
        transform: translateY(100%) !important;
        transform-origin: bottom center !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
        border-top: 1px solid rgba(226, 232, 240, 0.9) !important;
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease !important;
        z-index: 1000000 !important;
        touch-action: pan-y;
    }

    .albar-select-dropdown.albar-dropdown-open,
    .albar-custom-select.albar-select-open .albar-select-dropdown {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }

    .albar-select-dropdown.albar-dropdown-dropup,
    .albar-custom-select.albar-select-dropup .albar-select-dropdown {
        bottom: 0 !important;
        top: auto !important;
        transform: translateY(100%) !important;
    }

    .albar-select-dropdown.albar-dropdown-dropup.albar-dropdown-open,
    .albar-custom-select.albar-select-dropup.albar-select-open .albar-select-dropdown {
        transform: translateY(0) !important;
    }

    .albar-select-sheet-header {
        display: block !important;
    }

    /* Mobile Options: 50px touch-friendly targets */
    .albar-select-options-list {
        max-height: 60vh;
        padding: 6px 12px max(24px, env(safe-area-inset-bottom, 24px)) 12px;
    }

    .albar-select-option {
        padding: 13px 14px;
        font-size: 0.94rem;
        border-radius: 12px;
        min-height: 50px;
        box-sizing: border-box;
        margin-bottom: 4px;
        border: 1px solid transparent;
    }

    .albar-select-option.albar-option-selected {
        border-color: rgba(1, 136, 73, 0.15);
    }

    .albar-select-option-thumb {
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }

    .albar-select-search-wrap {
        padding: 11px 14px;
    }

    .albar-select-search-input {
        padding: 9px 30px 9px 12px;
        font-size: 0.92rem;
    }
}

/* ============================================================
   3. AL BARR CUSTOM CHECKBOX COMPONENT SYSTEM
   Modern, tactile, accessible, responsive & high-performance
   ============================================================ */

.albar-checkbox-root {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    line-height: 1;
    user-select: none;
    box-sizing: border-box;
    cursor: pointer;
}

/* Native input: Stays in DOM, perfectly layered for 100% native validation, form submit & events */
.albar-checkbox-native {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    z-index: 2 !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

/* Custom Visual Checkbox Box */
.albar-checkbox-box {
    position: relative;
    z-index: 1;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.8px solid #cbd5e1;
    background-color: #ffffff;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: 
        background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Tactile Active Press */
.albar-checkbox-root:active .albar-checkbox-box,
.albar-checkbox-native:not(:disabled):active + .albar-checkbox-box {
    transform: scale(0.91);
}

/* Hover State */
.albar-checkbox-root:hover .albar-checkbox-box,
.albar-checkbox-native:not(:disabled):hover + .albar-checkbox-box {
    border-color: #018849;
    background-color: #f0fdf4;
    box-shadow: 0 0 0 3px rgba(1, 136, 73, 0.12);
}

/* Checked State */
.albar-checkbox-native:checked + .albar-checkbox-box,
.albar-checkbox-root[data-state="checked"] .albar-checkbox-box {
    background: linear-gradient(135deg, #019952 0%, #01783f 100%);
    border-color: #01783f;
    box-shadow: 0 2px 6px rgba(1, 136, 73, 0.28), 0 0 0 1px rgba(1, 136, 73, 0.15);
}

/* Indeterminate State */
.albar-checkbox-native:indeterminate + .albar-checkbox-box,
.albar-checkbox-root[data-state="indeterminate"] .albar-checkbox-box {
    background: linear-gradient(135deg, #019952 0%, #01783f 100%);
    border-color: #01783f;
    box-shadow: 0 2px 6px rgba(1, 136, 73, 0.28), 0 0 0 1px rgba(1, 136, 73, 0.15);
}

/* Focus Ring for Keyboard Tab Accessibility (WCAG AA Compliant) */
.albar-checkbox-native:focus-visible + .albar-checkbox-box {
    outline: none;
    box-shadow: 0 0 0 3px rgba(1, 136, 73, 0.38), 0 2px 6px rgba(1, 136, 73, 0.25) !important;
}

/* Disabled State */
.albar-checkbox-native:disabled,
.albar-checkbox-native:disabled + .albar-checkbox-box,
.albar-checkbox-root.is-disabled {
    cursor: not-allowed;
}

.albar-checkbox-native:disabled + .albar-checkbox-box {
    opacity: 0.55;
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Ripple Pulse Animation when Toggled */
@keyframes albarCheckRipple {
    0% {
        box-shadow: 0 0 0 0 rgba(1, 136, 73, 0.45);
    }
    100% {
        box-shadow: 0 0 0 8px rgba(1, 136, 73, 0);
    }
}

.albar-checkbox-root.albar-just-checked .albar-checkbox-box {
    animation: albarCheckRipple 0.35s ease-out;
}

/* Icons inside the box */
.albar-checkbox-icon {
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
    fill: none;
    stroke: #ffffff;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Checkmark Icon */
.albar-checkbox-icon-check {
    opacity: 0;
    transform: scale(0.4) rotate(-10deg);
    transition: 
        transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.15s ease;
}

.albar-checkbox-native:checked + .albar-checkbox-box .albar-checkbox-icon-check,
.albar-checkbox-root[data-state="checked"] .albar-checkbox-box .albar-checkbox-icon-check {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Indeterminate Dash Icon */
.albar-checkbox-icon-dash {
    opacity: 0;
    transform: scaleX(0.2);
    transition: 
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.15s ease;
}

.albar-checkbox-native:indeterminate + .albar-checkbox-box .albar-checkbox-icon-dash,
.albar-checkbox-root[data-state="indeterminate"] .albar-checkbox-box .albar-checkbox-icon-dash {
    opacity: 1;
    transform: scaleX(1);
}

/* When indeterminate, hide checkmark */
.albar-checkbox-native:indeterminate + .albar-checkbox-box .albar-checkbox-icon-check,
.albar-checkbox-root[data-state="indeterminate"] .albar-checkbox-box .albar-checkbox-icon-check {
    opacity: 0 !important;
    transform: scale(0) !important;
}

/* Size Variants */
.albar-checkbox-root.albar-checkbox-sm,
.albar-checkbox-root.albar-checkbox-sm .albar-checkbox-box {
    width: 15px;
    height: 15px;
    border-radius: 4px;
}
.albar-checkbox-root.albar-checkbox-sm .albar-checkbox-icon {
    width: 10px;
    height: 10px;
    stroke-width: 2.1;
}

.albar-checkbox-root.albar-checkbox-lg,
.albar-checkbox-root.albar-checkbox-lg .albar-checkbox-box {
    width: 22px;
    height: 22px;
    border-radius: 6px;
}
.albar-checkbox-root.albar-checkbox-lg .albar-checkbox-icon {
    width: 15px;
    height: 15px;
    stroke-width: 2.5;
}

/* Label Wrappers */
.albar-checkbox-wrap,
.albar-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    font-size: 0.88rem;
    font-weight: 500;
    color: #1e293b;
    margin: 0;
    line-height: 1.4;
}

.albar-checkbox-wrap,
.albar-checkbox-label,
.remember-me-wrap,
.terms-label-wrap,
.filter-checkbox-label,
.save-addr-checkbox-label {
    display: inline-flex !important;
    align-items: center !important;
    gap: 9px !important;
    cursor: pointer !important;
    user-select: none !important;
}

.albar-checkbox-wrap.is-disabled,
.albar-checkbox-label.is-disabled,
.remember-me-wrap.is-disabled,
.terms-label-wrap.is-disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* Table Integration - Perfect Centering in th/td without margin offset */
th .albar-checkbox-root,
td .albar-checkbox-root {
    display: inline-flex;
    margin: 0 auto;
    vertical-align: middle;
}

/* Touch Device Optimization: Expand Tap Zone to 40px while keeping visual box 18px */
@media (pointer: coarse), (max-width: 768px) {
    .albar-checkbox-root::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        z-index: 2;
        pointer-events: auto;
    }
}
