/* =============================================
   PagerMon — Flat Professional Theme
   ============================================= */

/* ===== BASE ===== */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  background-color: #f0ebe0;
  color: #2c3e50;
  padding-top: 56px;
}

a {
  color: #c0392b;
  text-decoration: none;
}

a:hover, a:focus {
  color: #96281b;
  text-decoration: none;
}

html, body {
  height: 100%;
}

/* ===== NAVBAR ===== */

.navbar {
  background-color: #2c3e50;
  border: none;
  border-radius: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  min-height: 56px;
  margin-bottom: 0;
}

.navbar-brand {
  color: #ffffff !important;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.4px;
  padding: 17px 20px;
}

.navbar-brand:hover {
  color: #ecf0f1 !important;
}

.navbar-nav > li > a {
  color: #bdc3c7 !important;
  background-color: transparent !important;
  font-size: 13px;
  font-weight: 500;
  padding: 18px 15px;
  transition: color 0.15s, background-color 0.15s;
}

.navbar-nav > li > a:hover,
.navbar-nav > li > a:focus {
  color: #ffffff !important;
  background-color: rgba(255,255,255,0.07) !important;
}

.navbar-nav > li.active > a,
.navbar-nav > li.active > a:focus {
  color: #ffffff !important;
  background-color: rgba(255,255,255,0.12) !important;
}

.navbar-toggle {
  border: none;
  margin-top: 11px;
  padding: 8px 10px;
}

.navbar-toggle .icon-bar {
  background-color: #bdc3c7;
}

.navbar-toggle:hover .icon-bar {
  background-color: #ffffff;
}

.navbar-toggle {
  color: #bdc3c7;
}

/* Ensure Bootstrap collapse works on mobile */
.navbar-collapse.in {
  display: block !important;
  overflow-y: auto !important;
  max-height: calc(100vh - 56px);
}

/* Dropdown */
.dropdown-menu {
  border: none;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 6px 0;
  background-color: #34495e;
  min-width: 170px;
}

.dropdown-menu > li > a {
  color: #bdc3c7 !important;
  font-size: 13px;
  padding: 8px 16px;
  transition: background-color 0.12s;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
  background-color: rgba(255,255,255,0.08) !important;
  color: #ffffff !important;
}

.dropdown-menu > .divider {
  background-color: rgba(255,255,255,0.1);
  margin: 5px 0;
}

/* Collapse triangle toggle */
.triangle-down {
  display: none;
}

/* ===== LAYOUT WRAPPER ===== */

#wrap {
  min-height: 100%;
  height: auto;
  margin: 0 auto -56px;
  padding: 0 0 56px;
}

#content {
  padding: 20px 15px 10px;
}

/* ===== MESSAGE TABLE CARD ===== */

.table-responsive, .table {
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border: 1px solid #e4ddd2;
  margin-bottom: 0;
}

.table > thead > tr > th {
  background-color: #2c3e50;
  color: #ecf0f1;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: none;
  padding: 12px 10px;
  white-space: nowrap;
}

.table > thead > tr > th:first-child { border-radius: 6px 0 0 0; }
.table > thead > tr > th:last-child  { border-radius: 0 6px 0 0; }

.table > tbody > tr > td {
  border-top: 1px solid #f0ebe0;
  padding: 9px 10px;
  vertical-align: middle;
  color: #2c3e50;
}

.table-striped > tbody > tr:nth-of-type(odd) {
  background-color: #faf8f4;
}

.table-hover > tbody > tr:hover > td {
  background-color: #f5f0e6 !important;
}

.table-condensed > thead > tr > th,
.table-condensed > tbody > tr > td {
  padding: 8px 10px;
}

/* ===== MESSAGE CONTENT ===== */

.pagerMessage {
  font-weight: 600;
  font-size: 13px;
  word-break: break-word;
  line-height: 1.5;
  color: #2c3e50;
}

/* Timestamps */
.table > tbody > tr > td:first-child,
.table > tbody > tr > td:nth-child(2) {
  color: #7f8c8d;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
}

/* Source / Capcode badge cells */
.table > tbody > tr > td.shrink {
  white-space: nowrap;
  vertical-align: middle;
}

/* Alias column */
.table > tbody > tr > td span[style*="Maroon"],
.table > tbody > tr > td span[style*="maroon"] {
  color: #c0392b !important;
  font-weight: 500;
}

/* Maps icon */
.maps-link {
  margin-top: 5px;
  display: inline-block;
  opacity: 0.75;
  transition: opacity 0.15s;
}

.maps-link:hover {
  opacity: 1;
}

/* Agency icon stack */
.fa-stack {
  vertical-align: middle;
}

/* ===== SEARCH BAR ===== */

.form-control {
  border: 1px solid #ddd6ca;
  border-radius: 4px;
  box-shadow: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  height: 36px;
  color: #2c3e50;
  background-color: #ffffff;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: #2c3e50;
  box-shadow: none;
  outline: none;
}

.input-group-btn .btn {
  border-radius: 0 4px 4px 0;
  height: 36px;
}

/* ===== BUTTONS ===== */

.btn {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  transition: background-color 0.15s, opacity 0.15s;
}

