/**
 * Company Activities Tab Styles
 * 
 * Styling for the activities tab that displays email and LinkedIn conversations
 * Matches HubSpot-style activity feed design
 */

/* Modal Sizing */
.activities-modal-content {
  max-width: 1200px !important;
  width: 95% !important;
  max-height: 85vh !important;
}

.activities-modal-header {
  background: #f7f7f7 !important;
  border-bottom: 1px solid #ddd !important;
  padding: 16px 24px !important;
}

.activities-modal-header h3 {
  font-size: 18px !important;
  color: #33475b !important;
  font-weight: 600 !important;
}

.activities-modal-body {
  padding: 0 !important;
  background: #f7f7f7 !important;
  overflow-y: auto;
  overflow-x: visible;
  max-height: calc(85vh - 70px);
}

/* Allow dropdowns to overflow properly */
.activities-filter-bar {
  position: relative;
  z-index: 10;
  overflow: visible;
}

/* Tabs Section */
.activities-tabs {
  display: flex;
  gap: 0;
  background: #fff;
  border-bottom: 2px solid #e5e7eb;
  padding: 0 24px;
}

.activity-tab {
  padding: 14px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  transition: all 0.2s ease;
  position: relative;
  margin-bottom: -2px;
}

.activity-tab:hover {
  color: #30a5bf;
}

.activity-tab.active {
  color: #30a5bf;
  border-bottom-color: #30a5bf;
}

/* Filter Bar */
.activities-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.activities-filter-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.activities-filter-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-label {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

.activities-filter-dropdown {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.activities-filter-dropdown:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.activities-filter-dropdown.add-account-btn {
  background: #30a5bf;
  color: white;
  border-color: #30a5bf;
  font-weight: 600;
}

.activities-filter-dropdown.add-account-btn:hover {
  background: #2891a8;
  border-color: #2891a8;
}

/* Contact Filter */
.contact-filter-container {
  position: relative;
  display: inline-block;
}

.contact-filter-dropdown {
  position: fixed;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 320px;
  max-width: 400px;
  max-height: 450px;
  z-index: 10000;
  display: none;
  overflow: visible;
}

.contact-filter-dropdown.show {
  display: block;
}

.contact-filter-header {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.contact-filter-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  outline: none;
}

.contact-filter-search:focus {
  border-color: #30a5bf;
  box-shadow: 0 0 0 2px rgba(48, 165, 191, 0.1);
}

.contact-filter-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px 0;
}

.contact-filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.contact-filter-option:hover {
  background: #f9fafb;
}

.contact-filter-option.all-contacts {
  font-weight: 600;
  background: #f9fafb;
}

.contact-filter-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.contact-filter-info {
  flex: 1;
  min-width: 0;
}

.contact-filter-name {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-filter-email {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-filter-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 8px 0;
}

.contact-filter-footer {
  padding: 8px 12px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
}

.btn-text {
  background: none;
  border: none;
  color: #30a5bf;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.btn-text:hover {
  background: rgba(48, 165, 191, 0.1);
}

/* Timeline Container */
.activities-timeline {
  padding: 24px;
  background: #f7f7f7;
  min-height: 200px;
}

/* Date Sections */
.activity-date-section {
  margin-bottom: 32px;
}

.activity-date-header {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

/* Activity Items - Timeline Style */
.activity-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.activity-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-color: #d1d5db;
}

.activity-item-header {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.activity-item-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #6b7280;
}

.activity-item-icon.email {
  color: #30a5bf;
}

.activity-item-icon.linkedin {
  color: #0077b5;
}

.activity-item-content {
  flex: 1;
  min-width: 0;
}

.activity-item-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.activity-type-badge {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.activity-subject {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 6px;
}

.activity-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}

.activity-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.activity-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #d1fae5;
  color: #065f46;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.activity-preview {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.activity-item-expand {
  margin-left: auto;
  color: #9ca3af;
  transition: transform 0.2s ease;
  font-size: 16px;
}

.activity-item.expanded .activity-item-expand {
  transform: rotate(180deg);
}

.activity-item-body {
  display: none;
  padding: 0 20px 20px 56px;
  border-top: 1px solid #f3f4f6;
  background: #f9fafb;
}

.activity-item.expanded .activity-item-body {
  display: block;
}

.activity-body-content {
  padding: 16px 0;
  font-size: 14px;
  color: #374151;
  line-height: 1.6;
}

/* Contact Info in Activity */
.activity-contact-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6b7280;
}

.activity-contact-name {
  font-weight: 600;
  color: #111827;
}

/* Loading and Empty States */
.activities-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background: #fff;
  border-radius: 6px;
  margin: 20px;
}

.activities-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.activities-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background: #fff;
  border-radius: 6px;
  margin: 20px;
  text-align: center;
}

.activities-empty-icon {
  font-size: 48px;
  color: #d1d5db;
  margin-bottom: 16px;
}

.activities-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.activities-empty-text {
  font-size: 14px;
  color: #6b7280;
  max-width: 400px;
}

