/* ============================================
   PULSIS FORMS - UNIFIED THEME STYLES
   Consistent form elements across entire application
   ============================================ */

/* ===== FORM INPUTS ===== */
.form-control {
    background-color: rgba(15, 23, 42, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: #e2e8f0 !important;
    padding: 10px 15px !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
    height: auto !important;
}

.form-control:focus {
    background-color: rgba(15, 23, 42, 0.6) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1) !important;
    color: #ffffff !important;
}

.form-control:disabled,
.form-control:read-only {
    background-color: rgba(15, 23, 42, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    opacity: 0.6;
    cursor: not-allowed;
}

.form-control::placeholder {
    color: #64748b !important;
    opacity: 0.7;
}

/* Small input size */
.form-control-sm {
    padding: 6px 12px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
}

/* Large input size */
.form-control-lg {
    padding: 12px 18px !important;
    font-size: 16px !important;
    border-radius: 10px !important;
}

/* ===== FORM SELECT (DROPDOWNS) ===== */
.form-select {
    background-color: rgba(15, 23, 42, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: #e2e8f0 !important;
    padding: 10px 40px 10px 15px !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px 12px !important;
    cursor: pointer;
}

.form-select:focus {
    background-color: rgba(15, 23, 42, 0.6) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1) !important;
    color: #ffffff !important;
}

.form-select:disabled {
    background-color: rgba(15, 23, 42, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    opacity: 0.6;
    cursor: not-allowed;
}

.form-select option {
    background-color: #0f172a;
    color: #e2e8f0;
    padding: 10px;
}

.form-select option:checked {
    background-color: var(--primary);
    color: #ffffff;
}

/* Small select size */
.form-select-sm {
    padding: 6px 32px 6px 12px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    background-position: right 10px center !important;
    background-size: 14px 10px !important;
}

/* Large select size */
.form-select-lg {
    padding: 12px 45px 12px 18px !important;
    font-size: 16px !important;
    border-radius: 10px !important;
    background-position: right 15px center !important;
}

/* Multiple select */
.form-select[multiple],
.form-select[size]:not([size="1"]) {
    padding: 8px !important;
    background-image: none !important;
}

.form-select[multiple] option,
.form-select[size]:not([size="1"]) option {
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: 4px;
}

/* ===== FORM LABELS ===== */
.form-label {
    color: #cbd5e1 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    margin-bottom: 8px !important;
    display: inline-block;
    letter-spacing: 0.3px;
}

.form-label.required::after,
.form-label .text-danger {
    color: #ef4444;
}

/* ===== INPUT GROUPS ===== */
.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group-text {
    background-color: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: #94a3b8 !important;
    padding: 10px 15px !important;
    font-size: 14px !important;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.input-group-text i {
    color: #94a3b8;
}

.input-group .form-control,
.input-group .form-select {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

/* When input-group-text is first */
.input-group > .input-group-text:first-child {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.input-group > .input-group-text:first-child + .form-control,
.input-group > .input-group-text:first-child + .form-select {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

/* When input-group-text is last */
.input-group > .form-control:not(:last-child),
.input-group > .form-select:not(:last-child) {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.input-group > .input-group-text:last-child {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

/* Small input group */
.input-group-sm .input-group-text {
    padding: 6px 12px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
}

/* ===== CHECKBOXES & RADIOS ===== */
.form-check {
    display: block;
    min-height: 1.5rem;
    padding-left: 1.75em;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 18px !important;
    height: 18px !important;
    margin-top: 0.15em;
    vertical-align: top;
    background-color: rgba(15, 23, 42, 0.4) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    appearance: none;
    color-adjust: exact;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
}

.form-check-input[type="checkbox"] {
    border-radius: 4px !important;
}

.form-check-input[type="radio"] {
    border-radius: 50% !important;
}

.form-check-input:checked {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.form-check-input:checked[type="checkbox"] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e") !important;
}

.form-check-input:checked[type="radio"] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23fff'/%3e%3c/svg%3e") !important;
}

.form-check-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.25) !important;
}

.form-check-input:disabled {
    pointer-events: none;
    filter: none;
    opacity: 0.5;
}

.form-check-label {
    color: #cbd5e1 !important;
    font-size: 14px !important;
    cursor: pointer;
    user-select: none;
}

/* Custom checkbox (for older styles) */
.custom-checkbox .form-check-input {
    width: 20px !important;
    height: 20px !important;
}

/* ===== SWITCHES ===== */
.form-switch .form-check-input {
    width: 40px !important;
    height: 22px !important;
    border-radius: 11px !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28255,255,255,0.7%29'/%3e%3c/svg%3e") !important;
    background-position: left center !important;
    background-size: contain !important;
    transition: background-position 0.15s ease-in-out;
}

.form-switch .form-check-input:checked {
    background-position: right center !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
}

.form-switch .form-check-input:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28255,255,255,0.8%29'/%3e%3c/svg%3e") !important;
}

/* ===== FORM TEXT & HELPER TEXT ===== */
.form-text {
    margin-top: 0.25rem;
    font-size: 12px;
    color: #64748b !important;
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 12px;
    color: #ef4444 !important;
}

.valid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 12px;
    color: #22c55e !important;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #ef4444 !important;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #22c55e !important;
}

.form-control.is-valid:focus,
.form-select.is-valid:focus {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25) !important;
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

.is-valid ~ .valid-feedback {
    display: block;
}

/* ===== TEXTAREA ===== */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ===== FILE INPUT ===== */
.form-control[type="file"] {
    overflow: hidden;
}

.form-control[type="file"]::-webkit-file-upload-button {
    padding: 6px 12px;
    margin: -10px -15px;
    margin-inline-end: 15px;
    color: #e2e8f0;
    background-color: rgba(255, 255, 255, 0.1);
    pointer-events: none;
    border: 0;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    transition: all 0.15s ease-in-out;
}

.form-control[type="file"]::file-selector-button {
    padding: 6px 12px;
    margin: -10px -15px;
    margin-inline-end: 15px;
    color: #e2e8f0;
    background-color: rgba(255, 255, 255, 0.1);
    pointer-events: none;
    border: 0;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    transition: all 0.15s ease-in-out;
}

.form-control[type="file"]:hover:not(:disabled):not([readonly])::-webkit-file-upload-button {
    background-color: rgba(255, 255, 255, 0.15);
}

.form-control[type="file"]:hover:not(:disabled):not([readonly])::file-selector-button {
    background-color: rgba(255, 255, 255, 0.15);
}

/* ===== FORM FLOATING LABELS ===== */
.form-floating {
    position: relative;
}

.form-floating > .form-control,
.form-floating > .form-select {
    height: calc(3.5rem + 2px);
    line-height: 1.25;
}

.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    padding: 1rem 15px;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* ===== RANGE SLIDER ===== */
.form-range {
    width: 100%;
    height: 1.5rem;
    padding: 0;
    background-color: transparent;
    appearance: none;
}

.form-range::-webkit-slider-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    margin-top: -6px;
}

.form-range::-moz-range-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.form-range:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.25);
}

