/* ==========================================================================
   Matrix OSINT — Team Activity & My Activity Stylesheet
   Matches exact light theme (#F6F7F9 base, #FFFFFF cards, #E2E8F0 borders)
   and dark theme seamlessly with responsive desktop (1440px) to mobile (360px).
   ========================================================================== */

/* --- Container & Layout --- */
.activity-workspace {
  padding: 24px 32px 48px;
  max-width: 1440px;
  margin: 0 auto;
  box-sizing: border-box;
  animation: fadeInActivity 0.25s ease-out;
}

@keyframes fadeInActivity {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Top View Toggle Pill Bar --- */
.activity-view-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 20px;
}

.activity-toggle-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  padding: 3px;
  gap: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.activity-toggle-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.activity-toggle-btn:hover:not(.active) {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.activity-toggle-btn.active {
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}

body.dark-theme .activity-toggle-btn.active {
  background: #3b82f6;
  color: #ffffff;
}

.activity-toggle-btn.disabled,
.activity-toggle-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Page Header & Subtitle --- */
.activity-header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.activity-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.activity-page-title {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.25;
}

.activity-page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.activity-tracking-since {
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  font-weight: 500;
}

/* --- Timeframe Filter Buttons --- */
.activity-controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.activity-timeframe-btns {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 2px;
}

.act-tf-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.act-tf-btn:hover:not(.active) {
  color: var(--text-primary);
}

.act-tf-btn.active {
  background: var(--bg-subtle);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

body.light-theme .act-tf-btn.active {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

/* User Profile Badge (for My Activity header) */
.user-profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
}

body.dark-theme .user-profile-pill {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

/* --- Card Grids --- */
.activity-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.activity-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.activity-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* --- Metric KPI Cards --- */
.act-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 104px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.act-kpi-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.act-kpi-card.card-danger-tint {
  background: #fff8f8;
  border-color: #fecaca;
}

body.dark-theme .act-kpi-card.card-danger-tint {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.25);
}

.act-kpi-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.act-kpi-val-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.act-kpi-number {
  font-family: var(--font-sans);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
}

.act-kpi-card.card-danger-tint .act-kpi-number {
  color: #dc2626;
}

.act-kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.act-kpi-sub-stats {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Today's Goal Card (My Activity) --- */
.act-goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.act-goal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.act-goal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.act-goal-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.goal-progress-bar {
  width: 100%;
  height: 9px;
  background: var(--bg-subtle);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.goal-progress-fill {
  height: 100%;
  background: #10b981;
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Structured Section Cards --- */
.act-panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
}

.act-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.act-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.act-panel-badge {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: lowercase;
}

.badge-live-tag {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  letter-spacing: 0.03em;
}

.badge-attention-tag {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
}

/* --- User Progress Bar Rows (Team Activity) --- */
.act-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.act-user-row:hover {
  background: var(--bg-subtle-hover);
}

.act-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.dark-theme .act-avatar-circle {
  background: #312e81;
  color: #c7d2fe;
}

.act-user-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.act-user-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.act-user-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.act-user-bar-fill.blue {
  background: #3b82f6;
}

.act-user-bar-fill.green {
  background: #10b981;
}

.act-user-bar-fill.grey {
  background: #cbd5e1;
}

.act-user-row-count {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

.act-user-row-count.is-zero {
  color: var(--text-muted);
}

/* --- Who is Online List --- */
.act-online-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.act-online-row:last-child {
  border-bottom: none;
}

.act-online-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.act-online-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.act-role-pill {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 7px;
  font-weight: 500;
}

.act-loc-pill {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 6px;
}

.act-loc-pill.idle {
  color: #94a3b8;
  font-style: italic;
}

/* --- Security Events Feed --- */
.act-sec-event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

.act-sec-event-row:last-child {
  border-bottom: none;
}

.act-sec-desc {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.act-sec-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* --- Status Dots --- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.green {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.status-dot.red {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.status-dot.orange {
  background: #f59e0b;
}

.status-dot.grey {
  background: #94a3b8;
}

/* --- Unreviewed Alerts List (My Activity) --- */
.act-alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 10px;
  font-size: 12.5px;
}

.act-alert-item:last-child {
  border-bottom: none;
}

.act-alert-desc {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.act-alert-time {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.btn-act-review {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-act-review:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

body.dark-theme .btn-act-review:hover {
  background: #3b82f6;
  border-color: #3b82f6;
}

/* --- Metric Rows (My keywords and targets) --- */
.act-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.act-stat-row:last-child {
  border-bottom: none;
}

.act-stat-label {
  color: var(--text-secondary);
}

.act-stat-value {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* --- Login History List --- */
.act-login-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

.act-login-item:last-child {
  border-bottom: none;
}

.act-login-device {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.act-login-ip {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.act-login-footer {
  margin-top: 10px;
  padding-top: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.act-login-footer a {
  color: var(--accent-primary);
  text-decoration: underline;
  cursor: pointer;
}

/* --- Empty / Error / Retry States --- */
.activity-unavailable-box {
  padding: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.activity-unavailable-text {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-activity-retry {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-activity-retry:hover {
  background: var(--bg-subtle-hover);
}

/* --- User Drilldown Modal --- */
.act-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInActivity 0.15s ease-out;
}

.act-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.act-modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.act-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.act-modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

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

/* --- New IP Badge & Unknown Target Link --- */
.act-new-ip-badge {
  display: inline-block;
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #b45309;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

body.dark-theme .act-new-ip-badge {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.act-unknown-target-link {
  color: var(--text-secondary);
  font-style: italic;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.act-unknown-target-link:hover {
  color: var(--accent-primary);
}

/* --- Responsive Layouts --- */
@media (max-width: 1100px) {
  .activity-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }
  .activity-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .activity-workspace {
    padding: 12px 12px 40px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .activity-grid-5 {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    box-sizing: border-box;
  }
  .activity-grid-2 {
    grid-template-columns: 1fr;
    width: 100%;
    box-sizing: border-box;
  }
  .activity-grid-4 {
    grid-template-columns: 1fr;
    width: 100%;
    box-sizing: border-box;
  }
  .act-user-row-name {
    width: 80px;
  }
}

@media (max-width: 480px) {
  .activity-workspace {
    padding: 8px 8px 48px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden;
  }
  .activity-view-toggle-bar {
    width: 100%;
    margin-bottom: 12px;
  }
  .activity-toggle-group {
    width: 100%;
    display: flex;
    box-sizing: border-box;
  }
  .activity-toggle-btn {
    flex: 1;
    text-align: center;
    padding: 6px 8px;
    font-size: 11px;
    white-space: normal;
  }
  .activity-header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
  }
  .activity-controls-right {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  .activity-timeframe-btns {
    width: 100%;
    display: flex;
    box-sizing: border-box;
  }
  .act-tf-btn {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    font-size: 11.5px;
  }
  .activity-grid-5,
  .activity-grid-4,
  .activity-grid-2 {
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
  }
  .act-kpi-card,
  .act-panel-card {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
  }
}
