/* Email CRM custom styles */

/* ── Windows-style menubar nav ─────────────────────────────── */
.nav-menuitem {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 42px;
  color: rgba(255,255,255,.85);
  font-size: .875rem;
  white-space: nowrap;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: background .15s;
}
.nav-menuitem:hover, .nav-menuitem:focus {
  background: rgba(255,255,255,.1);
  color: #fff;
  outline: none;
}
.nav-menuitem--drop { gap: 5px; }

.nav-menu-wrap { position: relative; display: flex; align-items: stretch; }

.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  background: #2b2b2b;
  border: 1px solid rgba(255,255,255,.15);
  border-top: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  z-index: 1050;
  padding: 4px 0;
}
.nav-dropdown.show { display: block; }

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  color: rgba(255,255,255,.85);
  font-size: .875rem;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.nav-dropdown-item:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.nav-dropdown-divider {
  border-top: 1px solid rgba(255,255,255,.1);
  margin: 4px 0;
}

body {
  font-size: 0.9rem;
}

.navbar-brand {
  font-weight: 600;
}

/* Spinning icon for running jobs */
.spin {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* Compact tables */
.table td, .table th {
  vertical-align: middle;
}

/* Score badge colors */
.score-high { color: #198754; font-weight: bold; }
.score-mid  { color: #ffc107; font-weight: bold; }
.score-low  { color: #6c757d; }

/* Card hover */
.card-hover:hover {
  border-color: #0d6efd;
  cursor: pointer;
}

/* Stats grid */
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Log pre */
pre {
  font-size: 0.8rem;
}

/* Fix textarea in dark mode */
textarea.form-control {
  font-family: monospace;
  font-size: 0.85rem;
}

/* ── Action Bar & Dropdown Menus ── */

.action-bar {
  position: relative;
}

.action-menu-wrap {
  position: relative;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--bs-secondary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  color: var(--bs-body-color);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.action-btn:hover {
  background: var(--bs-tertiary-bg);
  border-color: var(--bs-primary);
  color: var(--bs-body-color);
}

.action-btn .arrow {
  font-size: 0.7rem;
  transition: transform 0.2s;
  margin-left: 0.1rem;
}

.action-btn--plain {
  background: transparent;
  border-color: transparent;
  color: var(--bs-secondary-color);
}

.action-btn--plain:hover {
  background: var(--bs-secondary-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-body-color);
}

.action-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 1050;
  overflow: hidden;
  padding: 0.4rem 0;
}

.action-menu.open {
  display: block;
}

.action-menu-section {
  padding: 0.35rem 1rem 0.1rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bs-secondary-color);
}

.action-menu-divider {
  height: 1px;
  background: var(--bs-border-color);
  margin: 0.3rem 0;
}

.action-menu-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  color: var(--bs-body-color);
  text-decoration: none;
  transition: background 0.1s;
}

.action-menu-item:hover {
  background: var(--bs-secondary-bg);
  color: var(--bs-body-color);
}

.action-menu-item i {
  margin-top: 2px;
  font-size: 1rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.action-menu-item--danger:hover {
  background: rgba(220, 53, 69, 0.1);
}

/* Keep dropdown on right side if near right edge */
@media (max-width: 576px) {
  .action-menu {
    min-width: 260px;
    left: 0;
    right: auto;
  }
  .action-menu-wrap:last-of-type .action-menu,
  .action-menu-wrap:nth-last-of-type(2) .action-menu {
    left: auto;
    right: 0;
  }
}

/* ── Mobile / Adaptive ── */

/* Tighter padding on small screens */
@media (max-width: 576px) {
  .container-fluid {
    padding-left: 10px;
    padding-right: 10px;
  }

  body {
    font-size: 0.85rem;
  }

  h4 { font-size: 1.1rem; }
  h3 { font-size: 1.2rem; }

  /* Stack page header buttons below title */
  .page-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.5rem;
  }
  .page-header .btn-toolbar {
    width: 100%;
  }

  /* Full-width buttons on mobile */
  .mobile-full .btn {
    width: 100%;
  }

  /* Narrower stats cards */
  .stat-value {
    font-size: 1.1rem;
  }

  /* Make operation cards take full width */
  .op-card {
    margin-bottom: 0.5rem;
  }

  /* Smaller badges */
  .badge {
    font-size: 0.7rem;
  }

  /* Compact table cells */
  .table-sm td, .table-sm th {
    padding: 0.2rem 0.3rem;
  }
}

/* Contact / Campaign cards on mobile (hide table, show cards) */
.contact-card,
.campaign-card {
  display: none;
}
@media (max-width: 768px) {
  .contact-table-wrapper,
  .campaign-table-wrapper {
    display: none;
  }
  .contact-card,
  .campaign-card {
    display: block;
  }
  /* Wrap filter row items */
  .filter-row {
    flex-direction: column;
  }
  .filter-row .col-md-4,
  .filter-row .col-md-2 {
    width: 100%;
  }
  /* Stack filter forms vertically */
  form .row.g-2 > [class*="col-"] {
    width: 100% !important;
  }
  /* Overflow-safe pre/code blocks */
  pre { overflow-x: auto; word-break: break-all; }
  /* Score threshold input */
  .score-threshold-wrap { flex-wrap: wrap; }
  .score-threshold-wrap input { width: 100% !important; }
}

/* Jobs button groups — wrap nicely on mobile */
.job-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.job-buttons .btn {
  flex: 0 0 auto;
}

/* Sticky bottom action bar on mobile */
@media (max-width: 576px) {
  .mobile-action-bar {
    position: sticky;
    bottom: 0;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
    padding: 0.5rem;
    z-index: 100;
    display: flex;
    gap: 0.5rem;
  }
  .mobile-action-bar .btn {
    flex: 1;
  }
}

/* Subdomain rows */
.subdomain-row td { opacity: 0.75; }
.subdomain-row:hover td { opacity: 1; }

/* Ignored rows in dark mode — ensure text is visible */
tr.table-secondary.text-muted td,
tr.table-secondary.text-muted td a { color: var(--bs-gray-500) !important; }

/* ── Table filter row ── */
.filter-row td { background: var(--bs-gray-900); padding: 2px 4px !important; }
.filter-row input.form-control { font-size: .75rem; padding: 2px 6px; height: 26px; background: var(--bs-gray-800) !important; border-color: var(--bs-gray-700); color: var(--bs-body-color) !important; }
.filter-row input.form-control:focus { background: var(--bs-gray-800) !important; color: var(--bs-body-color) !important; box-shadow: none; }
.filter-row input.form-control::placeholder { color: var(--bs-gray-500); opacity: 1; }

/* multi-choice dropdown filter */
.filter-multi-wrap { position: relative; }
.filter-multi-btn  { font-size: .72rem; padding: 2px 6px; height: 26px; line-height: 1.2; white-space: nowrap; overflow: hidden; max-width: 160px; color: var(--bs-body-color) !important; background: var(--bs-gray-800) !important; border-color: var(--bs-gray-600) !important; }
.filter-multi-btn:hover, .filter-multi-btn:focus { color: var(--bs-body-color) !important; background: var(--bs-gray-700) !important; }
.filter-multi-drop { position: absolute; z-index: 1050; top: 28px; left: 0; min-width: 180px; max-height: 260px; overflow-y: auto;
  background: var(--bs-gray-800); border: 1px solid var(--bs-gray-600); border-radius: 4px; padding: 0;
  color: var(--bs-body-color); }
.filter-multi-search-wrap { padding: 4px 6px; border-bottom: 1px solid var(--bs-gray-700); position: sticky; top: 0; background: var(--bs-gray-800); z-index: 1; }
.filter-multi-search { font-size: .75rem !important; padding: 2px 6px !important; height: 24px !important; background: var(--bs-gray-700) !important; color: var(--bs-body-color) !important; border-color: var(--bs-gray-600) !important; }
.filter-multi-search::placeholder { color: var(--bs-gray-400) !important; opacity: 1; }
.filter-multi-clear { display: block; padding: 2px 10px; font-size: .72rem; color: var(--bs-warning); text-decoration: none; border-bottom: 1px solid var(--bs-gray-700); }
.filter-multi-clear:hover { background: var(--bs-gray-700); color: var(--bs-warning); }
.filter-multi-item { display: flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: .78rem; cursor: pointer; white-space: nowrap; color: var(--bs-body-color); }
.filter-multi-item:hover { background: var(--bs-gray-700); color: var(--bs-body-color); }
.filter-multi-item input { margin: 0; cursor: pointer; }

/* text filter with clear button */
.filter-text-wrap { position: relative; display: flex; align-items: center; }
.filter-text-wrap .form-control { padding-right: 20px; }
.filter-text-clear { position: absolute; right: 3px; background: none; border: none; color: var(--bs-gray-500); font-size: .85rem; line-height: 1; padding: 0 2px; cursor: pointer; display: none; }
.filter-text-wrap.has-value .filter-text-clear { display: block; }

/* clear all filters button */
.filter-clear-all { font-size: .75rem; margin-bottom: 4px; }

/* sort indicator */
.sort-ind { opacity: .45; font-size: .75em; }
thead th:hover .sort-ind { opacity: 1; }
thead th { white-space: nowrap; }
