/* =========================================================================
   ReviewJalpi -- Control polish layer (Phase 12)
   ----------------------------------------------------------------------------
   Overrides Bootstrap 5 form-control / form-select / form-check-input / btn /
   table base styles with a tighter, Sea-Glass-tuned look. NOT a replacement
   for Bootstrap -- just sits on top so existing markup keeps working.

   Loaded after bootstrap.min.css and after site.css.
   ========================================================================= */

/* ----------------------------------------------------------------------------
 * 1. Text inputs, textareas, file inputs
 * --------------------------------------------------------------------------*/
.form-control,
.form-select {
    border: 1px solid var(--rj-border);
    border-radius: 8px;
    background-color: #fff;
    color: var(--rj-ink);
    font-size: .92rem;
    line-height: 1.45;
    padding: .55rem .8rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
    transition: border-color .15s ease,
                box-shadow   .15s ease,
                background   .15s ease;
}
.form-control:hover:not(:focus):not(:disabled):not([readonly]),
.form-select:hover:not(:focus):not(:disabled) {
    border-color: #C7CED6;                                       /* one notch darker than rest */
}
.form-control:focus,
.form-select:focus {
    border-color: var(--rj-primary);
    outline: 0;
    box-shadow: 0 0 0 4px rgba(8, 145, 178, .14);
}
.form-control::placeholder { color: #94A3B8; }
.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
    background-color: #F8FAFC;
    color: #64748B;
    cursor: not-allowed;
}

/* form-control-sm — Bootstrap's small variant, tightened. */
.form-control-sm,
.form-select-sm {
    font-size: .82rem;
    padding: .4rem .65rem;
    border-radius: 7px;
}

/* Search inputs get a magnifier glyph -- override Bootstrap's default. */
.form-control[type="search"] {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 16px;
    padding-left: 2.25rem;
}

/* File inputs -- the default is awful. */
.form-control[type="file"] { padding: .4rem .55rem; }
.form-control[type="file"]::file-selector-button {
    background: var(--rj-primary-50);
    color: var(--rj-primary-600);
    border: 1px solid rgba(8, 145, 178, .2);
    border-radius: 6px;
    padding: .3rem .7rem;
    margin-right: .65rem;
    font-weight: 600;
    font-size: .85rem;
    transition: background .15s ease;
}
.form-control[type="file"]:hover::file-selector-button {
    background: #CFFAFE;
}

/* Color picker -- shrink it and round it. */
.form-control-color {
    width: 38px;
    height: 38px;
    padding: 3px;
    border-radius: 8px;
    cursor: pointer;
}
.form-control-color.form-control-sm { width: 30px; height: 30px; }

/* Textareas -- nicer resizer + min height. */
textarea.form-control {
    min-height: 84px;
    resize: vertical;
}

/* Native select arrow -- replace with our own (smaller, cleaner). */
.form-select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-position: right .65rem center;
    background-size: 14px;
    padding-right: 2.1rem;
    appearance: none;
}

/* Multi-select <select multiple> -- when not enhanced by Choices.js,
 * make the default a little less terrible. */
.form-select[multiple],
.form-select[size]:not([size="1"]) {
    background-image: none;
    padding-right: .8rem;
}
.form-select[multiple] option,
.form-select[size]:not([size="1"]) option {
    padding: .35rem .55rem;
    border-radius: 5px;
    cursor: pointer;
}
.form-select[multiple] option:checked,
.form-select[size]:not([size="1"]) option:checked {
    background: var(--rj-primary-50);
    color: var(--rj-primary-600);
}

/* ----------------------------------------------------------------------------
 * 2. Checkboxes & radios
 * --------------------------------------------------------------------------*/
