/* Form Styles with Dark Mode Support */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-primary);
}

input, select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 16px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.3s, background-color 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--input-focus);
}

/* Dark mode specific form adjustments */
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-secondary);
}

/* Select2 Overrides for Dark Mode */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    height: 38px;
    line-height: 38px;
    padding: 0;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 12px !important;
    padding-right: 20px !important;
    line-height: 36px;
}

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

.select2-dropdown {
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 4px 4px;
    background: white;
    z-index: 9999;
}

/* Fix Select2 search field */
.select2-search--dropdown .select2-search__field {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    outline: none;
}

/* Fix Select2 results */
.select2-results__options {
    max-height: 300px;
    overflow-y: auto;
}

.select2-results__option {
    padding: 8px 12px;
    cursor: pointer;
}

.select2-results__option--highlighted {
    background-color: #10b981;
    color: white;
}

.select2-results__option--selected {
    background-color: #f3f4f6;
}

.select2-results__group {
    padding: 6px 12px;
    font-weight: 600;
    color: #6b7280;
    background-color: #f9fafb;
}

[data-theme="dark"] .select2-container--default .select2-selection--single {
    background-color: var(--input-bg);
    border-color: var(--input-border);
}

[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary);
}

[data-theme="dark"] .select2-dropdown {
    background-color: var(--bg-secondary);
    border-color: var(--input-border);
}

[data-theme="dark"] .select2-results__option {
    color: var(--text-primary);
}

[data-theme="dark"] .select2-results__option--highlighted[aria-selected] {
    background-color: var(--accent-color);
}

/* Radio Groups */
.radio-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.radio-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
}

.radio-group input[type="radio"] {
    width: auto;
    margin-right: 5px;
}

/* Date Groups */
.date-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

/* File Upload */
.file-upload {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: block;
    padding: 10px;
    background: var(--input-bg);
    border: 2px dashed var(--input-border);
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-primary);
}

.file-upload-label:hover {
    background: var(--bg-primary);
    border-color: var(--accent-color);
}

/* AI Fill Button */
button.ai-fill {
    background: #4a90e2;
    font-size: 14px;
    padding: 6px 12px;
    margin-left: 10px;
}

button.ai-fill:hover {
    background: #357abd;
}

/* Responsive Forms */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Settings Form Sections */
.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

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

.form-section h3 {
    margin: 0 0 15px 0;
    color: var(--accent-color);
}