.form-range:focus::-moz-range-thumb {
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.25);
}

/* ===== SEARCH INPUTS ===== */
.form-control[type="search"] {
    padding-right: 40px;
}

/* ===== DATE & TIME INPUTS ===== */
.form-control[type="date"],
.form-control[type="time"],
.form-control[type="datetime-local"],
.form-control[type="month"],
.form-control[type="week"] {
    appearance: none;
}

.form-control[type="date"]::-webkit-calendar-picker-indicator,
.form-control[type="time"]::-webkit-calendar-picker-indicator,
.form-control[type="datetime-local"]::-webkit-calendar-picker-indicator {
    background: transparent;
    cursor: pointer;
    filter: invert(0.7);
}

/* ===== COLOR PICKER ===== */
.form-control[type="color"] {
    height: 45px;
    padding: 4px;
}

.form-control[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.form-control[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 4px;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .form-control,
    .form-select {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
}

/* ===== DARK MODE ENHANCEMENTS ===== */
@media (prefers-color-scheme: dark) {
    .form-control,
    .form-select,
    .input-group-text {
        color-scheme: dark;
    }
}

/* ===== ACCESSIBILITY ===== */
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    outline: 0;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .form-control,
    .form-select {
        border-width: 2px !important;
    }
}

/* ===== ADDITIONAL UTILITY CLASSES ===== */
.form-control-plaintext {
    display: block;
    width: 100%;
    padding: 10px 0;
    margin-bottom: 0;
    line-height: 1.5;
    color: #e2e8f0;
    background-color: transparent;
    border: solid transparent;
    border-width: 1px 0;
}

.form-control-plaintext:focus {
    outline: 0;
}

.form-control-color {
    width: 3rem;
    height: auto;
    padding: 0.375rem;
}

/* Form groups with better spacing */
.mb-3 .form-label {
    margin-bottom: 8px !important;
}

.mb-3 .form-control,
.mb-3 .form-select {
    margin-bottom: 0 !important;
}

