/**
 * Campaigns View Styles
 * EXACT MATCH to insights-view.css design
 */

/* Campaigns View Container */
#campaigns-view-container {
  width: 100%;
  background: transparent;
}

/* Campaigns Controls Wrapper */
.campaigns-controls-wrapper {
  margin-bottom: 20px;
  background: transparent;
}

/* Campaigns View Controls - matches insights-view */
.campaigns-view-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  gap: 15px;
}

.campaigns-view-actions {
  display: flex;
  gap: 8px;
}

.campaigns-view-filters {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

.campaigns-view-controls .btn {
  text-decoration: none;
  background: white;
  box-shadow: 0px 3px 10px #0000001a;
  color: #4b5563;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #e4e7ee;
  transition: all 0.2s ease;
  margin-bottom: 0 !important;
  text-transform: none !important;
}

.campaigns-view-controls .btn-primary {
  background: #30a5bf;
  color: white;
  border-color: #30a5bf;
}

.campaigns-view-controls .btn-primary:hover {
  opacity: 0.9;
}

.campaigns-view-controls .btn-secondary {
  background: white;
  color: #4b5563;
}

.campaigns-view-controls .btn-secondary:hover {
  background: #f9fafb;
  border-color: #30a5bf;
  color: #30a5bf;
}

.campaigns-view-controls .btn i {
  font-size: 14px;
}

/* Table Outer Wrapper */
.campaigns-table-outer-wrapper {
  position: relative;
  width: 100%;
}

/* Table Wrapper - matches insights-view */
.campaigns-table-wrapper {
  width: 100%;
  position: relative;
  overflow-x: auto;
  background-color: #fff;
  border-radius: 4px;
}

/* Table Styling - matches insights-view exactly */
.campaigns-table {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background-color: #fff;
}

.campaigns-table thead {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #EDEEF4;
}

.campaigns-table thead tr {
  background-color: #EDEEF4;
}

.campaigns-table th {
  padding: 10px 6px;
  font-weight: bold;
  font-size: 13px;
  color: #555;
  text-align: left;
  line-height: 14px;
  background-color: #EDEEF4;
  border-bottom: 1px solid #F3F3F3;
  position: sticky;
  top: 0;
}

.campaigns-table th .th-content {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 10px;
}

.campaigns-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.campaigns-table th.sortable:hover {
  background-color: #e0e2e8;
}

/* Sort icons - Lucide move-up / move-down DOM elements */
.campaigns-table .sort-icons {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  flex-shrink: 0;
  gap: 0;
}
.campaigns-table .sort-icons i,
.campaigns-table .sort-icons svg {
  display: block !important;
  width: 10px !important;
  height: 10px !important;
  margin: 0 -2px;
  opacity: 0.7;
  color: #222;
  stroke-width: 3;
  flex-shrink: 0;
  transition: opacity 0.15s, color 0.15s;
  cursor: pointer;
}
.campaigns-table .sort-up-icon:hover svg,
.campaigns-table .sort-up-icon:hover {
  opacity: 1 !important;
  color: #30a5bf !important;
}
.campaigns-table .sort-down-icon:hover svg,
.campaigns-table .sort-down-icon:hover {
  opacity: 1 !important;
  color: #30a5bf !important;
}
.campaigns-table th.sort-asc .sort-up-icon,
.campaigns-table th.sort-asc .sort-up-icon svg {
  opacity: 1 !important;
  color: #30a5bf !important;
}
.campaigns-table th.sort-desc .sort-down-icon,
.campaigns-table th.sort-desc .sort-down-icon svg {
  opacity: 1 !important;
  color: #30a5bf !important;
}

/* Filter buttons in table headers */
.campaigns-table .th-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 1px 3px;
  opacity: 0.75;
  border-radius: 3px;
  line-height: 1;
  vertical-align: middle;
  transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.campaigns-table .th-filter-btn:hover {
  opacity: 1;
  color: #30a5bf;
}

.campaigns-table .th-filter-btn.active {
  opacity: 1;
  color: #30a5bf;
}

.campaigns-table .th-filter-btn svg {
  display: block;
  width: 12px !important;
  height: 12px !important;
  pointer-events: none;
}

.campaigns-table tbody tr {
  background-color: #fff;
  transition: background-color 0.2s;
  border-bottom: 1px solid #F3F3F3;
}

.campaigns-table tbody tr:hover {
  background-color: #f9fafb;
}

.campaigns-table th:first-child {
  padding-left: 10px;
}

.campaigns-table td:first-child {
  padding-left: 10px;
}

.campaigns-table td {
  padding: 8px 6px;
  font-size: 13px;
  color: #30a5bf;
  text-align: left;
  border-bottom: 1px solid #F3F3F3;
  vertical-align: middle;
}

/* Column widths */
.campaigns-table th:nth-child(1), 
.campaigns-table td:nth-child(1) {
  width: 16%;
  min-width: 180px;
}

.campaigns-table th:nth-child(2), 
.campaigns-table td:nth-child(2) {
  width: 10%;
  min-width: 110px;
}

.campaigns-table th:nth-child(3), 
.campaigns-table td:nth-child(3) {
  width: 7%;
  min-width: 85px;
}

.campaigns-table th:nth-child(4), 
.campaigns-table td:nth-child(4) {
  width: 11%;
  min-width: 120px;
}

.campaigns-table th:nth-child(5), 
.campaigns-table td:nth-child(5) {
  width: 7%;
  min-width: 70px;
}

.campaigns-table th:nth-child(6), 
.campaigns-table td:nth-child(6) {
  width: 8%;
  min-width: 80px;
}

.campaigns-table th:nth-child(7), 
.campaigns-table td:nth-child(7) {
  width: 18%;
  min-width: 180px;
}

.campaigns-table th:nth-child(8), 
.campaigns-table td:nth-child(8) {
  width: 8%;
  min-width: 100px;
}

.campaigns-table th:nth-child(9), 
.campaigns-table td:nth-child(9) {
  width: auto;
  min-width: 130px;
}

/* Company Name Cell */
.campaigns-company-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.campaigns-company-name-cell a {
  color: #30a5bf;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.campaigns-company-name-cell a:hover {
  text-decoration: underline;
  color: #2891a8;
}

.campaigns-company-name-cell .fa-external-link-alt {
  opacity: 0.5;
  font-size: 10px;
}

/* Campaign Name Cell */
.campaign-name-cell {
  font-weight: 500;
  color: #30a5bf;
}

.campaign-name-clickable {
  color: #30a5bf;
  cursor: pointer;
  text-decoration: none;
}

.campaign-name-clickable:hover {
  text-decoration: underline;
  color: #2891a8;
}

/* Status Badge */
.campaign-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.campaign-status-badge.status-draft {
  background: #e9ecef;
  color: #495057;
}

.campaign-status-badge.status-active {
  background: #d4edda;
  color: #155724;
}

.campaign-status-badge.status-paused {
  background: #fff3cd;
  color: #856404;
}

.campaign-status-badge.status-completed {
  background: #d1ecf1;
  color: #0c5460;
}

.campaign-status-badge.status-cancelled {
  background: #f8d7da;
  color: #721c24;
}

/* Campaign Type Badge */
.campaign-type-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: #f8f9fa;
  color: #495057;
  border: 1px solid #dee2e6;
}