.activities-error {
  padding: 20px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  margin: 20px;
  color: #991b1b;
  font-size: 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Account Cards */
.account-card {
  margin-bottom: 12px;
}

.account-header {
  display: flex;
  align-items: center;
  padding: 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.account-header:hover {
  background: #f9fafb;
}

.account-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.account-icon .far.fa-envelope {
  color: #30a5bf;
  font-size: 18px;
}

.account-icon .fab.fa-linkedin {
  color: #0077b5;
  font-size: 18px;
}

.account-info {
  flex: 1;
}

.account-name {
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.account-type {
  color: #666;
  font-size: 12px;
  margin-top: 2px;
}

.account-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Inline Compose Email Button - Pill Style */
.compose-email-btn-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #157455;
  border: 1px solid #157455;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.compose-email-btn-inline:hover:not(:disabled) {
  background: #f0fdf4;
  border-color: #059669;
  color: #059669;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.2);
}

.compose-email-btn-inline:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #f0f0f0;
  border-color: #d0d0d0;
  color: #999;
}

.compose-email-btn-inline i {
  font-size: 11px;
}

/* Folder Selector */
.folder-selector-container {
  position: relative;
  display: inline-block;
}

.folder-selector-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #e0e7ff;
  color: #4f46e5;
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #c7d2fe;
  cursor: pointer;
  transition: all 0.2s;
}

.folder-selector-badge:hover {
  background: #c7d2fe;
  border-color: #a5b4fc;
  color: #4338ca;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.15);
}

.folder-selector-badge i.far {
  font-size: 11px;
}

.folder-selector-badge i.fas {
  font-size: 9px;
}

.folder-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 140px;
  z-index: 1000;
  display: none;
}

.folder-dropdown.show {
  display: block;
}

.folder-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s;
}

.folder-option:first-child {
  border-radius: 6px 6px 0 0;
}

.folder-option:last-child {
  border-radius: 0 0 6px 6px;
}

.folder-option:hover {
  background: #f9fafb;
}

.folder-option.active {
  background: #f0f4ff;
  color: #4f46e5;
  font-weight: 600;
}

.folder-option i {
  font-size: 12px;
  width: 14px;
  text-align: center;
}

.account-activity-badge {
  background: #1f2937;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.account-badge-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: badge-spin 0.7s linear infinite;
}

@keyframes badge-spin {
  to { transform: rotate(360deg); }
}

.delete-account-btn {
  padding: 8px;
  color: #dc2626;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 4px;
  transition: background 0.2s;
}

.delete-account-btn:hover {
  background: #fee2e2;
}

.account-header .expand-icon {
  color: #9ca3af;
  transition: transform 0.2s;
}

.account-card.expanded .expand-icon {
  transform: rotate(180deg);
}

.account-activities {
  display: none;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: #f9fafb;
}

.account-activities.expanded {
  display: block;
}

.account-empty-state {
  text-align: center;
  padding: 24px;
  color: #666;
  font-size: 14px;
}

.account-empty-state .far.fa-inbox {
  font-size: 32px;
  color: #d1d5db;
  margin-bottom: 8px;
  display: block;
}

/* Account Activities Loading State */
.account-activities-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: #f9fafb;
}

.account-activities-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #30a5bf;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.account-activities-loading-text {
  margin-top: 12px;
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

/* Pagination */
.activities-pagination {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: #f7f7f7;
  border-top: 1px solid #e5e7eb;
}

.account-pagination {
  display: flex;
  justify-content: center;
  padding: 12px 16px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.pagination-btn-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  color: #30a5bf;
  border: 1.5px solid #30a5bf;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn-inline:hover {
  background: rgba(48, 165, 191, 0.05);
  border-color: #2891a8;
  color: #2891a8;
}

.pagination-btn-inline:active {
  background: rgba(48, 165, 191, 0.1);
}

.pagination-btn-inline:disabled {
  border-color: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.pagination-btn-inline:disabled:hover {
  background: transparent;
}

.pagination-btn-inline i {
  font-size: 11px;
}

.pagination-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: #30a5bf;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pagination-btn:hover {
  background: #2891a8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.pagination-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.pagination-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  opacity: 0.6;
}

.pagination-btn i {
  font-size: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .activities-modal-content {
    width: 95% !important;
    max-height: 90vh !important;
  }
  
  .activities-tabs {
    padding: 0 16px;
  }
  
  .activity-tab {
    padding: 12px 14px;
    font-size: 13px;
  }
  
  .activities-filter-bar {
    padding: 12px 16px;
  }
  
  .activities-timeline {
    padding: 16px;
  }
  
  .activity-item-header {
    padding: 12px 16px;
  }
  
  .activity-item-body {
    padding: 0 16px 16px 48px;
  }
  
  .pagination-btn {
    width: 100%;
    justify-content: center;
  }
  
  .pagination-btn-inline {
    font-size: 12px;
    padding: 6px 12px;
  }
}
