﻿/* ============================================================================================
   buttons.css - the one button style of the portal (gradient + soft shadow, like the form "Next" button). Reads only tokens.css.
     primary   : theme gradient (--ui-btn-gradient)   secondary : flat white, primary text, soft border
     danger    : red gradient                         success   : green gradient
     size      : 36px high, radius 8px (small: 30px); 44px on touch phones
   Use:  <button class="ui-btn ui-btn--primary">  (new markup)   -   or the Bootstrap classes already in the views (btn btn-primary btn-sm ...),
   which are mapped below, so existing pages follow without editing them. The block "legacy page buttons" maps the old one-off button
   classes of the login, MIS and other pages onto the same look; those old rules stay in their css files until each page is cleaned.
   Load order: after every other css (it is the last link in the layouts).
   ============================================================================================ */

/* ---------- 1. the standard ---------- */
.ui-btn,
html body .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: var(--ui-btn-h); padding: var(--ui-btn-pad);
    border: 1px solid transparent; border-radius: var(--ui-radius);
    font-size: var(--ui-font-size); font-weight: 600; line-height: 1; letter-spacing: 0; text-decoration: none;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s, color .15s, background-color .15s;
}
.ui-btn--sm,
html body .btn.btn-sm { height: var(--ui-btn-h-sm); padding: var(--ui-btn-pad-sm); font-size: 12.5px; }
.ui-btn--block { width: 100%; }
.ui-btn:disabled, .ui-btn.disabled,
html body .btn:disabled, html body .btn.disabled { opacity: .55; cursor: not-allowed; box-shadow: none !important; }
.ui-btn:focus-visible, html body .btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--ui-primary-ring); }

/* primary */
.ui-btn--primary,
html body .btn-primary, html body .btn-info {
    background: var(--ui-btn-gradient); border-color: transparent; color: var(--ui-btn-ink); box-shadow: var(--ui-btn-shadow);
}
.ui-btn--primary:hover:not(:disabled),
html body .btn-primary:hover:not(:disabled), html body .btn-info:hover:not(:disabled),
html body .btn-primary:active, html body .btn-primary.active {
    background: var(--ui-btn-gradient); border-color: transparent; color: var(--ui-btn-ink); box-shadow: var(--ui-btn-shadow-hover);
}

/* secondary (also the Bootstrap secondary / light / outline-primary / outline-secondary) */
.ui-btn--secondary,
html body .btn-secondary, html body .btn-light, html body .btn-outline-primary, html body .btn-outline-secondary {
    background-color: var(--ui-btn-secondary-bg); border-color: var(--ui-btn-secondary-line); color: var(--ui-btn-secondary-ink);
}
.ui-btn--secondary:hover:not(:disabled),
html body .btn-secondary:hover:not(:disabled), html body .btn-light:hover:not(:disabled),
html body .btn-outline-primary:hover:not(:disabled), html body .btn-outline-secondary:hover:not(:disabled) {
    background-color: var(--ui-btn-secondary-bg-hover); border-color: var(--ui-primary); color: var(--ui-btn-secondary-ink);
}

