/* ============================================================
   ComPilot — CoreSG Form Pattern
   Pattern: csg-field / csg-field--error / csg-field--success
   Source: https://spdataforge.com/coresg/forms-inputs
   ============================================================ */

/* ---- Field container ---- */
.csg-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ---- Label ---- */
.csg-field__label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    line-height: 1.4;
}

/* Required asterisk — appended via CSS, no HTML change needed */
.csg-field__label--required::after {
    content: " *";
    color: #dc3545;
    font-weight: 600;
}

/* ---- Input base ---- */
.csg-input {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.5;
    color: #111827;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.csg-input:focus {
    border-color: #1a3264;
    box-shadow: 0 0 0 3px rgba(26, 50, 100, 0.12);
}

.csg-input::placeholder {
    color: #9ca3af;
    font-size: 0.8125rem;
}

/* ---- Error state ---- */
.csg-field--error .csg-input {
    border-color: #dc3545;
    background: #fff8f8;
}

.csg-field--error .csg-input:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12);
}

.csg-field__error {
    font-size: 0.75rem;
    color: #dc3545;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.csg-field__error::before {
    content: "⚠";
    font-size: 0.7rem;
}

/* ---- Success state ---- */
.csg-field--success .csg-input {
    border-color: #198754;
    background: #f8fff9;
}

.csg-field--success .csg-input:focus {
    border-color: #198754;
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.12);
}

/* ---- Hint text ---- */
.csg-field__hint {
    font-size: 0.75rem;
    color: #6b7280;
}

/* ---- Select ---- */
.csg-select {
    display: block;
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: #111827;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    appearance: none;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.csg-select:focus {
    border-color: #1a3264;
    box-shadow: 0 0 0 3px rgba(26, 50, 100, 0.12);
}

.csg-field--error .csg-select {
    border-color: #dc3545;
    background-color: #fff8f8;
}

/* ---- Textarea ---- */
.csg-textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.6;
    color: #111827;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.csg-textarea:focus {
    border-color: #1a3264;
    box-shadow: 0 0 0 3px rgba(26, 50, 100, 0.12);
}

.csg-field--error .csg-textarea {
    border-color: #dc3545;
    background: #fff8f8;
}
