/* ============================================================
   BFk Forms — shared form styling used by admin, customer, partner, team
   Loaded after each theme's main CSS so it can override defaults.
   ============================================================ */

/* === Field wrapper === */
.field-app,
.field {
    display: flex; flex-direction: column;
    gap: 5px;
    margin-bottom: 0;
    position: relative;
}

/* === Labels === */
.field-app label,
.field label {
    font-size: 12px; font-weight: 700;
    color: #111;
    text-transform: uppercase; letter-spacing: 0.05em;
    display: flex; align-items: center; gap: 6px;
    margin: 0;
}
.field-app label .req,
.field label .req {
    color: #ef4444; font-weight: 800; margin-left: 1px;
}
.field-app label .optional,
.field label .optional {
    font-weight: 500; color: #94a3b8;
    text-transform: none; letter-spacing: 0;
    margin-left: 4px; font-size: 11px;
}

/* === Inputs / textarea / select (inside .field-app or .field or app-form) === */
.field-app input,
.field-app select,
.field-app textarea,
.field input,
.field select,
.field textarea,
.app-form input,
.app-form select,
.app-form textarea,
form.bfk-form input,
form.bfk-form select,
form.bfk-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e5ec;
    border-radius: 12px;
    font-size: 14.5px;
    background: #f5f7fa;
    color: #111;
    font-family: inherit;
    font-weight: 500;
    transition: background .15s, border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
    line-height: 1.4;
}
.field-app input:hover,
.field-app select:hover,
.field-app textarea:hover,
.field input:hover,
.field select:hover,
.field textarea:hover,
.app-form input:hover,
.app-form select:hover,
.app-form textarea:hover {
    border-color: #c7ccd6;
}
.field-app input:focus,
.field-app select:focus,
.field-app textarea:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.app-form input:focus,
.app-form select:focus,
.app-form textarea:focus {
    outline: 0;
    background: #fff;
    border-color: #ff4a1c;
    box-shadow: 0 0 0 4px rgba(255, 74, 28, 0.12);
}
.field-app textarea,
.field textarea,
.app-form textarea { resize: vertical; min-height: 80px; }

/* Number inputs — tabular */
.field-app input[type="number"],
.field input[type="number"],
.app-form input[type="number"] { font-variant-numeric: tabular-nums; font-weight: 600; }

/* File inputs — dashed */
.field-app input[type="file"],
.field input[type="file"],
.app-form input[type="file"] {
    padding: 10px; border-style: dashed;
    background: #f5f7fa;
    cursor: pointer;
}
.field-app input[type="file"]:hover,
.field input[type="file"]:hover,
.app-form input[type="file"]:hover {
    border-color: #ff4a1c; background: #fff7f3;
}

/* Select chevron */
.field-app select,
.field select,
.app-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23686e7a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 40px;
    cursor: pointer;
}

/* Disabled */
.field-app input:disabled,
.field-app select:disabled,
.field-app textarea:disabled,
.field input:disabled,
.field select:disabled,
.field textarea:disabled {
    background: #f5f7fa; opacity: .65; cursor: not-allowed;
}

/* Placeholders */
.field-app input::placeholder,
.field-app textarea::placeholder,
.field input::placeholder,
.field textarea::placeholder,
.app-form input::placeholder,
.app-form textarea::placeholder {
    color: #aab0bc; font-weight: 400;
}

/* === Hint text under fields === */
.fa-hint,
.field .hint {
    font-size: 11.5px;
    color: #94a3b8;
    margin-top: 2px;
    line-height: 1.4;
    display: block;
}

/* Error state */
.field-app.is-error input,
.field-app.is-error select,
.field-app.is-error textarea,
.field.is-error input,
.field.is-error select,
.field.is-error textarea { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12); background: #fff5f5; }
.field-error-msg { color: #c0392b; font-size: 11.5px; font-weight: 600; margin-top: 4px; }

/* === Grids === */
.field-app-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.field-app-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}
@media (max-width: 520px) {
    .field-app-grid, .field-app-grid-3 { grid-template-columns: 1fr; }
}

