/*
 * Tools4Startup - shared theme styles (loaded on every page after Tailwind)
 * 1. Utilities that the old Bootstrap theme used to provide (.hide, .hideAll ...)
 * 2. Homepage search dropdown
 * 3. Reusable component classes for tool pages (.t4s-*)
 * 4. Low-specificity Bootstrap-3 compatibility for markup generated by the
 *    legacy PHP/JS tool libraries (tables, badges, alerts, tabs, progress ...)
 *    -> wrapped in :where() so any Tailwind utility on the same element wins.
 */

/* ---------- 1. utilities ---------- */
.hide { display: none !important; }
.hideAll { display: none; }
.none { display: none; }
.clearfix::after { content: ""; display: table; clear: both; }
.green { color: #16a34a; }
.red   { color: #dc2626; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

/* ---------- 2. homepage / sidebar search ---------- */
#searchSec, #sidebarSc { position: relative; }
#search, #sidebarsearch { box-shadow: none; }
.search-results {
  display: none;
  position: absolute;
  left: 0; right: 0; top: 100%;
  margin-top: .5rem;
  z-index: 50;
  max-height: 20rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .12);
  padding: .35rem;
  font-size: .875rem;
  color: #64748b;
  text-align: left;
}
.search-results .match { display: block; padding: 0; width: 100%; }
.search-results .match a {
  display: block;
  padding: .55rem .8rem;
  border-radius: .7rem;
  color: #334155;
  text-decoration: none;
}
.search-results .match a:hover,
.search-results .match.active a { background: #eff6ff; color: #2563eb; }
.search-results .match a strong { font-weight: 700; color: #2563eb; }
.search-results .no-match { display: block; padding: .75rem .9rem; color: #94a3b8; }
#sidebar-results { position: static; margin-top: .5rem; box-shadow: none; }

/* ---------- 3. tool page components ---------- */
.t4s-card {
  background: #fff;
  border: 1px solid #f1f5f9;
  border-radius: 1.5rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
  padding: 1.25rem;
  min-width: 0;
}
@media (min-width: 640px) { .t4s-card { padding: 1.5rem; } }

.t4s-label { display: block; font-size: .75rem; font-weight: 500; color: #475569; margin-bottom: .25rem; }
.t4s-help  { font-size: .875rem; color: #475569; margin-bottom: 1rem; line-height: 1.6; }

.t4s-input {
  display: block; width: 100%;
  border: 1px solid #e2e8f0;
  background: rgba(248, 250, 252, .7);
  border-radius: 1rem;
  padding: .65rem .9rem;
  font-size: .875rem;
  color: #1e293b;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.t4s-input:focus { background: #fff; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
textarea.t4s-input { resize: vertical; }

.t4s-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.25rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: #2563eb; color: #fff;
  font-size: .875rem; font-weight: 500; line-height: 1.25;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 10px 25px rgba(37, 99, 235, .25);
  transition: background .15s, transform .05s;
}
.t4s-btn:hover { background: #1d4ed8; color: #fff; }
.t4s-btn:active { transform: translateY(1px); }
.t4s-btn-ghost  { background: #fff; color: #334155; border-color: #e2e8f0; box-shadow: none; }
.t4s-btn-ghost:hover { background: #f8fafc; color: #0f172a; }
.t4s-btn-danger { background: #e11d48; box-shadow: 0 10px 25px rgba(225, 29, 72, .2); }
.t4s-btn-danger:hover { background: #be123c; }
.t4s-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1.25rem; }

.t4s-alert {
  border-radius: 1rem; border: 1px solid #fecaca; background: #fef2f2;
  color: #b91c1c; padding: .8rem 1rem; font-size: .875rem;
}

.t4s-table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 1rem; }
.t4s-table { width: 100%; border-collapse: collapse; font-size: .875rem; color: #334155; }
.t4s-table th, .t4s-table td { padding: .7rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid #f1f5f9; word-break: break-word; }
.t4s-table tr:last-child th, .t4s-table tr:last-child td { border-bottom: 0; }
.t4s-table thead th { background: #f8fafc; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }
.t4s-table tbody tr:nth-child(even) { background: rgba(248, 250, 252, .6); }
.t4s-table td:first-child.t4s-key, .t4s-table th.t4s-key { width: 34%; color: #64748b; font-weight: 500; }

.t4s-loader { display: none; text-align: center; padding: 1rem 0; color: #64748b; font-size: .875rem; }
.t4s-loader img { width: 2.5rem; height: 2.5rem; margin: 0 auto .5rem; }
.t4s-percent { text-align: center; font-size: 1.125rem; margin: .5rem 0 1rem; }

.t4s-counter { display: flex; justify-content: space-between; gap: 1rem; font-size: .75rem; color: #64748b; margin-top: .5rem; }

/* Rich text coming from the admin "About tool" field */
.about-content { font-size: .875rem; line-height: 1.75; color: #475569; }
.about-content > * + * { margin-top: .85rem; }
.about-content h1, .about-content h2, .about-content h3, .about-content h4 { color: #0f172a; font-weight: 600; line-height: 1.3; margin-top: 1.25rem; }
.about-content h2 { font-size: 1.15rem; }
.about-content h3 { font-size: 1.05rem; }
.about-content ul { list-style: disc; padding-left: 1.25rem; }
.about-content ol { list-style: decimal; padding-left: 1.25rem; }
.about-content a { color: #2563eb; text-decoration: underline; }
.about-content img { max-width: 100%; height: auto; border-radius: .75rem; }
.about-content table { width: 100%; border-collapse: collapse; }
.about-content th, .about-content td { border: 1px solid #e2e8f0; padding: .5rem .7rem; }

/* ---------- 4. Bootstrap-3 compatibility (zero specificity) ---------- */
:where(body) .table { width: 100%; max-width: 100%; border-collapse: collapse; font-size: .875rem; color: #334155; margin-bottom: 1rem; }
:where(body) .table th, :where(body) .table td { padding: .65rem .9rem; text-align: left; vertical-align: top; border-top: 1px solid #e2e8f0; word-break: break-word; }
:where(body) .table thead th { background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-weight: 600; }
:where(body) .table-bordered { border: 1px solid #e2e8f0; }
:where(body) .table-bordered th, :where(body) .table-bordered td { border: 1px solid #e2e8f0; }
:where(body) .table-striped tbody tr:nth-of-type(odd) { background: #f8fafc; }
:where(body) .table-hover tbody tr:hover { background: #eff6ff; }
:where(body) tr.even { background: #fff; }
:where(body) tr.odd  { background: #f8fafc; }
:where(body) hr.tableHr { margin: .4rem 0; border-color: #e2e8f0; }

:where(body) .badge, :where(body) .label {
  display: inline-block; padding: .2rem .6rem; border-radius: 9999px;
  font-size: .75rem; font-weight: 600; line-height: 1.2; color: #fff; background: #64748b;
  white-space: normal; word-break: break-word;
}
:where(body) .bg-green, :where(body) .label-success { background: #16a34a; }
:where(body) .bg-aqua, :where(body) .label-info { background: #0891b2; }
:where(body) .bg-purple { background: #7c3aed; }
:where(body) .bg-orange, :where(body) .label-warning { background: #ea580c; }
:where(body) .bg-olive { background: #65a30d; }
:where(body) .bg-blue, :where(body) .label-primary { background: #2563eb; }
:where(body) .bg-red, :where(body) .label-danger { background: #dc2626; }
:where(body) .bg-maroon { background: #be185d; }
:where(body) .bg-yellow { background: #ca8a04; }
:where(body) .bg-gray, :where(body) .label-default { background: #64748b; }

:where(body) .alert { border-radius: 1rem; padding: .8rem 1rem; font-size: .875rem; border: 1px solid transparent; margin-bottom: 1rem; }
:where(body) .alert-error, :where(body) .alert-danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
:where(body) .alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
:where(body) .alert-warning { background: #fffbeb; border-color: #fde68a; color: #b45309; }
:where(body) .alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

:where(body) .btn {
  display: inline-block; padding: .5rem 1.1rem; border-radius: 9999px; border: 1px solid transparent;
  font-size: .875rem; font-weight: 500; line-height: 1.25; cursor: pointer; text-decoration: none; color: #fff; background: #2563eb;
}
:where(body) .btn-info, :where(body) .btn-primary { background: #2563eb; }
:where(body) .btn-success { background: #16a34a; }
:where(body) .btn-danger  { background: #e11d48; }
:where(body) .btn-warning { background: #ea580c; }
:where(body) .btn-default { background: #fff; color: #334155; border-color: #e2e8f0; }
:where(body) .btn:hover { filter: brightness(.95); }

:where(body) .form-control {
  display: block; width: 100%; border: 1px solid #e2e8f0; background: #f8fafc; border-radius: 1rem;
  padding: .6rem .9rem; font-size: .875rem; color: #1e293b; outline: none;
}
:where(body) .form-control:focus { background: #fff; border-color: #2563eb; }
:where(body) .form-group { margin-bottom: 1rem; }
:where(body) .input-group { display: flex; align-items: stretch; width: 100%; }
:where(body) .input-group-addon { display: flex; align-items: center; padding: 0 .75rem; color: #64748b; background: #f1f5f9; border: 1px solid #e2e8f0; }
:where(body) .pull-right { float: right; }
:where(body) .pull-left  { float: left; }

:where(body) .nav-tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid #e2e8f0; margin-bottom: 1rem; list-style: none; padding: 0; }
:where(body) .nav-tabs > li > a { display: block; padding: .5rem .9rem; border-radius: .7rem .7rem 0 0; color: #475569; font-size: .875rem; text-decoration: none; }
:where(body) .nav-tabs > li.active > a { background: #eff6ff; color: #2563eb; font-weight: 600; }
:where(body) .tab-content > .tab-pane { display: none; }
:where(body) .tab-content > .tab-pane.active { display: block; }

:where(body) .progress { height: .75rem; background: #e2e8f0; border-radius: 9999px; overflow: hidden; }
:where(body) .progress-bar { height: 100%; background: #2563eb; color: #fff; font-size: .65rem; text-align: center; transition: width .4s; }
:where(body) .progress-bar-success { background: #16a34a; }
:where(body) .progress-bar-danger  { background: #dc2626; }
:where(body) .progress-bar-warning { background: #ea580c; }

:where(body) .panel { background: #fff; border: 1px solid #e2e8f0; border-radius: 1rem; margin-bottom: 1rem; overflow: hidden; }
:where(body) .panel-heading { padding: .7rem 1rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-weight: 600; }
:where(body) .panel-body { padding: 1rem; }

/* sweetalert sits above the sticky header */
.sweet-overlay, .sweet-alert { z-index: 10000 !important; }

/* ---------- 5. minimal Bootstrap modal (footer sign-in/up modals, popups) ---------- */
.modal { display: none; position: fixed; inset: 0; z-index: 1050; overflow-y: auto; background: rgba(15, 23, 42, .5); }
.modal.fade { opacity: 0; transition: opacity .15s linear; }
.modal.fade.in, .modal.in { opacity: 1; }
.modal-dialog { max-width: 32rem; margin: 3rem auto; padding: 0 1rem; }
.modal-content { background: #fff; border-radius: 1rem; box-shadow: 0 25px 50px rgba(15, 23, 42, .25); overflow: hidden; }
.modal-header, .modal-footer { padding: 1rem 1.25rem; }
.modal-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #f1f5f9; }
.modal-header .close, .alert .close { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: #64748b; }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid #f1f5f9; display: flex; justify-content: space-between; gap: 1rem; }
.modal-backdrop { position: fixed; inset: 0; z-index: 1040; background: rgba(15, 23, 42, .5); }
body.modal-open { overflow: hidden; }
