/* ============================================
   CASE ACTIVITIES — Additional Styles
   Builds on top of style.css
   ============================================ */

/* ============================================
   CSS VARS (fallback if style.css not loaded)
   ============================================ */
.nav-dropdown, .dropdown-menu, .modal, .modal-overlay, .modal-backdrop,
.table-section, .party-form-section, .activities-placeholder {
  --navy:       #0a1628;
  --navy-mid:   #0f2044;
  --navy-light: #1a3360;
  --accent:     #2e7de9;
  --gold:       #c9a84c;
  --gold-light: #e8c96a;
  --white:      #ffffff;
  --off-white:  #f4f7fc;
  --border:     #d0ddef;
  --text-dark:  #0d1f3c;
  --text-mid:   #4a6080;
  --text-light: #8aa0bc;
  --success:    #1aab6d;
  --danger:     #e5405e;
  --radius:     12px;
  --radius-sm:  7px;
  --card-shadow: 0 4px 24px rgba(10,22,40,0.10);
  --transition: 0.2s ease;
}

/* ---- NAV DROPDOWN ---- */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-trigger {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.dropdown-arrow {
  font-size: 10px !important;
  transition: transform 0.2s ease;
  margin-left: 2px;
}

.nav-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--navy-mid);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  min-width: 260px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
  z-index: 500;
  overflow: hidden;
  animation: dropDown 0.18s ease forwards;
}

@keyframes dropDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nav-dropdown.open .dropdown-menu { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.dropdown-item:last-child { border-bottom: none; }

.dropdown-item i {
  width: 18px;
  text-align: center;
  color: var(--accent);
  font-size: 13px;
  flex-shrink: 0;
}

.dropdown-item:hover {
  background: rgba(46,125,233,0.15);
  color: #fff;
}

.dropdown-item:hover i { color: var(--gold); }

.di-text { display: flex; flex-direction: column; }
.di-text span { line-height: 1.3; }
.di-text small {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.5px;
}

.dropdown-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 4px 0;
}

/* ---- ACTIVITIES PLACEHOLDER ---- */
.activities-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 32px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid rgba(208,221,239,0.6);
  box-shadow: var(--card-shadow);
  animation: fadeSlideUp 0.4s ease forwards;
  opacity: 0;
  transform: translateY(12px);
}

.placeholder-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, rgba(46,125,233,0.12), rgba(46,125,233,0.06));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 20px;
}

.activities-placeholder h3 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--navy);
  margin-bottom: 10px;
}

.activities-placeholder p {
  font-size: 14.5px;
  color: var(--text-mid);
  max-width: 380px;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ---- MODAL OVERLAY ---- */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 12, 30, 0.65);
  backdrop-filter: blur(4px);
  z-index: 900;
}
.modal-backdrop.active { display: block; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

/* ---- MODAL BOX ---- */
.modal {
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
  animation: modalIn 0.25s cubic-bezier(0.34,1.56,0.64,1) forwards;
  overflow: hidden;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.93) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  background: linear-gradient(90deg, var(--navy), var(--navy-light));
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-icon {
  width: 42px; height: 42px;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-light, #e8c96a);
  font-size: 18px;
  flex-shrink: 0;
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}

.modal-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.modal-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.7);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.modal-close:hover { background: rgba(229,64,94,0.3); color: #fff; }

/* ---- MODAL BODY ---- */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Table Section */
.table-section {
  padding: 20px 24px 0;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.table-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.table-label i { color: var(--accent); }

.table-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--off-white);
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 6px 12px;
}

.table-search i { color: var(--text-light); font-size: 12px; }

.table-search input {
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text-dark);
  outline: none;
  width: 180px;
}

.table-wrapper {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.entities-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.entities-table thead tr {
  background: var(--navy);
}

.entities-table thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
}

.entities-table tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}

.entities-table tbody tr:last-child { border-bottom: none; }
.entities-table tbody tr:hover { background: rgba(46,125,233,0.05); }
.entities-table tbody tr.selected { background: rgba(46,125,233,0.08); }

