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

/* ── 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;
    font-size: 1rem;
    color: #222;
    background: #fafafa;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    /* Prevent iOS zoom on focus (font-size >= 16px) */
    font-size: 16px;
}
.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;
}

/* ── "Add New Business" option styling hint ───────────────── */
/* The ➕ option sits at the bottom of the native select —
   no extra CSS needed; the emoji acts as a visual separator. */

/* ── Checkboxes (main 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; }

/* ── Generic buttons ──────────────────────────────────────── */
.bs-btn {
    padding: 13px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.18s, opacity 0.18s;
    min-height: 48px;
}
.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; }
.bs-btn-full { width: 100%; display: block; text-align: center; }

/* ── 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;
}

/* ── 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;
}

/* ══════════════════════════════════════════════════════════
   MODAL — Add New Business
   Lives in <body> space, completely outside the <form>.
   This is the correct mobile-safe pattern.
══════════════════════════════════════════════════════════ */

.bs-modal-overlay {
    display: none;               /* hidden by default */
    position: fixed;
    inset: 0;                    /* top/right/bottom/left: 0 */
    background: rgba(0,0,0,0.55);
    z-index: 999999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 16px;
    box-sizing: border-box;
    align-items: flex-start;
    justify-content: center;
}

/* Use flex when open so the modal card is centred */
.bs-modal-overlay.bs-modal-open {
    display: flex;
}

.bs-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    margin: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    overflow: hidden;
    /* Animate in */
    animation: bsModalIn 0.22s ease-out;
}

@keyframes bsModalIn {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.bs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #e8ecf4;
    background: #1f3464;
}
.bs-modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
}
.bs-modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s;
}
.bs-modal-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

.bs-modal-body {
    padding: 22px 20px 8px;
}

/* Pill-style toggle checkboxes inside modal */
.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;
}
.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: #f4f6fc;
    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;
}

.bs-modal-error {
    margin-top: 10px;
    padding: 10px 14px;
    background: #fdedec;
    border: 1px solid #f1948a;
    border-radius: 6px;
    color: #922b21;
    font-size: 0.9rem;
}

.bs-modal-footer {
    padding: 14px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid #e8ecf4;
    background: #f9fafc;
}

/* ── 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; }

    /* Modal fills screen on small phones */
    .bs-modal-overlay { padding: 0; align-items: flex-end; }
    .bs-modal {
        border-radius: 16px 16px 0 0;
        max-width: 100%;
        width: 100%;
        margin: 0;
        /* Slide up from bottom on mobile */
        animation: bsModalUp 0.25s ease-out;
    }
    @keyframes bsModalUp {
        from { opacity: 0; transform: translateY(100%); }
        to   { opacity: 1; transform: translateY(0); }
    }
}
