/*
 * forms.css — Consistent styling for Django-rendered form widgets.
 *
 * Django's {{ field }} template tag outputs bare <input>, <select>, and
 * <textarea> elements with NO class attribute. This stylesheet uses
 * :not([class]) to target only those unstyled widgets, leaving hand-
 * styled elements (with inline Tailwind classes) completely untouched.
 *
 * The visual language matches allauth field.html, bulk_upload.html,
 * and company_members.html — all of which use the same border-gray-300,
 * rounded-md, focus:ring-blue-500 pattern.
 */

/* ------------------------------------------------------------------ */
/*  Text inputs, email, password, url, number, search, tel, date      */
/* ------------------------------------------------------------------ */

form input:not([class])[type="text"],
form input:not([class])[type="email"],
form input:not([class])[type="password"],
form input:not([class])[type="url"],
form input:not([class])[type="number"],
form input:not([class])[type="search"],
form input:not([class])[type="tel"],
form input:not([class])[type="date"],
form input:not([class])[type="datetime-local"] {
    width: 100%;
    border-radius: 0.375rem;       /* rounded-md */
    border: 1px solid #d1d5db;     /* border-gray-300 */
    padding: 0.5rem 0.75rem;       /* px-3 py-2 */
    font-size: 0.875rem;           /* text-sm */
    line-height: 1.25rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);  /* shadow-sm */
    background-color: #fff;
    color: #111827;                 /* text-gray-900 */
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

form input:not([class])[type="text"]:focus,
form input:not([class])[type="email"]:focus,
form input:not([class])[type="password"]:focus,
form input:not([class])[type="url"]:focus,
form input:not([class])[type="number"]:focus,
form input:not([class])[type="search"]:focus,
form input:not([class])[type="tel"]:focus,
form input:not([class])[type="date"]:focus,
form input:not([class])[type="datetime-local"]:focus {
    border-color: #3b82f6;         /* border-blue-500 */
    box-shadow: 0 0 0 1px #3b82f6; /* ring-1 ring-blue-500 */
}

/* Placeholder text — applies broadly (element selectors are low specificity) */
form input::placeholder,
form textarea::placeholder {
    color: #9ca3af;                /* text-gray-400 */
}

/* ------------------------------------------------------------------ */
/*  Textarea                                                           */
/* ------------------------------------------------------------------ */

form textarea:not([class]) {
    width: 100%;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    background-color: #fff;
    color: #111827;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    resize: vertical;
}

form textarea:not([class]):focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

/* ------------------------------------------------------------------ */
/*  Select                                                             */
/* ------------------------------------------------------------------ */

form select:not([class]) {
    width: 100%;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    padding-right: 2rem;            /* room for the dropdown arrow */
    font-size: 0.875rem;
    line-height: 1.25rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    background-color: #fff;
    color: #111827;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: auto;               /* preserve native dropdown arrow */
}

form select:not([class]):focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

/* Multiple-select lists */
form select:not([class])[multiple] {
    padding-right: 0.75rem;
    min-height: 6rem;
}

/* ------------------------------------------------------------------ */
/*  File inputs                                                        */
/* ------------------------------------------------------------------ */

form input:not([class])[type="file"] {
    width: 100%;
    font-size: 0.875rem;
    color: #4b5563;                /* text-gray-600 */
}

form input:not([class])[type="file"]::file-selector-button {
    margin-right: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: #eff6ff;     /* bg-blue-50 */
    color: #1d4ed8;                /* text-blue-700 */
    cursor: pointer;
    transition: background-color 0.15s;
}

form input:not([class])[type="file"]::file-selector-button:hover {
    background-color: #dbeafe;     /* bg-blue-100 */
}

/* ------------------------------------------------------------------ */
/*  Checkboxes and radios                                              */
/* ------------------------------------------------------------------ */

form input:not([class])[type="checkbox"],
form input:not([class])[type="radio"] {
    height: 1rem;
    width: 1rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
    color: #2563eb;
    cursor: pointer;
}

form input:not([class])[type="radio"] {
    border-radius: 50%;
}

form input:not([class])[type="checkbox"]:focus,
form input:not([class])[type="radio"]:focus {
    box-shadow: 0 0 0 2px #3b82f6;
    outline: none;
}

/* ------------------------------------------------------------------ */
/*  Disabled & read-only states                                        */
/* ------------------------------------------------------------------ */

form input:not([class]):disabled,
form select:not([class]):disabled,
form textarea:not([class]):disabled {
    background-color: #f9fafb;     /* bg-gray-50 */
    color: #6b7280;                /* text-gray-500 */
    cursor: not-allowed;
}

form input:not([class]):read-only:not([type="file"]),
form textarea:not([class]):read-only {
    background-color: #f9fafb;
    color: #6b7280;
}
