/* Floating labels styling */
.form-floating {
    position: relative;
    margin-bottom: 1.25rem;
}

.form-floating > .form-control,
.form-floating > .form-control-plaintext {
    height: calc(3.5rem + 2px);
    line-height: 1.25;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1rem 0.75rem;
    overflow: hidden;
    text-align: start;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: all 0.3s ease-in-out;
    color: transparent;
    opacity: 0.65;
    background-color: transparent;
}

.form-floating > .form-control::placeholder {
    color: transparent;
}

.form-floating > .form-control:focus,
.form-floating > .form-control:not(:placeholder-shown) {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    opacity: 0.85;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
    /* Use a subtle text color */
    color: var(--text-color);
}

/* Active focus state */
.form-floating > .form-control:focus {
    border-color: rgba(var(--primary-rgb), 0.5);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.15);
    outline: 0;
}

/* For dark theme */
[data-theme="dark"] .form-floating > label {
    color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .form-floating > .form-control:focus ~ label,
[data-theme="dark"] .form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: rgba(255, 255, 255, 0.9);
}

/* Validation states */
.form-floating > .form-control.is-invalid {
    border-color: var(--danger-color);
    background-image: none; /* Remove default Bootstrap validation icon */
}

.form-floating > .form-control.is-invalid ~ label {
    color: var(--danger-color);
}

.form-floating > .form-control.is-valid {
    border-color: var(--success-color);
    background-image: none; /* Remove default Bootstrap validation icon */
}

.form-floating > .form-control.is-valid ~ label {
    color: var(--success-color);
}

/* Improve form control appearance */
.form-control {
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 0.75rem;
    transition: all 0.2s ease;
}

/* Input group with floating labels */
.input-group-floating {
    display: flex;
    align-items: stretch;
    margin-bottom: 1.25rem;
    position: relative;
}

.input-group-floating .input-group-text {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-color);
    text-align: center;
    white-space: nowrap;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem 0 0 0.375rem;
    border-right: 0;
    height: calc(3.5rem + 2px); /* Match the height of the input */
}

.input-group-floating .form-floating {
    flex: 1 1 auto;
    width: 1%;
    margin-bottom: 0; /* Remove bottom margin since parent has it */
}

.input-group-floating .form-floating > .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Fix validation feedback positioning */
.form-floating .invalid-feedback,
.input-group-floating .invalid-feedback {
    position: static; /* Change from absolute to static */
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--danger-color);
    display: none;
}

/* Show the feedback when needed */
.form-floating .form-control.is-invalid + label + .invalid-feedback,
.form-control.is-invalid ~ .invalid-feedback,
.was-validated .form-control:invalid ~ .invalid-feedback {
    display: block;
}

/* Make sure input groups and floating labels work together */
.input-group-floating .form-floating > label {
    left: 0;
    padding-left: 0.75rem;
}

/* Make the row spacing more consistent */
.row.g-3 .form-floating,
.row.g-3 .input-group-floating {
    margin-bottom: 1.25rem;
}

/* Override default Bootstrap form-control height */
.form-floating > .form-control {
    height: calc(3.5rem + 2px);
}

/* Remove the mb-3 class effect since we're handling margins in the component styles */
.modal-body .mb-3 {
    margin-bottom: 0 !important;
}

/* Fix form row spacing */
.row.g-3 {
    --bs-gutter-y: 0; /* Remove the default row gutter */
}

/* Fix checkboxes appearance with the invalid state */
.form-check .form-check-input.is-invalid {
    border-color: var(--danger-color);
}

.form-check .invalid-feedback {
    display: block;
    margin-top: 0.25rem;
}

/* Fix modal body padding to account for our custom margins */
.modal-body {
    padding: 1.5rem;
}

/* Make sure forms have sufficient spacing at the bottom */
.modal-body form.row {
    margin-bottom: -1rem; /* Counteract the bottom margin of the last form element */
}

/* Spacing for form sections */
.col-12:not(:last-child) {
    margin-bottom: 0.75rem;
}

/* Button styling */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    border: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--text-color);
    color: var(--bg-color);
}

.btn-primary:hover {
    /* background-color: rgba(var(--primary-rgb), 0.9); */
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Browser autofill styling fixes */
/* Fix for Chrome/Safari */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--bg-color) inset !important;
    -webkit-text-fill-color: var(--text-color) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Fix for newer browsers */
input:-internal-autofill-selected,
input.form-control:-internal-autofill-selected,
.form-floating > .form-control:-internal-autofill-selected {
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
    -webkit-text-fill-color: var(--text-color) !important;
}

/* Make sure floating labels work with autofilled inputs */
.form-floating > .form-control:-webkit-autofill ~ label,
.form-floating > .form-control:-internal-autofill-selected ~ label {
    opacity: 0.85;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
    color: var(--text-color);
}

/* Dark theme autofill adjustments */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover, 
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--bg-color) inset !important;
    -webkit-text-fill-color: var(--text-color) !important;
}

[data-theme="dark"] input:-internal-autofill-selected,
[data-theme="dark"] input.form-control:-internal-autofill-selected,
[data-theme="dark"] .form-floating > .form-control:-internal-autofill-selected {
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
}

/* Form check styling */
.form-check {
    margin-bottom: 0.5rem;
    padding-left: 1.75rem;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
    margin-left: -1.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
}

.form-check-label {
    margin-bottom: 0;
    font-size: 0.95rem;
    color: var(--text-color);
}

/* Divider styling */
.my-2 {
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
}

/* Prevent blue highlight on mobile tap */
input, button, a {
    -webkit-tap-highlight-color: transparent;
} 