/**
 * FORM COMPONENT - Simplified & Corrected
 * Based on reference: UI-modernization_documents/financial_dashboard
 * Date: November 12, 2025 - 7:25 PM
 */

/* ==========================================================================
   FORM GROUP
   ========================================================================== */

.ds-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.ds-form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.ds-form-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.ds-form-error {
  font-size: 0.8rem;
  color: var(--accent-red);
}

/* ==========================================================================
   TEXT INPUTS
   ========================================================================== */

.ds-form-input,
.ds-form-select,
.ds-form-textarea {
  width: 100%;
  background-color: var(--bg-secondary);
  border: 1.5px solid var(--border-color); /* Increased to 1.5px for better visibility */
  color: var(--text-primary);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.ds-form-input:focus,
.ds-form-select:focus,
.ds-form-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(52, 86, 139, 0.1);
}

[data-theme="imperial-gold"] .ds-form-input:focus,
[data-theme="imperial-gold"] .ds-form-select:focus,
[data-theme="imperial-gold"] .ds-form-textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(232, 197, 71, 0.1);
}

.ds-form-input::placeholder,
.ds-form-textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

/* ==========================================================================
   SELECT
   ========================================================================== */

.ds-form-select {
  cursor: pointer;
  appearance: none;
  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='%236C757D' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 3rem;
}

/* ==========================================================================
   TEXTAREA
   ========================================================================== */

.ds-form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* ==========================================================================
   CHECKBOX & RADIO
   ========================================================================== */

.ds-form-checkbox,
.ds-form-radio {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.ds-form-checkbox input[type="checkbox"],
.ds-form-radio input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-blue);
}

/* ==========================================================================
   DISABLED STATE
   ========================================================================== */

.ds-form-input:disabled,
.ds-form-select:disabled,
.ds-form-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================================================
   ERROR STATE
   ========================================================================== */

.ds-form-input--error,
.ds-form-select--error,
.ds-form-textarea--error {
  border-color: var(--accent-red);
}

.ds-form-input--error:focus,
.ds-form-select--error:focus,
.ds-form-textarea--error:focus {
  box-shadow: 0 0 0 3px rgba(217, 37, 37, 0.1);
}

/* ==========================================================================
   SUCCESS STATE
   ========================================================================== */

.ds-form-input--success,
.ds-form-select--success,
.ds-form-textarea--success {
  border-color: var(--accent-green);
}

.ds-form-input--success:focus,
.ds-form-select--success:focus,
.ds-form-textarea--success:focus {
  box-shadow: 0 0 0 3px rgba(30, 132, 73, 0.1);
}

/* ==========================================================================
   INPUT WITH ICON
   ========================================================================== */

.ds-form-input-wrapper {
  position: relative;
}

.ds-form-input-wrapper .ds-form-input {
  padding-left: 3rem;
}

.ds-form-input-wrapper i,
.ds-form-input-wrapper svg {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}
