/* ------------------------------------------------------------------------
   Modern UI layer for portal.rioconsultingcorp.com
   Restyles the shared nav, buttons and native form controls without
   touching per-view markup. Loaded after template.css, before page CSS.
   ------------------------------------------------------------------------ */

:root {
  --mp-bg: #f4f6f8;
  --mp-surface: #ffffff;
  --mp-text: #202a36;
  --mp-text-muted: #5b6b7c;
  --mp-border: #d9e0e7;
  --mp-primary: #2563eb;
  --mp-primary-dark: #1d4ed8;
  --mp-success: #16a34a;
  --mp-success-dark: #15803d;
  --mp-danger: #dc2626;
  --mp-danger-dark: #b91c1c;
  --mp-info: #0891b2;
  --mp-info-dark: #0e7490;
  --mp-radius: 6px;
  --mp-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 1px rgba(16, 24, 40, 0.04);
  --mp-nav-height: 56px;
}

body#bd {
  background: var(--mp-bg);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--mp-text);
}

/* ---------------- Navigation ---------------- */

.app-nav {
  background: var(--mp-surface);
  border-bottom: 1px solid var(--mp-border);
  box-shadow: var(--mp-shadow);
  position: relative;
  z-index: 50;
}

.app-nav__bar {
  display: flex;
  align-items: center;
  min-height: var(--mp-nav-height);
  padding: 0 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.app-nav__brand {
  font-weight: 600;
  font-size: 16px;
  color: var(--mp-text);
  text-decoration: none;
  margin-right: 24px;
  white-space: nowrap;
}

.app-nav__toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  padding: 6px 10px;
  cursor: pointer;
}

.app-nav__toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--mp-text);
  margin: 4px 0;
}

.app-nav__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2px;
}

.app-nav__list li {
  display: flex;
}

.app-nav__list a {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--mp-radius);
  color: var(--mp-text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}

.app-nav__list a span {
  pointer-events: none;
}

.app-nav__list a .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-right: 6px;
  pointer-events: none;
}

.app-nav__list a:hover,
.app-nav__list a:focus {
  background: #eef2ff;
  color: var(--mp-primary-dark);
}

.app-nav__list li.active a {
  background: var(--mp-primary);
  color: #ffffff;
}

.app-nav__meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--mp-text-muted);
  white-space: nowrap;
}

.app-nav__meta b {
  color: var(--mp-text);
}

@media (max-width: 960px) {
  .app-nav__toggle {
    display: inline-flex;
    flex-direction: column;
  }

  .app-nav__bar {
    flex-wrap: wrap;
  }

  .app-nav__list {
    display: none;
    flex-direction: column;
    width: 100%;
    padding: 8px 0;
    gap: 0;
  }

  .app-nav__list a {
    width: 100%;
  }

  .app-nav.is-open .app-nav__list {
    display: flex;
  }

  .app-nav__meta {
    width: 100%;
    margin-left: 0;
    padding: 8px 0;
    order: 3;
  }
}

/* ---------------- Buttons ----------------
   Keeps existing class names (btn, btn-info, btn-success, btn-danger,
   btn-large, btn-small) used across ~144 legacy views working as-is. */

.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  padding: 7px 14px;
  border-radius: var(--mp-radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  color: #ffffff;
  background: var(--mp-text-muted);
  transition: background 0.12s ease, box-shadow 0.12s ease;
  box-shadow: var(--mp-shadow);
}

.btn:hover,
.btn:focus {
  text-decoration: none;
  color: #ffffff;
  filter: brightness(0.94);
}

.btn.btn-info {
  background: var(--mp-info);
}
.btn.btn-info:hover {
  background: var(--mp-info-dark);
}

.btn.btn-success {
  background: var(--mp-success);
}
.btn.btn-success:hover {
  background: var(--mp-success-dark);
}

.btn.btn-danger {
  background: var(--mp-danger);
}
.btn.btn-danger:hover {
  background: var(--mp-danger-dark);
}

.btn.btn-large {
  padding: 10px 20px;
  font-size: 15px;
}

.btn.btn-small {
  padding: 4px 9px;
  font-size: 12px;
}

.btn.disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

/* ---------------- Native form controls ----------------
   Applied at the element level so every existing view gets the new
   look with no per-view markup changes required. */

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="date"],
input:not([type]),
select,
textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--mp-text);
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  padding: 6px 10px;
  box-shadow: inset 0 1px 1px rgba(16, 24, 40, 0.03);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input:not([type]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--mp-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--mp-primary);
}

/* ---------------- Colorbox loading state ----------------
   Appointment/edit popups load via a colorbox iframe and can take a
   few seconds against the shared production DB. Replace the old tiny
   loading.gif with an obvious spinner + label so the wait doesn't
   read as an empty/broken popup. */

#cboxLoadingOverlay {
  background: var(--mp-surface) !important;
}

#cboxLoadingGraphic {
  background: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#cboxLoadingGraphic::before {
  content: "";
  width: 34px;
  height: 34px;
  border: 3px solid var(--mp-border);
  border-top-color: var(--mp-primary);
  border-radius: 50%;
  animation: mp-spin 0.8s linear infinite;
}

#cboxLoadingGraphic::after {
  content: "Loading...";
  font-size: 13px;
  font-weight: 500;
  color: var(--mp-text-muted);
}

@keyframes mp-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------- Legacy content tables ---------------- */

table.contentpaneopen {
  border: none;
}

.article_separator {
  color: var(--mp-text-muted);
}

/* ---------------- Page header / toolbar ---------------- */

.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}

.page-header h1 {
  font-size: 19px;
  font-weight: 600;
  margin: 0;
  color: var(--mp-text);
}

.page-header h1 a {
  font-size: 13px;
  font-weight: 500;
  margin-left: 8px;
}

.page-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.page-toolbar label {
  font-size: 13px;
  font-weight: 500;
  color: var(--mp-text-muted);
}

/* ---------------- Data table ---------------- */

.data-table-wrap {
  overflow-x: auto;
  margin: 0 0 20px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  font-size: 13px;
}

table.data-table th {
  text-align: left;
  background: #f1f5f9;
  color: var(--mp-text-muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--mp-border);
  white-space: nowrap;
}

table.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--mp-border);
  vertical-align: middle;
}

table.data-table tbody tr:hover {
  background: #f8fafc;
}

table.data-table tbody tr:last-child td {
  border-bottom: none;
}

table.data-table a {
  color: var(--mp-primary-dark);
  text-decoration: none;
}

table.data-table a:hover {
  text-decoration: underline;
}

/* Icon buttons for row actions (edit/delete/etc.) */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--mp-radius);
  color: var(--mp-text-muted);
  text-decoration: none !important;
  vertical-align: middle;
}

.icon-btn:hover {
  background: #eef2ff;
  color: var(--mp-primary-dark);
}

.icon-btn.icon-btn--danger:hover {
  background: #fef2f2;
  color: var(--mp-danger-dark);
}

.icon-btn .nav-icon {
  width: 16px;
  height: 16px;
  margin-right: 0;
}

/* ---------------- Simple form card (edit/new screens) ---------------- */

.form-card {
  max-width: 820px;
  margin: 8px 0 24px;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: var(--mp-shadow);
  box-sizing: border-box;
}

table.form-table {
  width: 100%;
  border-collapse: collapse;
}

table.form-table td {
  padding: 8px 6px;
  vertical-align: top;
  border: none;
}

table.form-table td:first-child {
  width: 170px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mp-text-muted);
  padding-top: 11px;
  white-space: nowrap;
}