/* Stats Cell */
.stats-cell {
  font-size: 12px;
  color: #6c757d;
}

.stats-number {
  font-weight: 600;
  color: #30a5bf;
  font-size: 14px;
}

/* Engagement Metrics */
.engagement-metrics {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
}

.engagement-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.metric-label {
  color: #6c757d;
  font-weight: 500;
}

.metric-value {
  font-weight: 600;
  color: #30a5bf;
}

.metric-value.high {
  color: #28a745;
}

.metric-value.medium {
  color: #ffc107;
}

.metric-value.low {
  color: #dc3545;
}

/* Owners Cell - matches insights-view exactly */
.campaigns-table .owners-cell {
  cursor: pointer;
}

.campaigns-table .owners-preview-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-right: 10px;
}

.campaigns-table .owner-item-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.campaigns-table .owner-name {
  font-weight: 500;
  color: #2c3e50;
  font-size: 12px;
}

/* Owners Count Badge */
.campaigns-table .owners-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #30a5bf;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
}

/* Actions Cell */
.campaigns-actions-cell {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Action Buttons - matching insights style */
.campaigns-action-btn {
  padding: 6px 12px;
  border: 1px solid #e4e7ee;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  box-shadow: 0px 3px 10px #0000001a;
}

.campaigns-action-btn.btn-create {
  background: #30a5bf;
  color: white;
  border-color: #30a5bf;
}

.campaigns-action-btn.btn-create:hover {
  opacity: 0.9;
}

.campaigns-action-btn.btn-view {
  background: white;
  color: #4b5563;
  border-color: #e4e7ee;
}

.campaigns-action-btn.btn-view:hover {
  background: #f9fafb;
  border-color: #30a5bf;
  color: #30a5bf;
}

.campaigns-action-btn.btn-delete {
  background: white;
  color: #dc3545;
  border-color: #e4e7ee;
}

.campaigns-action-btn.btn-delete:hover {
  background: #f8d7da;
  color: #c82333;
  border-color: #f5c6cb;
}

.campaigns-action-btn i {
  font-size: 11px;
}

/* Empty State */
.campaigns-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
}

.campaigns-empty-state i {
  font-size: 48px;
  color: #dee2e6;
  margin-bottom: 16px;
}

.campaigns-empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
}

.campaigns-empty-state p {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 0;
}

/* Loading States */
.campaigns-row-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6c757d;
  font-style: italic;
}

.campaigns-row-loading .tab-loader-spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.campaigns-row-loading span {
  font-size: 12px;
}

/* Error States */
.campaigns-table-error {
  text-align: center;
  padding: 40px 20px;
  color: #dc3545;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  margin: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* No campaigns message - matches insights style */
.no-campaigns-message {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
}

.no-campaigns-message i {
  font-size: 48px;
  color: #dee2e6;
  margin-bottom: 16px;
}

.no-campaigns-message h3 {
  font-size: 18px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
}

.no-campaigns-message p {
  font-size: 14px;
  margin-bottom: 0;
}