/* === Phone prefix wrapper === */
.phone-wrap {
    display: flex; align-items: stretch;
    border: 1px solid #e2e5ec;
    border-radius: 12px;
    background: #f5f7fa;
    overflow: hidden;
    transition: all .15s;
}
.phone-wrap:focus-within {
    background: #fff;
    border-color: #ff4a1c;
    box-shadow: 0 0 0 4px rgba(255, 74, 28, 0.12);
}
.phone-wrap .phone-prefix {
    padding: 12px 12px;
    font-size: 14.5px; font-weight: 700;
    color: #475569;
    border-right: 1px solid #e2e5ec;
    background: #eef0f4;
    display: flex; align-items: center;
}
.phone-wrap input {
    flex: 1; border: 0 !important; background: transparent !important;
    border-radius: 0 !important; box-shadow: none !important;
    padding: 12px 14px;
}

/* === Password wrapper (Show / Hide) === */
.pwd-wrap {
    position: relative;
    display: flex; align-items: center;
}
.pwd-wrap input { padding-right: 64px !important; }
.pwd-toggle {
    position: absolute; right: 8px;
    background: transparent; border: 0;
    font-size: 11.5px; font-weight: 700;
    color: #ff4a1c;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: background .15s;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pwd-toggle:hover { background: rgba(255, 74, 28, 0.08); }

/* === Checkbox / Radio (app style) === */
.checkbox-app,
.app-check {
    display: flex; gap: 10px; align-items: flex-start;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    font-weight: 500;
}
.checkbox-app input,
.app-check input {
    accent-color: #ff4a1c;
    width: 18px; height: 18px;
    margin-top: 1px;
    flex-shrink: 0;
}
.checkbox-app-block,
.app-check-block {
    padding: 14px; background: #f5f7fa;
    border-radius: 12px;
    border: 1px solid #e2e5ec;
}
.app-check a { color: #ff4a1c; text-decoration: none; font-weight: 600; }

/* === Toggle switch (pill-toggle) === */
.pill-toggle {
    display: inline-flex; align-items: center; gap: 10px;
    cursor: pointer; user-select: none;
}
.pill-toggle .sw {
    width: 42px; height: 24px; border-radius: 999px;
    position: relative;
    background: #cbd5e1;
    transition: background .2s;
}
.pill-toggle .sw::after {
    content: '';
    position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #fff;
    transition: left .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.pill-toggle input { display: none; }
.pill-toggle input:checked ~ .sw { background: #16a34a; }
.pill-toggle input:checked ~ .sw::after { left: 20px; }
.pill-toggle .lbl { font-size: 13px; font-weight: 600; color: #111; }
.pill-toggle:hover .sw { box-shadow: 0 0 0 3px rgba(0,0,0,0.04); }

/* === Form section header (with icon) === */
.form-section {
    margin: 22px 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #e2e5ec;
    display: flex; align-items: center; gap: 9px;
}
.form-section:first-child { margin-top: 0; }
.form-section .ic {
    width: 30px; height: 30px; border-radius: 9px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, rgba(255, 74, 28, 0.12), rgba(255, 122, 69, 0.12));
    color: #ff4a1c;
}
.form-section h4 { font-size: 14px; font-weight: 700; margin: 0; }
.form-section .sub { font-size: 12px; color: #94a3b8; margin-left: auto; }

/* === App form (login/register style) === */
.app-form {
    display: flex; flex-direction: column;
    gap: 14px;
}

/* === Buttons (form buttons) === */
.btn-app {
    display: inline-flex; align-items: center;
    justify-content: center; gap: 8px;
    padding: 14px 22px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 14.5px;
    border: 1px solid transparent;
    transition: all .2s;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    letter-spacing: -0.01em;
}
.btn-app-primary {
    background: linear-gradient(135deg, #ff4a1c, #ff7a45);
    color: #fff;
    box-shadow: 0 6px 18px rgba(255, 74, 28, 0.25);
}
.btn-app-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(255, 74, 28, 0.32);
}
.btn-app-primary:active { transform: translateY(0); }
.btn-app-outline {
    background: #fff; color: #111;
    border: 1px solid #e2e5ec;
}
.btn-app-outline:hover { border-color: #c7ccd6; background: #f5f7fa; }
.btn-app-full { width: 100%; }
.btn-app-ghost {
    background: transparent; color: #475569;
    border: 1px solid transparent;
}
.btn-app-ghost:hover { background: #f5f7fa; }
.btn-app-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.25);
}
.btn-app-danger:hover { transform: translateY(-1px); }

/* === Auth screens (login, register) === */
.auth-screen {
    padding: 0 22px 32px;
    min-height: calc(100vh - 36px);
}
.auth-hero {
    text-align: center;
    padding: 18px 0 22px;
}
.auth-logo {
    height: 72px; width: auto;
    margin: 0 auto 16px;
    filter: drop-shadow(0 8px 24px rgba(255, 74, 28, 0.25));
    animation: floatIn .6s cubic-bezier(.4, 1.4, .5, 1);
}
@keyframes floatIn {
    from { opacity: 0; transform: translateY(-12px) scale(.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-title {
    font-family: 'Playfair Display', serif;
    font-size: 28px; font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
    color: #111;
}
.auth-sub {
    font-size: 13.5px; color: #475569;
    margin: 0; line-height: 1.6;
}
.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid #e2e5ec;
}

.auth-divider {
    text-align: center;
    position: relative;
    margin: 22px 0;
    font-size: 11px;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.auth-divider::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 50%;
    height: 1px;
    background: #e2e5ec;
}
.auth-divider span {
    background: #fff;
    padding: 0 12px;
    position: relative;
}

.demo-accounts {
    margin-top: 16px;
    padding: 14px;
    background: linear-gradient(135deg, #f5f7fa, #eef0f4);
    border-radius: 12px;
    font-size: 11.5px;
    color: #475569;
    display: flex; flex-direction: column;
    gap: 4px;
    border: 1px solid #e2e5ec;
}
.demo-accounts strong {
    font-size: 11.5px;
    color: #111;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}
.demo-accounts span {
    font-family: 'SF Mono', monospace;
    font-size: 11px;
}

.app-alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
    display: flex; gap: 10px; align-items: center;
    font-size: 13px; font-weight: 600;
}
.app-alert-error {
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.app-alert .ic {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: currentColor;
    color: #fff;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 800;
    flex-shrink: 0;
}

.auth-foot {
    text-align: center;
    margin-top: 22px;
    font-size: 12px;
    color: #94a3b8;
}
.auth-foot a {
    color: #ff4a1c;
    text-decoration: none;
    font-weight: 600;
}

/* === Role toggle (login page) === */
.role-toggle-app {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: #f5f7fa;
    padding: 5px;
    border-radius: 16px;
    border: 1px solid #e2e5ec;
}
.role-toggle-app input { display: none; }
.role-toggle-app label {
    display: flex; flex-direction: column;
    align-items: center;
    gap: 4px; padding: 14px 10px;
    border-radius: 12px;
    cursor: pointer;
    background: transparent;
    transition: all .15s;
    font-size: 13px; font-weight: 600;
    color: #475569;
}
.role-toggle-app label .rt-ic { font-size: 22px; }
.role-toggle-app input:checked + label {
    background: #fff;
    color: #111;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    font-weight: 700;
}

/* === Sticky form footer (submit/cancel fixed at bottom on mobile) === */
.form-footer-sticky {
    position: sticky; bottom: 0;
    background: #fff;
    padding: 14px 0;
    margin: 24px 0 0;
    border-top: 1px solid #e2e5ec;
    display: flex; gap: 10px;
}
.form-footer-sticky .btn-app { flex: 1; }

/* === Compact form (for in-page forms) === */
.form-compact .field-app,
.form-compact .field { gap: 3px; }
.form-compact .field-app label,
.form-compact .field label { font-size: 11px; }
.form-compact .field-app input,
.form-compact .field-app select,
.form-compact .field-app textarea,
.form-compact .field input,
.form-compact .field select,
.form-compact .field textarea {
    padding: 9px 11px; font-size: 13px; border-radius: 10px;
}

/* === Inline search / filter input === */
.input-search {
    position: relative;
}
.input-search input {
    padding-left: 38px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 16px;
}

/* === OTP / short code input === */
.otp-input {
    display: flex; gap: 8px; justify-content: center;
    margin: 10px 0;
}
.otp-input input {
    width: 48px; height: 56px;
    text-align: center; font-size: 22px; font-weight: 700;
    border: 1.5px solid #e2e5ec;
    border-radius: 12px;
    background: #f5f7fa;
    transition: all .15s;
}
.otp-input input:focus {
    outline: 0; background: #fff;
    border-color: #ff4a1c;
    box-shadow: 0 0 0 3px rgba(255, 74, 28, 0.12);
}

/* === Responsive === */
@media (max-width: 520px) {
    .auth-title { font-size: 24px; }
    .auth-screen { padding: 0 16px 24px; }
    .auth-card { padding: 18px; border-radius: 18px; }
}