/**
 * Enhanced Form Styles - Reusable Component
 *
 * Usage:
 * Wrap your form card with: <div class="card enhanced-form-wrapper">
 * All form elements will automatically get styled
 */

/* Enhanced Form Wrapper - Apply to card */
.enhanced-form-wrapper {
    border: none;
    border-radius: 12px;
    background: #ffffff;
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); */
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

.enhanced-form-wrapper:hover {
    /* box-shadow: 0 4px 16px rgba(66, 66, 65, 0.267); */
}

/* Subtle Accent Bar on Top */
.enhanced-form-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #ff9008;
    border-radius: 12px 12px 0 0;
}

.enhanced-form-wrapper .card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 1.25rem 1.5rem;
    border-radius: 12px 12px 0 0;
}

.enhanced-form-wrapper .card-header h5 {
    margin: 0;
    font-weight: 600;
    color: #495057;
    font-size: 1.1rem;
}

.enhanced-form-wrapper .card-body {
    padding: 1.5rem;
}

/* Enhanced Labels */
.enhanced-form-wrapper label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    display: block;
}

.enhanced-form-wrapper label span.text-danger {
    color: #ff9008 !important;
    font-weight: 700;
    margin-left: 2px;
}

/* Enhanced Input Fields */
.enhanced-form-wrapper .form-control {
    border: 1.5px solid #e9ecef;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    color: #495057;
    background-color: #ffffff;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.enhanced-form-wrapper .form-control::placeholder {
    color: #adb5bd;
    font-style: italic;
    opacity: 0.8;
}

.enhanced-form-wrapper .form-control:hover {
    border-color: #ced4da;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.enhanced-form-wrapper .form-control:focus {
    border-color: #ff9008;
    box-shadow: 0 0 0 3px rgba(255, 144, 8, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    outline: none;
    background-color: #ffffff;
}

.enhanced-form-wrapper .form-control:disabled,
.enhanced-form-wrapper .form-control[readonly] {
    background-color: #f8f9fa;
    opacity: 0.7;
    cursor: not-allowed;
}

/* Enhanced Input Groups */
.enhanced-form-wrapper .input-group {
    position: relative;
}

.enhanced-form-wrapper .input-group-prepend .input-group-text,
.enhanced-form-wrapper .input-group-append .input-group-text {
    background-color: #f8f9fa;
    border: 1.5px solid #e9ecef;
    border-radius: 8px 0 0 8px;
    color: #6c757d;
    font-weight: 500;
    padding: 0.65rem 1rem;
    transition: all 0.3s ease;
}

.enhanced-form-wrapper .input-group-append .input-group-text {
    border-radius: 0 8px 8px 0;
}

.enhanced-form-wrapper .input-group .form-control {
    border-left: none;
    border-radius: 0 8px 8px 0;
}

.enhanced-form-wrapper .input-group-prepend + .form-control {
    border-left: 1.5px solid #e9ecef;
    border-radius: 0 8px 8px 0;
}

.enhanced-form-wrapper .input-group:focus-within .input-group-prepend .input-group-text,
.enhanced-form-wrapper .input-group:focus-within .input-group-append .input-group-text {
    border-color: #ff9008;
    background-color: #fff3eb;
    color: #ff9008;
}

.enhanced-form-wrapper .input-group:focus-within .form-control {
    border-left-color: #ff9008;
}

/* Enhanced Buttons in Input Groups */
.enhanced-form-wrapper .input-group-append .btn,
.enhanced-form-wrapper .input-group-prepend .btn {
    border-radius: 0 8px 8px 0;
    border: 1.5px solid #e9ecef;
    border-left: none;
    padding: 0.65rem 1rem;
    transition: all 0.3s ease;
    background-color: #ffffff;
    color: #495057;
}

.enhanced-form-wrapper .input-group-prepend .btn {
    border-radius: 8px 0 0 8px;
    border-left: 1.5px solid #e9ecef;
    border-right: none;
}

.enhanced-form-wrapper .input-group-append .btn:hover,
.enhanced-form-wrapper .input-group-prepend .btn:hover {
    background-color: #fff3eb;
    border-color: #ff9008;
    color: #ff9008;
    box-shadow: 0 2px 6px rgba(255, 144, 8, 0.2);
}

.enhanced-form-wrapper .input-group-append .btn:focus,
.enhanced-form-wrapper .input-group-prepend .btn:focus {
    outline: none;
    border-color: #ff9008;
    box-shadow: 0 0 0 3px rgba(255, 144, 8, 0.15);
}

/* Enhanced Submit Button - Works both inside and outside form */
.enhanced-form-wrapper .btn-primary,
.enhanced-form-wrapper input[type="submit"].btn-primary,
.enhanced-form-wrapper button[type="submit"].btn-primary {
    background: #ff9008;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 2px 6px rgba(255, 144, 8, 0.25);
    transition: all 0.3s ease;
    color: #ffffff;
}

.enhanced-form-wrapper .btn-primary:hover,
.enhanced-form-wrapper input[type="submit"].btn-primary:hover,
.enhanced-form-wrapper button[type="submit"].btn-primary:hover {
    background: #e88207;
    box-shadow: 0 4px 12px rgba(255, 144, 8, 0.35);
    transform: translateY(-1px);
    color: #ffffff;
}

.enhanced-form-wrapper .btn-primary:focus,
.enhanced-form-wrapper input[type="submit"].btn-primary:focus,
.enhanced-form-wrapper button[type="submit"].btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 144, 8, 0.25), 0 4px 12px rgba(255, 144, 8, 0.35);
}

