/* =====================================================================
   RDF FORMS — clean, framework-free form styles. No !important.
   "rdf-" namespace = RashidDev Form. These class names appear nowhere
   else in the codebase.

   How this wins the cascade WITHOUT !important:
     - Every selector is a single class (specificity 0,0,1,0).
     - That naturally beats raw "input { ... }" (specificity 0,0,0,1).
     - This file is loaded via <link> in public/index.html BEFORE
       the React bundle injects component CSS, so even on ties the
       file that loads LATER wins — and that's the bundle's job for
       per-component visual tweaks, not for fighting input styling.
     - No other file in the codebase styles raw input/textarea/select
       tags at the root level anymore. The override war is over.

   USAGE in React:
     <form className="rdf-form" noValidate>
       <div className="rdf-group">
         <label className="rdf-label" htmlFor="name">Full name</label>
         <input id="name" type="text" className="rdf-input" />
       </div>
       <button type="submit" className="rdf-button">Send</button>
     </form>
   ===================================================================== */


/* ---------- Design tokens ---------- */
:root {
  --rdf-text:           #0f172a;
  --rdf-label:          #1e293b;
  --rdf-hint:           #64748b;
  --rdf-placeholder:    #94a3b8;
  --rdf-bg:             #ffffff;
  --rdf-bg-hover:       #fbfcfe;
  --rdf-bg-disabled:    #f1f5f9;
  --rdf-border:         #cbd2db;
  --rdf-border-hover:   #94a3b8;
  --rdf-border-focus:   #4f46e5;
  --rdf-ring:           rgba(79, 70, 229, 0.18);
  --rdf-shadow:         0 1px 2px rgba(15, 23, 42, 0.04);
  --rdf-shadow-hover:   0 2px 6px rgba(15, 23, 42, 0.06);
  --rdf-radius:         8px;
  --rdf-pad-y:          12px;
  --rdf-pad-x:          14px;
  --rdf-font-size:      15px;
  --rdf-error-text:     #b91c1c;
  --rdf-error-border:   #fca5a5;
  --rdf-error-ring:     rgba(220, 38, 38, 0.18);
  --rdf-error-bg:       #fef2f2;
  --rdf-primary:        #4f46e5;
  --rdf-primary-hover:  #4338ca;
}

.dark-mode,
.dark,
.rdf-dark {
  --rdf-text:           #f1f5f9;
  --rdf-label:          #f8fafc;
  --rdf-hint:           #94a3b8;
  --rdf-placeholder:    #94a3b8;
  --rdf-bg:             #1e293b;
  --rdf-bg-hover:       #25324a;
  --rdf-bg-disabled:    #0f172a;
  --rdf-border:         #475569;
  --rdf-border-hover:   #64748b;
  --rdf-border-focus:   #818cf8;
  --rdf-ring:           rgba(129, 140, 248, 0.28);
  --rdf-shadow:         0 1px 2px rgba(0, 0, 0, 0.35);
  --rdf-shadow-hover:   0 2px 8px rgba(0, 0, 0, 0.45);
  --rdf-error-text:     #fca5a5;
  --rdf-error-border:   #b91c1c;
  --rdf-error-bg:       rgba(185, 28, 28, 0.15);
}


/* ---------- Form container ---------- */
.rdf-form {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  color: var(--rdf-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
}


/* ---------- Field group ---------- */
.rdf-group {
  display: block;
  width: 100%;
  margin: 0 0 18px 0;
  padding: 0;
  box-sizing: border-box;
  text-align: left;
}


/* ---------- Label ---------- */
.rdf-label {
  display: block;
  width: 100%;
  margin: 0 0 6px 0;
  padding: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  color: var(--rdf-label);
}

.rdf-required {
  color: #ef4444;
  margin-left: 3px;
  font-weight: 700;
}


/* ---------- Input / textarea / select ---------- */
.rdf-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: var(--rdf-pad-y) var(--rdf-pad-x);

  font-family: inherit;
  font-size: var(--rdf-font-size);
  line-height: 1.5;
  color: var(--rdf-text);

  background-color: var(--rdf-bg);
  background-image: none;
  background-clip: padding-box;
  border: 1px solid var(--rdf-border);
  border-radius: var(--rdf-radius);
  box-shadow: var(--rdf-shadow);
  outline: 0;

  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease;
}

