/* native.css - Touch-optimized styles and native app-like components */

:root {
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
}

/* Touch-optimized interactions */
* {
    -webkit-tap-highlight-color: transparent;
}

.no-select {
    -webkit-user-select: none;
    user-select: none;
}

/* Active states for better touch feedback */
.btn:active,
button:active,
.clickable:active {
    transform: scale(0.98);
    opacity: 0.9;
    transition: transform 100ms ease, opacity 100ms ease;
}

/* Native-like cards and buttons with touch targets */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-warning,
.btn-danger,
.btn-info {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px !important;
    border-radius: var(--radius-md, 6px) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em !important;
    box-shadow: none !important;
    transition: all 150ms ease-in-out !important;
}

/* iOS-Style Toggle Switch */
.switch-ios {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
}

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

.slider-ios {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E9E9EA;
    transition: .4s;
    border-radius: 34px;
}

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

.switch-ios input:checked + .slider-ios {
    background-color: #34C759; /* Apple Green */
}

.switch-ios input:focus + .slider-ios {
    box-shadow: 0 0 1px #34C759;
}

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

/* Loading Spinners & Pull to Refresh */
.native-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid rgba(0, 0, 0, 0.1);
    border-top: 2.5px solid var(--colors-primary, #1B365D);
    border-radius: 50%;
    animation: native-spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes native-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.native-spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Pull-to-refresh animation hooks */
.ptr-container {
    height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F8FAFC;
    transition: height 0.2s ease;
    border-bottom: 1px solid #E2E8F0;
}

.ptr-container.pulling {
    height: 60px;
}

.ptr-icon {
    font-size: 16px;
    color: #94A3B8;
    transition: transform 0.2s ease;
}

.ptr-container.pulling .ptr-icon {
    transform: rotate(180deg);
}

.ptr-container.refreshing .ptr-icon {
    animation: native-spin 0.8s linear infinite;
}

/* Safe area support for notched devices */
.safe-padding-top {
    padding-top: calc(16px + var(--safe-area-top)) !important;
}

.safe-padding-bottom {
    padding-bottom: calc(16px + var(--safe-area-bottom)) !important;
}

.safe-margin-bottom {
    margin-bottom: var(--safe-area-bottom) !important;
}

/* Select2 Bootstrap 4 / MDB Compatibility Styles */
.select2-container {
    width: 100% !important;
}

.select2-container .select2-selection--single {
    height: 38px !important;
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
    padding: 6px 12px;
    background-color: #fff;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #495057 !important;
    line-height: 24px !important;
    padding-left: 0 !important;
    font-size: 14px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px !important;
    right: 8px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #495057 transparent transparent transparent !important;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #495057 transparent !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #80bdff !important;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #1B365D !important;
    color: white !important;
}

.select2-dropdown {
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
    z-index: 9999;
}

.select2-container--default .select2-selection--single[aria-disabled="true"] {
    background-color: #e9ecef !important;
    opacity: 1;
}