.entities-table tbody td {
  padding: 11px 14px;
  color: var(--text-dark);
  vertical-align: middle;
}

.role-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
}

.role-badge.claimant {
  background: rgba(46,125,233,0.12);
  color: #1e5dba;
  border: 1px solid rgba(46,125,233,0.25);
}

.role-badge.defendant {
  background: rgba(229,64,94,0.1);
  color: #c02040;
  border: 1px solid rgba(229,64,94,0.2);
}

.role-badge.witness {
  background: rgba(232,149,45,0.1);
  color: #b06010;
  border: 1px solid rgba(232,149,45,0.2);
}

.role-badge.attorney {
  background: rgba(26,171,109,0.1);
  color: #0e7a50;
  border: 1px solid rgba(26,171,109,0.2);
}

.btn-detach {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-mid);
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.btn-detach:hover { background: rgba(229,64,94,0.1); border-color: var(--danger); color: var(--danger); }

/* Party Form Section */
.party-form-section {
  margin: 16px 24px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.party-form-header {
  background: var(--off-white);
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.party-form-header i { color: var(--accent); }

.party-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px;
}

.party-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--off-white);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.detach-warning {
  font-size: 13px;
  color: var(--danger);
  font-weight: 500;
}

.entity-num {
  font-size: 12.5px;
  color: var(--text-mid);
  font-weight: 500;
}

.entity-num span {
  font-weight: 700;
  color: var(--navy);
}

/* ---- MODAL FOOTER ---- */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--off-white);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- TOAST (reuse from style.css) ---- */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--navy);
  color: #fff;
  padding: 13px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  border-left: 4px solid var(--accent);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(.34,1.56,.64,1);
  z-index: 9999;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
  .dropdown-menu { min-width: 220px; }
  .party-form-grid { grid-template-columns: 1fr; }
  .modal { max-height: 95vh; border-radius: 12px; }
  .modal-footer { flex-direction: column; }
  .modal-footer-left { justify-content: center; }
  .table-search input { width: 120px; }
}

/* ============================================
   ENTITY SEARCH MODAL EXTRAS
   ============================================ */

.modal-lg {
  max-width: 1000px;
}

/* Search bar row */
.entity-search-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 16px 24px 14px;
  background: var(--off-white);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.esb-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.esb-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.esb-input { min-width: 140px; }
.esb-name { flex: 1; }
.esb-name .esb-input { width: 100%; }

.esb-btn {
  flex-shrink: 0;
  white-space: nowrap;
  height: 40px;
  align-self: flex-end;
}

.esb-btn kbd {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: monospace;
  margin-left: 4px;
}

/* Table hints */
.table-hint {
  font-size: 11.5px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 5px;
}

.empty-results {
  text-align: center;
  padding: 28px !important;
  color: var(--text-light);
  font-size: 13.5px;
}

.empty-results i { margin-right: 8px; color: var(--accent); }

.selected-entity { background: rgba(46,125,233,0.1) !important; }

/* 3-column entity form */
.entity-form-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  padding: 16px;
}

.entity-col {
  padding: 0 12px;
  border-right: 1px solid var(--border);
}

.entity-col:first-child { padding-left: 0; }
.entity-col:last-child  { padding-right: 0; border-right: none; }

.entity-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.entity-checkboxes .checkbox-label {
  font-size: 12.5px;
  line-height: 1.4;
}

/* Entity Features dropdown — opens upward */
.ef-dropdown { position: relative; }

.ef-menu {
  bottom: calc(100% + 8px) !important;
  top: auto !important;
  left: 0;
  min-width: 280px;
}

.ef-btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .entity-form-3col { grid-template-columns: 1fr; }
  .entity-col { border-right: none; border-bottom: 1px solid var(--border); padding: 12px 0; }
  .entity-col:last-child { border-bottom: none; }
  .entity-search-bar { flex-direction: column; align-items: stretch; }
  .modal-lg { max-width: 100%; }
}