.btn-default {
  background-color: #ecf0f1;
  color: #2c3e50;
  border: 1px solid #ddd6ca;
}

.btn-default:hover, .btn-default:focus {
  background-color: #dde1e2;
  color: #2c3e50;
  border-color: #ccc5b9;
}

.btn-primary {
  background-color: #2c3e50;
  color: #ffffff;
}

.btn-primary:hover, .btn-primary:focus {
  background-color: #34495e;
  color: #ffffff;
}

.btn-info {
  background-color: #c0392b;
  color: #ffffff;
  border: none;
}

.btn-info:hover, .btn-info:focus {
  background-color: #96281b;
  color: #ffffff;
}

.btn-danger {
  background-color: #e74c3c;
  color: #ffffff;
}

.btn-success {
  background-color: #27ae60;
  color: #ffffff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-xs {
  padding: 2px 7px;
  font-size: 11px;
}

/* Table top controls */
.btn-group .btn-default {
  background-color: #f5f0e8;
  color: #2c3e50;
  border: 1px solid #ddd6ca;
}

.btn-group .btn-default:hover {
  background-color: #e8e0d0;
}

/* Active filter badge */
.btn-primary.btn-xs {
  background-color: #c0392b;
  border-radius: 3px;
  font-size: 11px;
}

/* ===== CLICKABLE TABLE CELLS ===== */

.clickable-td {
  cursor: pointer;
}

td.clickable-td:hover,
td.clickable-td:focus {
  filter: brightness(92%);
}

/* ===== POPOVER ===== */

.popover {
  border: none;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}

.popover-content {
  padding: 8px 6px;
}

.popoverCont .btn {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  text-align: left;
  background-color: #f5f0e8;
  color: #2c3e50;
  border: none;
  padding: 6px 12px;
}

.popoverCont .btn:hover {
  background-color: #2c3e50;
  color: #ffffff;
}

/* ===== HIGHLIGHT (search) ===== */

.angular-highlight {
  background-color: rgba(192, 57, 43, 0.15);
  color: #2c3e50;
  border-radius: 2px;
  padding: 1px 3px;
  margin: -1px;
}

.angular-highlight:hover, .angular-highlight:focus {
  cursor: pointer;
  background-color: rgba(192, 57, 43, 0.3);
  text-decoration: none;
  color: #96281b;
}

/* ===== PAGINATION ===== */

.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0 8px;
}

.pagination > li > a,
.pagination > li > span {
  color: #2c3e50;
  background-color: #ffffff;
  border: 1px solid #ddd6ca;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  transition: background-color 0.12s;
}

.pagination > li > a:hover {
  background-color: #f0ebe0;
  color: #2c3e50;
}

.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover {
  background-color: #2c3e50;
  border-color: #2c3e50;
  color: #ffffff;
}

.pagination > .disabled > span,
.pagination > .disabled > a {
  color: #bdc3c7;
  background-color: #faf8f4;
  border-color: #ddd6ca;
  cursor: default;
}

/* ===== FOOTER ===== */

#footer {
  height: 56px;
  background-color: #2c3e50;
  border-top: none;
  display: flex;
  align-items: center;
}

#footer .navbar-text {
  color: #7f8c8d;
  font-size: 12px;
  margin: 0;
  padding: 0 15px;
  width: 100%;
}

#footer a {
  color: #95a5a6;
}

#footer a:hover {
  color: #ecf0f1;
}

.footer-nav {
  box-shadow: 0 -2px 6px rgba(0,0,0,0.15);
}

/* ===== LOADING SPINNER ===== */

.loading {
  pointer-events: all;
  z-index: 99999;
  border: none;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  cursor: wait;
  position: fixed;
  background-color: rgba(44, 62, 80, 0.5);
  display: table;
}

.loading i {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
  font-size: 40px;
  color: #ecf0f1;
}

/* ===== MISC ===== */

[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
  display: none !important;
}

.disabledLink {
  color: #bdc3c7;
  pointer-events: none;
}

.col-centered {
  float: none;
  margin: 0 auto;
}

/* Vertical button group (fixed sidebar) */
.btn-group-vertical {
  text-align: center;
  position: fixed;
  bottom: 80px;
  right: 50px;
  width: 225px;
}

#buttons-capcodes {
  text-align: center;
  position: fixed;
  bottom: 280px;
  right: 50px;
  width: 225px;
}

#buttons-functions {
  text-align: center;
  position: fixed;
  bottom: 200px;
  right: 50px;
  width: 225px;
}

.btn-wide {
  width: 90%;
  margin: 5%;
  box-sizing: border-box;
  display: table;
}

