/* ============================================================
   Black Spend – Frontend Form Styles  v1.0.8
   ============================================================ */

/* ── Container ────────────────────────────────────────────── */
.bs-form-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 28px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.09);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

.bs-form-title {
    margin: 0 0 26px;
    font-size: 1.5rem;
    color: #1f3464;
    border-bottom: 3px solid #1f3464;
    padding-bottom: 12px;
}

/* ── Form rows ────────────────────────────────────────────── */
.bs-form-row { margin-bottom: 20px; }

.bs-form-row-half { display: flex; gap: 16px; }
.bs-form-row-half .bs-form-field { flex: 1; min-width: 0; }

/* ── Labels ───────────────────────────────────────────────── */
.bs-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #222;
}
.bs-label .required { color: #c0392b; margin-left: 2px; }

/* ── Inputs & selects ─────────────────────────────────────── */
.bs-input,
.bs-select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #ccd0d4;
    border-radius: 6px;
    color: #222;
    background: #fafafa;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    font-size: 16px; /* prevent iOS zoom */
}
.bs-input:focus,
.bs-select:focus {
    outline: none;
    border-color: #1f3464;
    box-shadow: 0 0 0 3px rgba(31,52,100,0.13);
    background: #fff;
}

/* ══════════════════════════════════════════════════════════
   ACCORDION — Add New Business
   max-height transition keeps elements in the paint tree at
   all times, so touch events are initialized on page load.
   This is the only reliable cross-browser mobile technique.
══════════════════════════════════════════════════════════ */

.bs-accordion {
    margin-top: 10px;
    border: 1.5px solid #c5d0ef;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

/* Trigger / header bar */
.bs-accordion-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    background: #f0f4ff;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f3464;
    text-align: left;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
    transition: background 0.18s;
    box-sizing: border-box;
}
.bs-accordion-trigger:hover,
.bs-accordion-trigger.is-open { background: #e4eaff; }

.bs-accordion-label { flex: 1; }

.bs-accordion-chevron {
    font-size: 0.7rem;
    color: #1f3464;
    transition: transform 0.28s ease;
    flex-shrink: 0;
    margin-left: 8px;
}
.bs-accordion-trigger.is-open .bs-accordion-chevron {
    transform: rotate(-180deg);
}

/* Body — the key: max-height:0 not display:none */
.bs-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.32s ease;
}

/* Default open state — set via PHP on page render */
.bs-accordion-body.bs-accordion-open {
    max-height: 600px;
}

.bs-accordion-inner {
    padding: 18px 16px 16px;
    background: #f8f9ff;
    border-top: 1.5px solid #c5d0ef;
}

/* Pill ownership toggles */
.bs-toggle-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.bs-toggle-label { position: relative; cursor: pointer; }
.bs-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.bs-toggle-pill {
    display: inline-block;
    padding: 10px 16px;
    border: 2px solid #c5d0ef;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #444;
    background: #fff;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    user-select: none;
    touch-action: manipulation;
    min-height: 44px;
    line-height: 22px;
    box-sizing: border-box;
}
.bs-toggle-input:checked + .bs-toggle-pill {
    border-color: #1f3464;
    background: #1f3464;
    color: #fff;
}

/* Inline error inside accordion */
.bs-accordion-error {
    display: none;
    margin-top: 10px;
    padding: 10px 14px;
    background: #fdedec;
    border: 1px solid #f1948a;
    border-radius: 6px;
    color: #922b21;
    font-size: 0.9rem;
}

/* Action buttons row inside accordion */
.bs-accordion-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* ── Generic buttons ──────────────────────────────────────── */
.bs-btn {
    flex: 1;
    padding: 13px 16px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
    transition: background 0.18s, opacity 0.18s;
    text-align: center;
}
.bs-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.bs-btn-primary   { background: #1f3464; color: #fff; }
.bs-btn-primary:hover  { background: #16275a; }
.bs-btn-primary:active { background: #0f1e47; }
.bs-btn-secondary { background: #e8ecf4; color: #1f3464; }
.bs-btn-secondary:hover { background: #d5ddf0; }

/* ── Checkboxes (main spend form) ─────────────────────────── */
.bs-checkbox-group {
    display: flex; gap: 18px; flex-wrap: wrap; margin-top: 4px;
}
.bs-checkbox-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.95rem; color: #333; cursor: pointer; min-height: 44px;
}
.bs-checkbox-label input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: #1f3464; cursor: pointer; flex-shrink: 0;
}

/* ── Submit button ────────────────────────────────────────── */
.bs-submit-button {
    width: 100%;
    padding: 15px;
    background: #1f3464;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s;
    min-height: 52px;
}
.bs-submit-button:hover  { background: #16275a; }
.bs-submit-button:active { background: #0f1e47; }
.bs-submit-button:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Receipt dropzone ─────────────────────────────────────── */
.bs-dropzone {
    border: 2px dashed #c5d0ef; border-radius: 8px;
    padding: 28px 20px; text-align: center;
    background: #f8f9ff; cursor: pointer;
    transition: border-color 0.18s, background 0.18s; position: relative;
}
.bs-dropzone:hover, .bs-dropzone.dragover { border-color: #1f3464; background: #eef1fa; }
.bs-file-input-hidden {
    position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.bs-dropzone-content { display: block; cursor: pointer; }
.bs-dropzone-icon    { font-size: 2.2rem; }
.bs-dropzone-content p { margin: 6px 0 0; font-size: 0.9rem; color: #555; }
.bs-dropzone-hint { font-size: 0.78rem !important; color: #999 !important; }
.bs-dropzone-preview { position: relative; display: inline-block; }
.bs-dropzone-preview img {
    max-width: 200px; max-height: 150px;
    border-radius: 4px; border: 1px solid #ccc;
}
.bs-remove-preview {
    position: absolute; top: -8px; right: -8px;
    background: #c0392b; color: #fff; border: none;
    border-radius: 50%; width: 26px; height: 26px;
    font-size: 15px; line-height: 26px; text-align: center;
    cursor: pointer; touch-action: manipulation; padding: 0;
}

/* ── Form messages ────────────────────────────────────────── */
.bs-messages { margin-top: 16px; font-size: 0.95rem; }
.bs-messages.bs-success {
    padding: 14px 16px; background: #eafaf1;
    border: 1px solid #a9dfbf; border-radius: 6px; color: #1e8449;
}
.bs-messages.bs-error {
    padding: 14px 16px; background: #fdedec;
    border: 1px solid #f1948a; border-radius: 6px; color: #922b21;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 600px) {
    .bs-form-container { padding: 18px 16px; border-radius: 6px; box-shadow: none; }
    .bs-form-row-half  { flex-direction: column; gap: 0; }
    .bs-checkbox-group { gap: 12px; }
    .bs-accordion-actions { flex-direction: column; }
    .bs-toggle-group { gap: 8px; }
}
