/* ============================================================
   styles-additions-v17.css — Mega-batch 2 feature styles

   Loads AFTER styles-additions-v16.css. Holds MB2-specific feature
   styling that doesn't generalize to a primitive.

   Sections:
     1. Page-header action button (.std-page-header-action)
     2. Activity picker modal (.apm-*)
     3. Contact edit modal account select (.cem-account-section)
     4. Email Outreach page header compose button
   ============================================================ */

/* ============================================================
   1. PAGE-HEADER ACTION BUTTON

   The "+ New" button rendered in the right side of standalone
   page headers (Companies / Contacts / Activities / Email Outreach).
   Sits next to the page title.
   ============================================================ */

.std-page-header-action {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--text-primary);
  color: var(--bg-page);
  border: 0;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--motion-fast) var(--easing-out);
}

.std-page-header-action:hover { opacity: 0.85; }

.std-page-header-action-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.std-page-header-action-secondary:hover {
  background: var(--bg-elev-2);
  opacity: 1;
}

/* Page-header layout adjustment so action button sits on the right */
.page-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.page-header-left {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ============================================================
   2. ACTIVITY PICKER MODAL (.apm-*)

   Two big tappable cards. Used from "+ New activity" on Activities
   page to choose between past-log and future-schedule.
   ============================================================ */

.apm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
  z-index: 9200;  /* below cem-overlay's 9400, above standard modals */
  overflow-y: auto;
}

.apm-overlay.apm-open { display: flex; }

.apm-modal {
  background: var(--bg-elev-1);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--font-sans);
  animation: apm-rise 0.2s var(--easing-out);
}

@keyframes apm-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.apm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.apm-header h2 {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.apm-close {
  background: transparent;
  border: 0;
  font-size: var(--text-xl);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 var(--space-1);
  line-height: 1;
}

.apm-close:hover { color: var(--text-primary); }

.apm-body {
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.apm-prompt {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
  margin: 0 0 var(--space-3);
}

.apm-choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-2_5);
}

.apm-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--bg-elev-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: background var(--motion-fast) var(--easing-out),
              border-color var(--motion-fast) var(--easing-out),
              transform var(--motion-fast) var(--easing-out);
}

.apm-choice:hover {
  background: var(--bg-elev-1);
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.apm-choice-icon {
  font-size: var(--text-2xl);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.apm-choice-title {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.apm-choice-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

@media (max-width: 480px) {
  .apm-overlay { padding: 4vh 8px 16px; }
  .apm-choice  { padding: var(--space-3); }
}

/* ============================================================
   3. CONTACT EDIT MODAL — ACCOUNT SELECT SECTION

   New "Account" select dropdown. Sits between the name and email
   inputs to make company linking visible at the top of the form.
   ============================================================ */

.cem-account-section {
  padding: var(--space-1) var(--space-5) var(--space-2);
}

.cem-account-section label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
  margin-bottom: var(--space-1);
}

.cem-account-select {
  width: 100%;
  padding: var(--space-2) var(--space-2_5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
}

.cem-account-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.cem-account-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
  font-style: italic;
}

/* In create mode, the Delete button is hidden and the title changes */
.cem-overlay.cem-create-mode .cem-delete-btn { display: none; }

/* ============================================================
   4. EMAIL OUTREACH PAGE HEADER COMPOSE BUTTON

   Header button at the top of #email-outreach-root, parallel to the
   "+ New" buttons on standalone pages.
   ============================================================ */

.eos-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.eos-header-compose {
  margin-left: auto;
}

/* Reuse .std-page-header-action class for the compose button —
   defined in section 1. */

/* ============================================================
   MB2.1 — Back buttons in chained modal headers
   ============================================================ */

.apm-back-btn,
.tm-back-btn {
  background: transparent;
  border: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  align-self: flex-start;
}

.apm-back-btn { margin-bottom: var(--space-2); }
.tm-back-btn  { margin-right: auto; }

.apm-back-btn:hover,
.tm-back-btn:hover {
  background: var(--bg-elev-2);
  color: var(--text-primary);
}

/* MB2.1 — Hide AccountEditModal Delete button in create mode */
.aem-overlay.aem-create-mode .aem-delete { display: none; }