/* danger */
.ui-btn--danger,
html body .btn-danger { background: var(--ui-btn-danger-gradient); border-color: transparent; color: #fff; box-shadow: var(--ui-btn-danger-shadow); }
.ui-btn--danger:hover:not(:disabled), html body .btn-danger:hover:not(:disabled) { background: var(--ui-btn-danger-gradient); border-color: transparent; color: #fff; box-shadow: var(--ui-btn-danger-shadow-hover); }
html body .btn-outline-danger { background-color: #fff; border-color: var(--ui-danger); color: var(--ui-danger); }
html body .btn-outline-danger:hover:not(:disabled) { background-color: var(--ui-danger-bg); border-color: var(--ui-danger); color: var(--ui-danger-ink); }

/* success */
.ui-btn--success,
html body .btn-success { background: var(--ui-btn-success-gradient); border-color: transparent; color: #fff; box-shadow: var(--ui-btn-success-shadow); }
.ui-btn--success:hover:not(:disabled), html body .btn-success:hover:not(:disabled) { background: var(--ui-btn-success-gradient); border-color: transparent; color: #fff; box-shadow: var(--ui-btn-success-shadow-hover); }
html body .btn-outline-success { background-color: #fff; border-color: var(--ui-success); color: var(--ui-success-ink); }
html body .btn-outline-success:hover:not(:disabled) { background-color: var(--ui-success-bg); border-color: var(--ui-success); color: var(--ui-success-ink); }

@media (pointer: coarse) and (max-width: 576px) {
    .ui-btn, html body .btn { height: var(--ui-control-h-touch); }
    .ui-btn--sm, html body .btn.btn-sm { height: var(--ui-btn-h); }
}

/* ---------- 2. legacy page buttons: same look, old class names ---------- */
/* login page (auth-theme.css): Sign In / Send OTP / Verify, and the active tab */
html body .cp-submit {
    height: var(--ui-btn-h); border-radius: var(--ui-radius); border: 1px solid var(--ui-btn-bg);
    background: var(--ui-btn-gradient); color: var(--ui-btn-ink);
    font-size: var(--ui-font-size); font-weight: 600; letter-spacing: 0; box-shadow: var(--ui-btn-shadow); transform: none;
}
html body .cp-submit:hover:not(:disabled) { background: var(--ui-btn-gradient); border-color: transparent; box-shadow: var(--ui-btn-shadow-hover); transform: none; filter: none; }
html body .cp-submit.secondary { background: var(--ui-btn-secondary-bg); border-color: var(--ui-btn-secondary-line); color: var(--ui-btn-secondary-ink); box-shadow: none; }
html body .cp-submit.secondary:hover:not(:disabled) { background: var(--ui-btn-secondary-bg-hover); border-color: var(--ui-primary); box-shadow: none; }
/* the white link buttons of the login family (Register, Reset Password, Return to Home ...): the same hover as every outline button */
html body .cp-link-btn:hover, html body .cp-link-btn:focus-visible { background: var(--ui-btn-secondary-bg-hover); border-color: var(--ui-primary); color: var(--ui-btn-secondary-ink); }
html body .cp-tab-btn { border-radius: var(--ui-radius); font-size: 12.5px; letter-spacing: 0; }
/* the open tab: a soft tint with a thin border in the theme colour all round (the strong fill is kept for the one main button of the page, e.g. Sign In) */
html body .cp-tab-btn.active { background: var(--ui-primary-soft); color: var(--ui-primary); box-shadow: inset 0 0 0 .75px var(--ui-primary); }
html body .cp-tab-btn:not(.active):hover { background: color-mix(in srgb, var(--ui-primary) 6%, transparent); color: var(--ui-primary); }

/* survey list filter chips (Total / All selected), Survey Data Bank "+ Add New", draft "Open" button: the same gradient */
html body .fx-chip.is-active:not(.fx-chip--ok):not(.fx-chip--bad),
html body .hub-add, html body .hub-foot .hub-add, html body .fx-hold-btn--go {
    background: var(--ui-btn-gradient); border-color: transparent; color: #fff; box-shadow: var(--ui-btn-shadow);
}
html body .hub-add:hover, html body .hub-foot .hub-add:hover, html body .fx-hold-btn--go:hover { box-shadow: var(--ui-btn-shadow-hover); color: #fff; }

/* MIS (police-mis-dashboard.css, MisDashboard.css, theme-shell.css): Show Data, group-by / tab toggles, download buttons */
html body .mis-btn-primary,
html body .mis-filter-row .mis-show-btn,
html body .btn-obx.--primary, html body #obxFilter .btn-obx.--primary,
html body .btn-lar.--primary, html body #larFilter .btn-lar.--primary,
html body .btn-lad-search,
html body #UploadDocumentForm #submitBtn {
    height: var(--ui-btn-h); padding: var(--ui-btn-pad); border: 1px solid transparent; border-radius: var(--ui-radius);
    background: var(--ui-btn-gradient); color: var(--ui-btn-ink);
    font-size: var(--ui-font-size); font-weight: 600; letter-spacing: 0; box-shadow: var(--ui-btn-shadow); transform: none;
}
html body .mis-btn-primary:hover:not(:disabled),
html body .mis-filter-row .mis-show-btn:hover,
html body #obxFilter .btn-obx.--primary:hover, html body #larFilter .btn-lar.--primary:hover,
html body .btn-lad-search:hover, html body #UploadDocumentForm #submitBtn:hover {
    background: var(--ui-btn-gradient); border-color: transparent; color: var(--ui-btn-ink); box-shadow: var(--ui-btn-shadow-hover);
}
html body #obxFilter .btn-obx.--ghost, html body #larFilter .btn-lar.--ghost,
html body .btn-lad-reset, html body .btn-export-excel {
    height: var(--ui-btn-h); border-radius: var(--ui-radius); background: var(--ui-btn-secondary-bg);
    border: 1px solid var(--ui-btn-secondary-line); color: var(--ui-btn-secondary-ink); box-shadow: none;
}
html body #obxFilter .btn-obx.--ghost:hover, html body #larFilter .btn-lar.--ghost:hover,
html body .btn-lad-reset:hover, html body .btn-export-excel:hover {
    background: var(--ui-btn-secondary-bg-hover); border-color: var(--ui-primary); color: var(--ui-btn-secondary-ink);
}
/* toggles (Table / Graph, Overall / Division / PS wise / Beat wise): selected = primary, others = secondary */
html body .mis-gb-btn, html body .mis-view-tab { color: var(--ui-btn-secondary-ink); font-weight: 600; }
html body .mis-gb-btn:hover:not(.--active), html body .mis-view-tab:hover:not(.--active) { background: var(--ui-btn-secondary-bg-hover); color: var(--ui-btn-secondary-ink); }
/* the selected one of a toggle: soft tint + thin border (same as the login tabs), so "Show Data" stays the one filled button of the page */
html body .mis-gb-btn.--active, html body .mis-view-tab.--active { background: var(--ui-primary-soft); color: var(--ui-primary); font-weight: 700; box-shadow: none; outline: 1px solid var(--ui-primary); outline-offset: -1px; position: relative; z-index: 1; }
/* the frames of the toggle groups use the theme line colour (were a fixed grey) */
html body .mis-view-tabs, html body .mis-groupby, html body .mis-dl-group { border: 1px solid var(--ui-btn-secondary-line); }
html body .mis-view-tab, html body .mis-gb-btn { border-right: 1px solid var(--ui-btn-secondary-line); }
html body .mis-view-tab:last-child, html body .mis-gb-btn:last-child { border-right: 0; }

/* report pages (Filter / Card ids of ReportsForServices etc.): Search / Show Data = primary gradient, Reset = secondary, Excel / PDF / Word = small secondary */
html body [id$="Filter"] .btn.--primary, html body [id$="Filter"] .btn.--print {
    height: var(--ui-btn-h) !important; padding: var(--ui-btn-pad) !important; border: 1px solid transparent !important; border-radius: var(--ui-radius) !important;
    background: var(--ui-btn-gradient) !important; color: var(--ui-btn-ink) !important; box-shadow: var(--ui-btn-shadow) !important;
    font-size: var(--ui-font-size) !important; font-weight: 600 !important;
}
html body [id$="Filter"] .btn.--primary:hover, html body [id$="Filter"] .btn.--print:hover { box-shadow: var(--ui-btn-shadow-hover) !important; filter: none !important; }
html body [id$="Filter"] .btn.--ghost {
    height: var(--ui-btn-h) !important; border-radius: var(--ui-radius) !important; background: var(--ui-btn-secondary-bg) !important;
    border: 1px solid var(--ui-btn-secondary-line) !important; color: var(--ui-btn-secondary-ink) !important; box-shadow: none !important; font-weight: 600 !important;
}
html body [id$="Filter"] .btn.--ghost:hover { background: var(--ui-btn-secondary-bg-hover) !important; border-color: var(--ui-primary) !important; }
html body [id$="Card"] .dt-buttons .btn {
    height: var(--ui-btn-h-sm) !important; border-radius: var(--ui-radius) !important; background: var(--ui-btn-secondary-bg) !important;
    border: 1px solid var(--ui-btn-secondary-line) !important; color: var(--ui-btn-secondary-ink) !important; box-shadow: none !important; font-weight: 600 !important;
}
html body [id$="Card"] .dt-buttons .btn:hover { background: var(--ui-btn-secondary-bg-hover) !important; border-color: var(--ui-primary) !important; }

/* admin / list pages (card + table): "Add" and "Edit" use the primary gradient, not green; Delete stays red */
html body .card-tools .btn-success, html body .card-header .btn-success, html body td .btn-group > .btn-success {
    background: var(--ui-btn-gradient); border-color: transparent; color: var(--ui-btn-ink); box-shadow: var(--ui-btn-shadow);
}
html body .card-tools .btn-success:hover:not(:disabled), html body .card-header .btn-success:hover:not(:disabled), html body td .btn-group > .btn-success:hover:not(:disabled) {
    background: var(--ui-btn-gradient); border-color: transparent; color: var(--ui-btn-ink); box-shadow: var(--ui-btn-shadow-hover);
}
/* the outline of a selected toggle follows the rounded corners of its group (inner radius = group radius 7px - 1px frame) */
html body .mis-view-tab:first-child, html body .mis-gb-btn:first-child { border-radius: 6px 0 0 6px; }
html body .mis-view-tab:last-child, html body .mis-gb-btn:last-child { border-radius: 0 6px 6px 0; }
