/* ===================================================================== */
/* === RETAIL ADMIN FORMS === */
/* Input Styling and Dropdown Systems */
/* ===================================================================== */

/* === UNIFIED INPUT STYLING === */

#retail-date-range,
.retail-modal-input,
.retail-filter-row input,
.retail-filter-row select {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 14px;
    font-weight: var(--font-weight-normal);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

#retail-date-range:focus,
.retail-modal-input:focus,
.retail-filter-row input:focus,
.retail-filter-row select:focus {
    outline: none;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), inset 0 2px 10px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

/* === MODAL FORM INPUTS === */

.retail-modal-form label {
    font-weight: var(--font-weight-bold);
    margin-top: 16px;
    display: block;
    font-size: 15px;
    color: #2d3748;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.retail-modal-input,
.retail-modal-select {
    width: 100%;
    padding: 16px 18px;
    margin-bottom: 18px;
    font-size: 15px;
    line-height: 1.5;
    border: none;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    vertical-align: middle;
    box-sizing: border-box;
}

.retail-modal-input:focus,
.retail-modal-select:focus {
    outline: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(236, 138, 65, 0.25), inset 0 2px 10px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

/* === FILTER ROW STYLING === */

.retail-filter-row input,
.retail-filter-row select {
    flex: 1;
    min-width: 200px;
    padding: 16px 18px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 15px;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
    box-sizing: border-box;
    height: auto;
    min-height: 48px;
}

.retail-filter-row input:focus,
.retail-filter-row select:focus {
    outline: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(236, 138, 65, 0.25), inset 0 2px 10px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

.retail-filter-row input::placeholder {
    color: #9ca3af;
    font-weight: var(--font-weight-normal);
}

/* === ORDERS FILTER WRAPPER === */

.retail-orders-filter-wrapper input {
    width: 100%;
    padding: 16px 18px;
    font-size: 15px;
    line-height: 1.5;
    border: none;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #4a5568;
    font-weight: var(--font-weight-normal);
    box-sizing: border-box;
    min-height: 48px;
}

.retail-orders-filter-wrapper input:focus {
    outline: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.25), inset 0 2px 10px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

/* === SEARCH INPUT STYLING === */

.retail-search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid rgba(236, 138, 65, 0.2);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: var(--font-weight-normal);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.retail-search-input:focus {
    border-color: var(--brand-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(236, 138, 65, 0.3);
    background: white;
}

.retail-search-input::placeholder {
    color: #9ca3af;
    font-style: italic;
}

/* === COMPREHENSIVE DROPDOWN SYSTEM === */

/* Ensure ALL select elements have proper text spacing */
select:not([class]):not([id]),
select[id*="filter"]:not(#child-filter-level):not(#child-filter-grade):not(#child-filter-sede),
select[id*="category"]:not(#product-category-select),
.retail-admin-wrapper select,
div[class*="retail"] select,
div[class*="filter"] select {
    padding: 16px 18px 16px 18px;
    font-size: 15px;
    line-height: 1.5;
    border: none;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #4a5568;
    font-weight: var(--font-weight-normal);
    vertical-align: middle;
    box-sizing: border-box;
    height: auto;
    min-height: 48px;
    display: block;
    font-family: inherit;
    cursor: pointer;
    overflow: hidden;

    /* Custom dropdown arrow for consistency */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Focus states for catch-all selects */
select:not([class]):not([id]):focus,
select[id*="filter"]:not(#child-filter-level):not(#child-filter-grade):not(#child-filter-sede):focus,
select[id*="category"]:not(#product-category-select):focus,
.retail-admin-wrapper select:focus,
div[class*="retail"] select:focus,
div[class*="filter"] select:focus {
    outline: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(236, 138, 65, 0.25), inset 0 2px 10px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

/* Option styling for catch-all selects */
select:not([class]):not([id]) option,
select[id*="filter"]:not(#child-filter-level):not(#child-filter-grade):not(#child-filter-sede) option,
select[id*="category"]:not(#product-category-select) option,
.retail-admin-wrapper select option,
div[class*="retail"] select option,
div[class*="filter"] select option {
    padding: 8px 12px;
    line-height: 1.6;
    font-size: 15px;
    color: #2d3748;
    background: white;
    border: none;
    min-height: 32px;
    height: auto;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: var(--font-weight-normal);
    max-height: none;
    word-wrap: break-word;
}

/* === ENHANCED DROPDOWN CONTAINER STYLING === */

.retail-modal-select,
.retail-category-filter-section select,
.retail-filter-row select {
    /* Ensure proper dropdown display */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Specific option styling for different select types */
.retail-modal-select option:hover,
.retail-category-filter-section select option:hover,
.retail-filter-row select option:hover {
    background: rgba(236, 138, 65, 0.1);
    color: var(--brand-primary);
}

.retail-modal-select option:checked,
.retail-category-filter-section select option:checked,
.retail-filter-row select option:checked {
    background: var(--gradient-primary);
    color: white;
    font-weight: var(--font-weight-bold);
}

/* === SPECIFIC DROPDOWN ID FIXES === */

/* Target specific dropdown elements that were experiencing text clipping */
#child-filter-level,
#child-filter-grade,
#child-filter-sede,
#product-category-select {
    width: 100%;
    padding: 16px 18px 16px 18px;
    font-size: 15px;
    line-height: 1.5;
    border: none;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #4a5568;
    font-weight: var(--font-weight-normal);
    vertical-align: middle;
    box-sizing: border-box;
    height: auto;
    min-height: 50px;
    display: block;
    font-family: inherit;
    cursor: pointer;
    overflow: hidden;

    /* Custom dropdown arrow */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 42px;
}

#child-filter-level:focus,
#child-filter-grade:focus,
#child-filter-sede:focus,
#product-category-select:focus {
    outline: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(236, 138, 65, 0.25), inset 0 2px 10px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

/* Specific option styling for these dropdowns */
#child-filter-level option,
#child-filter-grade option,
#child-filter-sede option,
#product-category-select option {
    padding: 10px 14px;
    line-height: 1.6;
    font-size: 15px;
    color: #2d3748;
    background: white;
    border: none;
    min-height: 36px;
    height: auto;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: var(--font-weight-normal);
    max-height: none;
    word-wrap: break-word;
}

#child-filter-level option:hover,
#child-filter-grade option:hover,
#child-filter-sede option:hover,
#product-category-select option:hover {
    background: rgba(236, 138, 65, 0.1);
    color: var(--brand-primary);
}

#child-filter-level option:checked,
#child-filter-grade option:checked,
#child-filter-sede option:checked,
#product-category-select option:checked {
    background: var(--gradient-primary);
    color: white;
    font-weight: var(--font-weight-bold);
}

/* === PAGINATION SIZE SELECTOR === */

.retail-per-page-select {
    padding: 8px 12px;
    border: 2px solid rgba(236, 138, 65, 0.2);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    font-weight: var(--font-weight-normal);
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.retail-per-page-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(236, 138, 65, 0.2);
}

/* === TOGGLE SWITCH DESIGN === */

.retail-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    user-select: none;
    margin-bottom: 8px;
}

.retail-checkbox-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.retail-checkbox-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.95);
}

.retail-checkbox-label:hover::before {
    transform: scaleX(1);
}

.retail-checkbox-input {
    appearance: none;
    -webkit-appearance: none;
    width: 48px;
    height: 24px;
    background: #e2e8f0;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    order: 2;
}

.retail-checkbox-input::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.retail-checkbox-input:checked {
    background: var(--gradient-primary);
    box-shadow: 0 0 0 2px rgba(236, 138, 65, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.retail-checkbox-input:checked::before {
    transform: translateX(24px);
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.retail-checkbox-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(236, 138, 65, 0.3);
}

.retail-checkbox-label span {
    font-weight: var(--font-weight-bold);
    color: #4a5568;
    font-size: 14px;
    transition: color 0.3s ease;
    order: 1;
    flex: 1;
}

.retail-checkbox-label:has(.retail-checkbox-input:checked) {
    background: rgba(236, 138, 65, 0.1);
    border-color: rgba(236, 138, 65, 0.3);
}

.retail-checkbox-label:has(.retail-checkbox-input:checked) span {
    color: var(--brand-primary);
    font-weight: var(--font-weight-bold);
}

.retail-checkbox-label:has(.retail-checkbox-input:checked)::before {
    transform: scaleX(1);
}

/* Status indicators */
.retail-checkbox-label::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.3s ease;
    order: 3;
}

.retail-checkbox-label:has(.retail-checkbox-input:checked)::after {
    background: var(--gradient-success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

/* === BROWSER-SPECIFIC DROPDOWN FIXES === */

/* Remove native dropdown arrows */
.retail-modal-select::-ms-expand,
.retail-category-filter-section select::-ms-expand,
.retail-filter-row select::-ms-expand,
#child-filter-level::-ms-expand,
#child-filter-grade::-ms-expand,
#child-filter-sede::-ms-expand,
#product-category-select::-ms-expand {
    display: none;
}

/* Firefox specific fixes */
@-moz-document url-prefix() {
    .retail-modal-select,
    .retail-category-filter-section select,
    .retail-filter-row select {
        padding-top: 16px;
        padding-bottom: 16px;
        text-indent: 0.01px;
        text-overflow: '';
    }

    .retail-modal-select option,
    .retail-category-filter-section select option,
    .retail-filter-row select option {
        padding: 10px 12px;
        line-height: 1.4;
    }

    #child-filter-level,
    #child-filter-grade,
    #child-filter-sede,
    #product-category-select {
        padding: 16px 42px 16px 18px;
        text-indent: 0.01px;
        text-overflow: '';
    }

    #child-filter-level option,
    #child-filter-grade option,
    #child-filter-sede option,
    #product-category-select option {
        padding: 12px 14px;
        line-height: 1.4;
    }
}

/* WebKit/Chrome specific fixes */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    .retail-modal-select,
    .retail-category-filter-section select,
    .retail-filter-row select {
        background-position: right 14px center;
    }

    #child-filter-level,
    #child-filter-grade,
    #child-filter-sede,
    #product-category-select {
        background-position: right 16px center;
    }
}

/* Ensure consistent dropdown behavior */
.retail-modal-select,
.retail-category-filter-section select,
.retail-filter-row select {
    display: block;
    width: 100%;
    font-family: inherit;
    cursor: pointer;
    overflow: hidden;
}

/* Ensure options are properly sized */
.retail-modal-select option,
.retail-category-filter-section select option,
.retail-filter-row select option {
    height: auto;
    max-height: none;
    overflow: visible;
    word-wrap: break-word;
}

/* === ENHANCED SPECIFICITY FOR SEARCH AND PAGINATION === */

/* Maximum specificity for search inputs */
.retail-admin-wrapper .retail-orders-search-wrapper .retail-search-input,
.retail-orders-search-wrapper .retail-search-input,
#customer-search-input.retail-search-input,
input#customer-search-input {
    border-radius: var(--radius-lg) !important;
    -webkit-border-radius: var(--radius-lg) !important;
    -moz-border-radius: var(--radius-lg) !important;
}

/* Maximum specificity for per-page select */
.retail-admin-wrapper .retail-orders-search-wrapper .retail-per-page-select,
.retail-orders-search-wrapper .retail-per-page-select,
#orders-per-page.retail-per-page-select,
select#orders-per-page {
    border-radius: var(--radius-md) !important;
    -webkit-border-radius: var(--radius-md) !important;
    -moz-border-radius: var(--radius-md) !important;
}

/* === RESPONSIVE DESIGN === */

@media (max-width: 768px) {
    .retail-checkbox-label {
        padding: 10px 12px;
        gap: 10px;
    }

    .retail-checkbox-input {
        width: 40px;
        height: 20px;
    }

    .retail-checkbox-input::before {
        width: 16px;
        height: 16px;
    }

    .retail-checkbox-input:checked::before {
        transform: translateX(20px);
    }
}