.form-check-input {
    width: 18px;
    height: 18px;
    margin-top: .15em;
    border: 1.5px solid #CBD5E1;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.form-check-input:hover:not(:disabled) {
    border-color: var(--rj-primary);
}
.form-check-input:focus {
    border-color: var(--rj-primary);
    box-shadow: 0 0 0 4px rgba(8, 145, 178, .18);
}
.form-check-input:checked {
    background-color: var(--rj-primary);
    border-color: var(--rj-primary);
}
.form-check-input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3 8.5l3 3 7-7'/></svg>");
}
.form-check-input[type="radio"]:checked {
    background-image: radial-gradient(circle at center, #fff 35%, transparent 36%);
}

/* Bootstrap switches (.form-switch) -- larger track + smooth animation */
.form-switch .form-check-input {
    width: 2.25em;
    height: 1.25em;
    border-radius: 999px;
    background-color: #E5E7EB;
    border-color: #E5E7EB;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='%23fff'/></svg>");
    transition: background-color .2s ease, background-position .2s ease;
}
.form-switch .form-check-input:checked {
    background-color: var(--rj-primary);
    border-color: var(--rj-primary);
}

.form-check-label {
    color: var(--rj-ink);
    cursor: pointer;
    user-select: none;
}

/* ----------------------------------------------------------------------------
 * 3. Buttons -- subtle press + better focus + harmonised sizing
 * --------------------------------------------------------------------------*/
.btn {
    border-radius: 8px;
    font-weight: 600;
    padding: .5rem 1rem;
    transition: transform .08s ease,
                box-shadow .15s ease,
                background .15s ease,
                border-color .15s ease,
                color .15s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.btn-sm  { padding: .35rem .7rem; font-size: .82rem; border-radius: 7px; }
.btn-lg  { padding: .7rem 1.4rem; font-size: 1rem; border-radius: 10px; }
.btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 4px rgba(8, 145, 178, .25), 0 1px 2px rgba(15, 23, 42, .04);
}
.btn:active {
    transform: translateY(1px);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .15);
}
.btn-primary {
    background: var(--rj-primary);
    border-color: var(--rj-primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08), inset 0 -1px 0 rgba(0, 0, 0, .08);
}
.btn-primary:hover {
    background: var(--rj-primary-600);
    border-color: var(--rj-primary-600);
}
.btn-outline-primary {
    color: var(--rj-primary-600);
    border-color: rgba(8, 145, 178, .35);
    background: #fff;
}
.btn-outline-primary:hover {
    background: var(--rj-primary-50);
    color: var(--rj-primary-600);
    border-color: rgba(8, 145, 178, .55);
}
.btn-outline-secondary {
    color: var(--rj-ink);
    border-color: var(--rj-border);
    background: #fff;
}
.btn-outline-secondary:hover {
    background: #F8FAFC;
    color: var(--rj-ink);
    border-color: #CBD5E1;
}
.btn-outline-danger {
    color: #B91C1C;
    border-color: rgba(239, 68, 68, .35);
    background: #fff;
}
.btn-outline-danger:hover {
    background: rgba(239, 68, 68, .08);
    color: #B91C1C;
    border-color: rgba(239, 68, 68, .55);
}

/* ----------------------------------------------------------------------------
 * 4. Tables -- hover rows, sticky head, lighter borders
 * --------------------------------------------------------------------------*/
.table {
    margin-bottom: 0;
    color: var(--rj-ink);
    border-color: var(--rj-border);
}
.table > thead > tr > th {
    background: #F8FAFC;
    color: #475569;
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .7rem .85rem;
    border-bottom: 1px solid var(--rj-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.table > tbody > tr > td {
    padding: .75rem .85rem;
    border-bottom: 1px solid var(--rj-border);
    vertical-align: middle;
    font-size: .9rem;
}
.table > tbody > tr:last-child > td { border-bottom: none; }
.table-hover > tbody > tr:hover > td {
    background: var(--rj-primary-50);
}
.table-striped > tbody > tr:nth-of-type(odd) > td {
    background: #FAFBFC;
}

/* Wrap any .table inside .rj-table-wrap for sticky-header scroll. */
.rj-table-wrap {
    border: 1px solid var(--rj-border);
    border-radius: 10px;
    overflow: auto;
    background: #fff;
    max-height: 70vh;
}
.rj-table-wrap > .table > thead > tr > th:first-child { border-top-left-radius:  10px; }
.rj-table-wrap > .table > thead > tr > th:last-child  { border-top-right-radius: 10px; }

/* ---------------------------------------------------------------------------
 * .rj-admin-table  --  used by tenant Inbox / Widgets / Campaigns / Templates /
 * Notifications / Billing / Reports / Invitations / Dashboard.  Historically
 * this class was only styled by admin.css (which the tenant area doesn't load),
 * so the tables collapsed to content width.  This restores full-width tables
 * with the same look as .table, wrapped in a card-style border + radius.
 * --------------------------------------------------------------------------*/
.rj-admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--rj-border);
    border-radius: 12px;
    overflow: hidden;
    color: var(--rj-ink);
    margin-bottom: 0;
}
.rj-admin-table th,
.rj-admin-table td {
    padding: .75rem .9rem;
    border-bottom: 1px solid var(--rj-border);
    text-align: left;
    font-size: .9rem;
    vertical-align: middle;
}
.rj-admin-table thead th {
    background: #F8FAFC;
    color: #475569;
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}
.rj-admin-table tbody tr:last-child td { border-bottom: 0; }
.rj-admin-table tbody tr { transition: background .12s ease; }
.rj-admin-table tbody tr:hover { background: var(--rj-primary-50); }
.rj-admin-table a.fw-semibold { color: var(--rj-primary-600); text-decoration: none; }
.rj-admin-table a.fw-semibold:hover { text-decoration: underline; }

/* ----------------------------------------------------------------------------
 * 5. Pagination, badges, alerts -- light polish
 * --------------------------------------------------------------------------*/
