/* ----- ENHANCED FORM SYSTEM (UNIFIED) ----- */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
    margin-bottom: var(--space-2_5);
}

.input-wrapper {
    position: relative;
    margin-bottom: var(--space-4);
}

.input-wrapper .label-tooltip-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.input-wrapper label {
    font-family: var(--font-family-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    transition: var(--transition-colors);
}

.input-wrapper label .required {
    color: var(--danger);
    margin-left: var(--space-1);
}

.input-wrapper .field-tooltip {
    position: relative;
    color: var(--gray);
    cursor: pointer;
    padding: 2px;
}

.input-wrapper .field-tooltip i {
    font-size: 1rem;
    transition: color 0.3s ease;
}

.input-wrapper .field-tooltip:hover i {
    color: var(--primary);
}

.input-wrapper .field-tooltip:hover:after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 5px);
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: normal;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    min-width: 200px;
    max-width: 300px;
    text-align: center;
}

.input-wrapper .field-tooltip:hover:before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    border-top: 5px solid #333;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    z-index: 10;
}

/* Enhanced form control (unified form style) - No Icons */
.input-wrapper .form-control,
.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-5);
    border: var(--border-width-2) solid var(--border-secondary);
    border-radius: var(--radius-pill);
    font-family: var(--font-family-primary);
    min-height: var(--input-height);
    background-color: var(--input-bg, var(--bg-primary));
    color: var(--input-color, var(--text-primary));
    transition: var(--transition-all);
}

.input-wrapper .form-control::placeholder,
.form-control::placeholder {
    color: var(--input-placeholder, var(--text-tertiary));
    opacity: 1;
}

.input-wrapper .form-control:focus,
.form-control:focus {
    outline: none;
    border-color: var(--input-border-focus, var(--border-focus));
    box-shadow: var(--input-shadow-focus, var(--shadow-input-focus)), var(--shadow-focus);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

textarea.form-control {
    resize: vertical;
    min-height: calc(var(--input-height) * 2.5);
    padding-top: var(--space-4);
    border-radius: var(--radius-3xl) !important;
    background-color: var(--input-bg, var(--bg-primary));
    color: var(--input-color, var(--text-primary));
}

/* Form groups for enhanced forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--theme-transition);
}

.form-group label .required {
    color: #dc3545;
    margin-left: 4px;
}

/* Password toggle */
.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    transition: color 0.3s ease;
}

/* Password toggle positioning with visible labels */
.input-wrapper:has(label:not(.sr-only)) .password-toggle,
.input-wrapper label:not(.sr-only) ~ .password-toggle {
    top: 56px;
    transform: none;
}

.password-toggle:hover {
    color: var(--primary);
}

/* Checkbox styling */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--theme-transition);
}

.checkbox-container input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: var(--space-5);
    height: var(--space-5);
    border: var(--border-width-2) solid var(--border-primary);
    border-radius: var(--radius-base);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-all);
    background: var(--surface-primary);
    box-shadow: var(--shadow-input);
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-container input[type="checkbox"]:checked + .checkmark::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: var(--text-inverse);
    font-size: 0.8rem;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.forgot-link {
    color: var(--primary);
    font-size: 0.95rem;
    text-decoration: none;
    font-weight: 500;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* File Upload */
.input-wrapper .file-input {
    opacity: 0;
    position: absolute;
    top: 8px;
    left: 0;
    width: 100%;
    height: calc(100% - 8px);
    cursor: pointer;
    z-index: 1;
}

.input-wrapper .file-upload-area {
    width: 100%;
    padding: 20px;
    border: var(--border-width-medium) dashed var(--border-secondary);
    border-radius: var(--radius-2xl);
    text-align: center;
    transition: var(--theme-transition);
    background: var(--input-bg, var(--bg-secondary));
    margin-top: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-input);
    border-color: var(--input-border, var(--border-secondary));
    position: relative;
    z-index: 2;
}

.input-wrapper .file-upload-area i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
    display: block;
}

.input-wrapper .file-upload-area span {
    color: var(--gray);
    font-size: 0.95rem;
    display: block;
}

.input-wrapper .file-input:focus ~ .file-upload-area,
.input-wrapper .file-upload-area:hover {
    border-color: var(--primary);
    background: var(--bg-tertiary);
}

.input-wrapper .file-upload-area.has-file {
    border-color: var(--success);
    background-color: rgba(40, 167, 69, 0.05);
}

.input-wrapper .file-upload-area.has-file:hover {
    border-color: var(--success);
    background-color: rgba(40, 167, 69, 0.1);
}

/* Hide input icons for file upload fields */
.input-wrapper.file-upload .input-icon {
    display: none;
}

/* Remove left padding from file upload areas */
.input-wrapper .file-upload-area {
    padding-left: 25px;
}

/* Form sections */
.form-section {
    padding: 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.form-section:last-child {
    border-bottom: none;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.section-icon {
    width: 50px;
    height: 50px;
    background: var(--primary);
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: 1.3rem;
}

.section-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.section-header p {
    font-size: 0.95rem;
    color: var(--gray);
    margin: 5px 0 0;
}

.section-content {
    flex: 1;
}

/* Select element styles */
select.form-control {
    background-color: var(--input-bg, var(--bg-primary));
    color: var(--input-color, var(--text-primary));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Disabled state */
.form-control:disabled,
.form-control[readonly] {
    background-color: var(--bg-tertiary);
    opacity: 0.7;
    cursor: not-allowed;
}

/* Mobile Form Adjustments */
@media (max-width: 992px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
}

@media (max-width: 768px) {
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2_5);
    }

    .container-header {
        padding: var(--space-8) var(--space-5) var(--space-5);
    }

    .container-content {
        padding: 0 var(--space-5) var(--space-8);
    }

    .form-section {
        padding: var(--space-5);
    }

    /* Enhanced form mobile adjustments */
    .input-wrapper .form-control,
    .form-control {
        padding: var(--space-2_5) var(--space-3);
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .password-toggle {
        right: var(--space-3);
        top: 50%;
        transform: translateY(-50%);
        font-size: var(--text-sm);
    }

    /* Password toggle for forms with visible labels on mobile */
    .input-wrapper:has(label:not(.sr-only)) .password-toggle {
        top: 48px;
        transform: none;
    }

    .section-header {
        flex-direction: column;
        text-align: center;
        gap: var(--space-2_5);
    }

    .section-icon {
        margin: 0 auto;
    }
}