.btn-lg i { color: #c0392b; }
.btn-lg.disabled i { color: #95a5a6; }

.btn-subtext {
  font-size: 60%;
  line-height: 14px;
  text-align: center;
  white-space: normal;
}

.btn-title {
  vertical-align: middle;
  height: 100%;
  display: table-cell;
}

/* ===== NAV TABS (admin pages) ===== */

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:focus,
.nav > li.active > a {
  color: #c0392b;
  border-bottom: 2px solid #c0392b;
  background-color: transparent;
}

.nav-tabs > li > a:hover {
  background-color: #f5f0e8;
  color: #2c3e50;
}

/* ===== ALERT ===== */

.alert-fixed {
  position: fixed;
  top: 30px;
  left: 10%;
  width: 80%;
  z-index: 9999;
  border-radius: 4px;
}

/* ===== TABLE LAYOUT HELPERS ===== */

.table {
  max-width: none;
  word-wrap: break-word;
}

table .shrink {
  white-space: nowrap;
  vertical-align: middle;
}

table .expand {
  width: 99%;
  vertical-align: middle;
  white-space: normal;
}

.valign > tbody > tr > td {
  vertical-align: middle;
}

/* ===== RESPONSIVE / MOBILE CARDS ===== */

@media screen and (max-device-width: 768px) {
  .btn-group-vertical { width: 140px; right: 50px; }
  #buttons-capcodes { width: 140px; right: 50px; }
  #buttons-functions { width: 140px; right: 50px; }
}

@media screen and (max-width: 400px) {
  [class*="col-"] { padding-left: 2px; padding-right: 2px; }
  .pagination { margin: 10px 0; }
}

@media (max-width: 767px) {
  /* ── Card layout: transform table rows into cards ── */

  body { padding-top: 50px; }

  #content { padding: 8px 6px 10px; }

  /* Wrap becomes flex column */
  .table-responsive { border: none; box-shadow: none; background: transparent; }

  .table { background: transparent; border: none; box-shadow: none; }

  /* Hide header row */
  .table > thead { display: none; }

  /* Each row becomes a card */
  .table > tbody > tr {
    display: block;
    margin: 10px 0;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #e4ddd2;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    overflow: hidden;
  }

  /* All cells block by default */
  .table > tbody > tr > td {
    display: block;
    border: none;
    border-top: 1px solid #f0ebe0;
    padding: 8px 12px;
    white-space: normal;
    width: 100%;
    vertical-align: top;
  }

  .table > tbody > tr > td:first-child {
    border-top: none;
  }

  /* Override column hiding on mobile — show everything in card */
  .table > tbody > tr > td.noMobile,
  .table > tbody > tr > td.noSmall,
  .table > tbody > tr > td.noTiny {
    display: block !important;
  }

  /* ── Card header: date + time ── */
  .table > tbody > tr > td.msg-date {
    display: none !important; /* collapse date into time cell */
  }

  .table > tbody > tr > td.msg-time {
    background: #2c3e50;
    color: #bdc3c7;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 12px;
    border-top: none;
    letter-spacing: 0.3px;
  }

  /* ── Agency row ── */
  .table > tbody > tr > td.msg-agency {
    background: #f5f0e8;
    padding: 8px 12px;
    border-top: 1px solid #e8e0d0;
    font-size: 13px;
    font-weight: 600;
  }

  /* ── Alias sub-label ── */
  .table > tbody > tr > td.msg-alias {
    font-size: 11px;
    color: #7f8c8d;
    padding: 4px 12px 6px;
    background: #faf8f4;
    border-top: 1px solid #f0ebe0;
  }

  /* ── Capcode — hide on cards ── */
  .table > tbody > tr > td.msg-capcode {
    display: none !important;
  }

  /* ── Map link cell ── */
  .table > tbody > tr > td.msg-map {
    background: #faf8f4;
    border-top: 1px solid #f0ebe0;
    padding: 6px 12px;
    font-size: 12px;
  }

  /* ── Message body ── */
  .table > tbody > tr > td.expand {
    font-size: 13px;
    line-height: 1.6;
    padding: 10px 12px;
    white-space: normal;
    border-top: 1px solid #f0ebe0;
    color: #2c3e50;
  }

  /* ── Fix icon stack size on mobile ── */
  .fa-stack.fa-lg { font-size: 1.1em; }

  /* ── Push notification button ── */
  #push-btn {
    width: 100%;
    margin: 8px 0 4px;
    border-radius: 6px;
  }

  /* ── Pagination ── */
  .pagination { margin: 10px 0; }

  /* ── Fixed button groups ── */
  .btn-group-vertical { position: relative; bottom: 0; right: 0; width: 100%; }
  .form-horizontal .control-label { text-align: right; padding-top: 7px; }

  /* ── Navbar mobile tweaks ── */
  .navbar-collapse { background: #2c3e50; border-top: 1px solid rgba(255,255,255,0.1); }
  .navbar-nav > li > a { padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .navbar-nav > li:last-child > a { border-bottom: none; }
  .dropdown-menu { background-color: #253545; border-radius: 0; box-shadow: none; margin: 0; }
  .dropdown-menu > li > a { padding: 12px 30px; }
}

@media (min-width: 768px) {
  .navbar-text { float: left; margin-left: 15px; padding-right: 30px; }
  table .noMobile { display: none; }
  table .noSmall { display: none; }
}

@media (min-width: 992px) {
  /* noTiny/noSmall stays hidden at larger sizes if needed */
}

/* "No messages" empty state */
#wrap > .row > div h4 {
  color: #7f8c8d;
  font-weight: 400;
}