.page-link {
    border-color: var(--rj-border);
    color: var(--rj-ink);
    border-radius: 6px;
    margin: 0 2px;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.page-link:hover {
    background: var(--rj-primary-50);
    color: var(--rj-primary-600);
    border-color: rgba(8, 145, 178, .25);
}
.page-item.active .page-link {
    background: var(--rj-primary);
    border-color: var(--rj-primary);
}

.alert {
    border: 1px solid;
    border-radius: 10px;
    padding: .8rem 1rem;
    font-size: .9rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.alert-success { background: rgba(16, 185, 129, .08); border-color: rgba(16, 185, 129, .25); color: #047857; }
.alert-danger  { background: rgba(239, 68, 68, .08);  border-color: rgba(239, 68, 68, .25);  color: #B91C1C; }
.alert-warning { background: rgba(245, 158, 11, .1);  border-color: rgba(245, 158, 11, .3);  color: #B45309; }
.alert-info    { background: rgba(8, 145, 178, .08);  border-color: rgba(8, 145, 178, .25);  color: #0E7490; }

/* ----------------------------------------------------------------------------
 * 6. Choices.js theme overlay
 *    Mirrors the .form-select / .form-control look so the enhanced controls
 *    feel identical to the rest of the UI -- not a third-party island.
 * --------------------------------------------------------------------------*/
.choices {
    margin-bottom: 0;
    font-size: .92rem;
}
.choices__inner {
    background: #fff;
    border: 1px solid var(--rj-border) !important;
    border-radius: 8px !important;
    padding: .35rem .55rem !important;
    min-height: 38px !important;
    font-size: .92rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.choices.is-focused .choices__inner,
.choices.is-open    .choices__inner {
    border-color: var(--rj-primary) !important;
    box-shadow: 0 0 0 4px rgba(8, 145, 178, .14) !important;
}
.choices[data-type*="select-one"]::after {
    border-color: #6B7280 transparent transparent;
    right: 14px;
}
.choices[data-type*="select-one"].is-open::after {
    border-color: transparent transparent var(--rj-primary);
}
.choices__list--multiple .choices__item {
    background: var(--rj-primary) !important;
    border-color: var(--rj-primary) !important;
    border-radius: 999px !important;
    padding: .15rem .65rem !important;
    margin: 2px 4px 2px 0 !important;
    font-size: .78rem;
    font-weight: 600;
    color: #fff;
}
.choices__list--multiple .choices__item.is-highlighted {
    background: var(--rj-primary-600) !important;
    border-color: var(--rj-primary-600) !important;
}
.choices__list--multiple .choices__button {
    border-left: 1px solid rgba(255, 255, 255, .35) !important;
    margin-left: 8px !important;
    padding-left: 12px !important;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round'><line x1='6' y1='6' x2='18' y2='18'/><line x1='6' y1='18' x2='18' y2='6'/></svg>") !important;
    opacity: .85;
}
.choices__list--multiple .choices__button:hover { opacity: 1; }
.choices__list--dropdown,
.choices__list[aria-expanded] {
    border: 1px solid var(--rj-border) !important;
    border-radius: 10px !important;
    box-shadow: 0 18px 40px -12px rgba(15, 23, 42, .25),
                0 8px 16px -8px rgba(15, 23, 42, .15) !important;
    margin-top: 6px !important;
    overflow: hidden;
}
.choices__list--dropdown .choices__item--selectable,
.choices__list[aria-expanded] .choices__item--selectable {
    padding: .55rem .8rem !important;
    font-size: .9rem;
}
.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background: var(--rj-primary-50) !important;
    color: var(--rj-primary-600);
}
.choices__list--dropdown .choices__item--selectable::after {
    display: none;                                                /* hide "press to select" hint */
}
.choices__input {
    background: transparent !important;
    font-size: .92rem;
    padding: .25rem .35rem !important;
}
.choices__placeholder { opacity: .6; }

/* When Choices is rendered inside form-control-sm contexts, scale down */
.choices--sm .choices__inner { min-height: 32px !important; padding: .25rem .45rem !important; font-size: .82rem; }
.choices--sm .choices__list--multiple .choices__item { font-size: .72rem; padding: .1rem .55rem !important; }

/* ----------------------------------------------------------------------------
 * 7. Tippy.js theme overlay
 * --------------------------------------------------------------------------*/
.tippy-box[data-theme~="rj"] {
    background: #0F172A;
    color: #fff;
    font-size: .8rem;
    line-height: 1.4;
    padding: 2px 4px;
    border-radius: 7px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5),
                0 4px 8px -4px rgba(0, 0, 0, .3);
}
.tippy-box[data-theme~="rj"][data-placement^="top"]    > .tippy-arrow::before { border-top-color:    #0F172A; }
.tippy-box[data-theme~="rj"][data-placement^="bottom"] > .tippy-arrow::before { border-bottom-color: #0F172A; }
.tippy-box[data-theme~="rj"][data-placement^="left"]   > .tippy-arrow::before { border-left-color:   #0F172A; }
.tippy-box[data-theme~="rj"][data-placement^="right"]  > .tippy-arrow::before { border-right-color:  #0F172A; }

/* ----------------------------------------------------------------------------
 * 8. Help-icon trigger -- a tiny round ⓘ next to form labels
 * --------------------------------------------------------------------------*/
.rj-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px; height: 16px;
    margin-left: 4px;
    border-radius: 50%;
    background: #E5E7EB;
    color: #6B7280;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    vertical-align: middle;
    transition: background .15s ease, color .15s ease;
}
.rj-hint:hover { background: var(--rj-primary); color: #fff; }