.enhanced-form-wrapper .btn-primary:active,
.enhanced-form-wrapper input[type="submit"].btn-primary:active,
.enhanced-form-wrapper button[type="submit"].btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 144, 8, 0.25);
}

/* Enhanced Form Groups */
.enhanced-form-wrapper .form-group {
    margin-bottom: 1.25rem;
}

.enhanced-form-wrapper .form-group:last-child {
    margin-bottom: 0;
}

/* Validation States */
.enhanced-form-wrapper .form-control.is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23dc3545' d='M6 0C2.69 0 0 2.69 0 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm.5 8.5h-1v-1h1v1zm0-2.5h-1V3h1v3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 16px;
    padding-right: 2.5rem;
}

.enhanced-form-wrapper .form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.enhanced-form-wrapper .invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #dc3545;
    font-weight: 500;
}

.enhanced-form-wrapper .form-control.is-valid {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2328a745' d='M6 0C2.69 0 0 2.69 0 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm3.5 3.5L5.5 8 2.5 5l1-1 2 2 4-4 1 1z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 16px;
    padding-right: 2.5rem;
}

.enhanced-form-wrapper .form-control.is-valid:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.enhanced-form-wrapper .valid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #28a745;
    font-weight: 500;
}

/* Enhanced Select Dropdowns */
.enhanced-form-wrapper select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23495057' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 16px;
    padding-right: 2.5rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.enhanced-form-wrapper select.form-control:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ff9008' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* Enhanced Textareas */
.enhanced-form-wrapper textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Enhanced Checkboxes and Radios */
.enhanced-form-wrapper input[type="checkbox"],
.enhanced-form-wrapper input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ff9008;
    margin-right: 0.5rem;
}

/* Form Section Styling */
.enhanced-form-wrapper .row {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
}

.enhanced-form-wrapper .row > [class*="col-"] {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* Loading State for Submit Button */
.enhanced-form-wrapper .btn-primary.loading,
.enhanced-form-wrapper input[type="submit"].btn-primary.loading,
.enhanced-form-wrapper button[type="submit"].btn-primary.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.enhanced-form-wrapper .btn-primary.loading::after,
.enhanced-form-wrapper input[type="submit"].btn-primary.loading::after,
.enhanced-form-wrapper button[type="submit"].btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 576px) {
    .enhanced-form-wrapper .card-body {
        padding: 1rem;
    }

    .enhanced-form-wrapper .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .enhanced-form-wrapper .btn-primary,
    .enhanced-form-wrapper input[type="submit"].btn-primary,
    .enhanced-form-wrapper button[type="submit"].btn-primary {
        width: 100%;
        padding: 0.75rem 2rem;
    }
}

