/* Custom switch styles for is_allowed toggles */

/* Enabled switch styling (green) */
.switch-enabled .custom-control-input:checked ~ .custom-control-label::before {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

.switch-enabled .custom-control-input:checked ~ .custom-control-label::after {
    background-color: #fff !important;
    transform: translateX(0.75rem) !important;
}

/* Disabled switch styling (gray) */
.switch-disabled .custom-control-input ~ .custom-control-label::before {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    opacity: 0.7;
}

.switch-disabled .custom-control-input ~ .custom-control-label::after {
    background-color: #fff !important;
}

/* Hover effects */
.custom-control-label:hover {
    cursor: pointer;
}

/* Smooth transitions */
.custom-control-label::before {
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

.custom-control-label::after {
    transition: transform 0.15s ease-in-out !important;
}

/* Switch alignment and sizing */
.custom-control-switch {
    padding-left: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.custom-control-switch .custom-control-label::before {
    width: 1.75rem;
    height: 1rem;
    border-radius: 0.5rem;
    background-color: #6c757d;
    border: 1px solid #adb5bd;
}

.custom-control-switch .custom-control-label::after {
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 50%;
    background-color: #fff;
    transition: transform 0.15s ease-in-out;
}

/* Remove extra spacing */
.custom-control-switch .custom-control-label {
    margin-bottom: 0;
}

/* Modern Switch Styles - Compatible with older React */
.modern-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.modern-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 28px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.modern-switch input:checked + .switch-slider {
    background-color: #28a745;
}

.modern-switch input:focus + .switch-slider {
    box-shadow: 0 0 1px #28a745;
}

.modern-switch input:checked + .switch-slider:before {
    transform: translateX(22px);
}

.modern-switch:hover .switch-slider {
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.3);
}

/* Small Modern Switch Styles */
.modern-switch-small {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.modern-switch-small input {
    opacity: 0;
    width: 0;
    height: 0;
}

.modern-switch-small .switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 20px;
}

.modern-switch-small .switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.modern-switch-small input:checked + .switch-slider {
    background-color: #28a745;
}

.modern-switch-small input:focus + .switch-slider {
    box-shadow: 0 0 1px #28a745;
}

.modern-switch-small input:checked + .switch-slider:before {
    transform: translateX(16px);
}

.modern-switch-small:hover .switch-slider {
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.3);
}

/* Loading state for switches */
.modern-switch-small.switch-loading {
    position: relative;
}

.modern-switch-small.switch-loading .switch-slider {
    opacity: 0.6;
    pointer-events: none;
}

.modern-switch-small.switch-loading input {
    pointer-events: none;
}

.switch-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.switch-spinner .spinner-border-sm {
    width: 14px;
    height: 14px;
    border-width: 2px;
    color: #28a745;
}

/* Disable hover effects when loading */
.modern-switch-small.switch-loading:hover .switch-slider {
    box-shadow: none;
}