.rdf-input::placeholder {
  color: var(--rdf-placeholder);
  opacity: 1;
}

.rdf-input:hover:not(:disabled):not(:focus) {
  background-color: var(--rdf-bg-hover);
  border-color: var(--rdf-border-hover);
  box-shadow: var(--rdf-shadow-hover);
}

.rdf-input:focus,
.rdf-input:focus-visible {
  border-color: var(--rdf-border-focus);
  box-shadow: 0 0 0 4px var(--rdf-ring), var(--rdf-shadow-hover);
  background-color: var(--rdf-bg);
}

.rdf-input:disabled {
  background-color: var(--rdf-bg-disabled);
  color: var(--rdf-hint);
  cursor: not-allowed;
  opacity: 0.9;
  box-shadow: none;
}

/* Textarea sizing helper */
.rdf-input.rdf-textarea,
.rdf-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.55;
}

/* Native <select> chevron after we kill the OS-default appearance */
select.rdf-input {
  padding-right: 38px;
  background-image:
    linear-gradient(45deg,  transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 13px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* Autofill */
.rdf-input:-webkit-autofill {
  -webkit-text-fill-color: var(--rdf-text);
  -webkit-box-shadow: 0 0 0 1000px var(--rdf-bg) inset;
  caret-color: var(--rdf-text);
  border-color: var(--rdf-border);
}

/* Invalid state */
.rdf-input[aria-invalid="true"],
.rdf-input--error {
  border-color: var(--rdf-error-border);
  box-shadow: 0 0 0 4px var(--rdf-error-ring);
  color: var(--rdf-error-text);
  background-color: var(--rdf-bg);
}


/* ---------- Pill-shaped search variant ---------- */
.rdf-search {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 10px 38px 10px 16px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--rdf-text);
  background-color: var(--rdf-bg);
  border: 1px solid var(--rdf-border);
  border-radius: 999px;
  box-shadow: var(--rdf-shadow);
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}
.rdf-search::placeholder { color: var(--rdf-placeholder); opacity: 1; }
.rdf-search:hover:not(:focus):not(:disabled) {
  border-color: var(--rdf-border-hover);
}
.rdf-search:focus {
  border-color: var(--rdf-border-focus);
  box-shadow: 0 0 0 4px var(--rdf-ring);
}


/* ---------- Hint + per-field error ---------- */
.rdf-hint,
.rdf-error {
  display: block;
  width: 100%;
  margin: 6px 0 0;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: left;
}
.rdf-hint  { color: var(--rdf-hint); }
.rdf-error { color: var(--rdf-error-text); }


/* ---------- Form-level error banner ---------- */
.rdf-banner-error {
  display: block;
  width: 100%;
  margin: 0 0 14px 0;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--rdf-error-text);
  background-color: var(--rdf-error-bg);
  border: 1px solid var(--rdf-error-border);
  border-radius: var(--rdf-radius);
  text-align: left;
}


/* ---------- Submit / primary button ---------- */
.rdf-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin: 4px 0 0 0;
  padding: 11px 24px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  color: #ffffff;
  background-color: var(--rdf-primary);
  background-image: none;
  border: 0;
  border-radius: var(--rdf-radius);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.25);
  outline: 0;
  text-decoration: none;
  transition:
    background-color 0.16s ease,
    transform 0.06s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.rdf-button:hover:not(:disabled) {
  background-color: var(--rdf-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.40);
}
.rdf-button:active:not(:disabled) { transform: translateY(0); }
.rdf-button:focus-visible {
  outline: 3px solid var(--rdf-ring);
  outline-offset: 2px;
}
.rdf-button:disabled {
  opacity: 0.65;
  cursor: progress;
  box-shadow: none;
  transform: none;
}

.rdf-button--ghost {
  background-color: transparent;
  color: var(--rdf-label);
  border: 1px solid var(--rdf-border);
  box-shadow: none;
}
.rdf-button--ghost:hover:not(:disabled) {
  background-color: var(--rdf-bg-hover);
  border-color: var(--rdf-border-hover);
  transform: none;
}


/* ---------- Two-column row helper ---------- */
.rdf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0 0 4px 0;
}
@media (max-width: 640px) {
  .rdf-row { grid-template-columns: 1fr; }
}
.rdf-row > .rdf-group { margin-bottom: 14px; }


/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .rdf-input,
  .rdf-search,
  .rdf-button { transition: none; }
}
