/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: #202124;
  background-color: #f8f9fa;
}

.hidden {
  display: none !important;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-content {
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e8eaed;
  border-top: 3px solid #1a73e8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.loading-content h2 {
  font-size: 24px;
  font-weight: 500;
  color: #202124;
  margin-bottom: 10px;
}

.loading-content p {
  color: #5f6368;
  font-size: 14px;
}

.loading-note {
  margin-top: 10px;
  font-size: 12px !important;
  color: #9aa0a6 !important;
}

/* Dashboard Layout */
.dashboard {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 18px;
  font-weight: 500;
  color: #202124;
}

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

.results-count {
  color: #5f6368;
  font-size: 13px;
}

.sync-status {
  color: #5f6368;
  font-size: 12px;
  padding: 4px 8px;
  background: #f1f3f4;
  border-radius: 4px;
}

.sync-status.syncing {
  background: #e8f0fe;
  color: #1a73e8;
}

.timezone-note {
  color: #9aa0a6;
  font-size: 11px;
  font-style: italic;
}

/* Filters Section */
.filters-section {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 12px 20px;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.filters-row:last-child {
  margin-bottom: 0;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 11px;
  color: #5f6368;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="date"] {
  padding: 6px 10px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 13px;
  color: #202124;
  background: #fff;
  min-width: 140px;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.search-group input {
  min-width: 180px;
}

.btn-clear {
  padding: 6px 16px;
  background: #f1f3f4;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 13px;
  color: #5f6368;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-clear:hover {
  background: #e8eaed;
}

/* Table Container */
.table-container {
  flex: 1;
  overflow: auto;
  padding: 0;
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  color: #5f6368;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover {
  background: #e8eaed;
}

.data-table th.sort-active {
  background: #e8f0fe;
  color: #1a73e8;
}

.data-table th.sortable::after {
  content: '';
  display: inline-block;
  margin-left: 6px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  vertical-align: middle;
  opacity: 0.3;
}

.data-table th.sort-asc::after {
  border-bottom: 5px solid currentColor;
  opacity: 1;
}

.data-table th.sort-desc::after {
  border-top: 5px solid currentColor;
  opacity: 1;
}

.data-table td {
  border: 1px solid #e0e0e0;
  padding: 10px 12px;
  vertical-align: top;
  font-size: 13px;
  color: #202124;
  max-width: 300px;
}

/* Alternating row colors */
.data-table tbody tr:nth-child(even) {
  background: #fafbfc;
}

.data-table tbody tr:hover {
  background: #f1f3f4;
}

/* Expandable cells */
.data-table td.expandable {
  cursor: pointer;
  position: relative;
}

.data-table td.expandable:hover {
  background: #e8f0fe;
}

.data-table td.expandable .cell-content {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.data-table td.expandable.expanded .cell-content {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: none;
  overflow: visible;
}

.data-table td.expandable .expand-hint {
  display: none;
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 10px;
  color: #1a73e8;
  opacity: 0.7;
}

.data-table td.expandable:hover .expand-hint {
  display: block;
}

.data-table td.expandable.expanded .expand-hint {
  display: none;
}

/* Interest Status Colors */
.interest-interested {
  background-color: #e6f4ea !important;
  color: #137333;
  font-weight: 500;
}

.interest-not-interested {
  background-color: #fce8e6 !important;
  color: #c5221f;
  font-weight: 500;
}

.interest-neutral {
  color: #5f6368;
}

/* Tab Label Styling */
.tab-main {
  color: #1a73e8;
}

.tab-others {
  color: #9aa0a6;
}

/* Reply Preview */
.reply-preview {
  color: #5f6368;
}

/* Email Address */
.lead-email {
  font-family: monospace;
  font-size: 12px;
}

/* Date/Time */
.datetime {
  white-space: nowrap;
  font-size: 12px;
  color: #5f6368;
}

/* No Results */
.no-results {
  padding: 60px 20px;
  text-align: center;
  color: #5f6368;
}

.no-results p {
  font-size: 16px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .filters-row {
    gap: 8px;
  }

  .filter-group select,
  .filter-group input[type="text"],
  .filter-group input[type="date"] {
    min-width: 120px;
  }

  .search-group input {
    min-width: 150px;
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .header-right {
    flex-wrap: wrap;
  }

  .filters-row {
    flex-direction: column;
    gap: 10px;
  }

  .filter-group {
    width: 100%;
  }

  .filter-group select,
  .filter-group input {
    width: 100%;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f3f4;
}

::-webkit-scrollbar-thumb {
  background: #dadce0;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #bdc1c6;
}

/* ============== SETTINGS VIEW ============== */

.settings-view {
  min-height: 100vh;
  background: #f8f9fa;
}

.settings-view .header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.settings-view .header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.settings-view .header h1 {
  font-size: 18px;
  font-weight: 500;
  color: #202124;
}

/* Settings Button */
.btn-settings {
  padding: 8px 16px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-settings:hover {
  background: #1557b0;
}

/* Back Button */
.btn-back {
  padding: 8px 16px;
  background: #f1f3f4;
  color: #5f6368;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-back:hover {
  background: #e8eaed;
}

/* Settings Content */
.settings-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 20px;
}

.settings-section {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.settings-section h2 {
  font-size: 16px;
  font-weight: 500;
  color: #202124;
  margin-bottom: 16px;
}

/* Settings Table (Workspaces List) */
.settings-table {
  width: 100%;
  border-collapse: collapse;
}

.settings-table th {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  color: #5f6368;
  font-size: 12px;
  text-transform: uppercase;
}

.settings-table td {
  border: 1px solid #e0e0e0;
  padding: 12px 16px;
  font-size: 14px;
  color: #202124;
}

.settings-table tbody tr:hover {
  background: #f8f9fa;
}

/* Status Indicators */
.status-valid {
  color: #137333;
  font-weight: 500;
}

.status-valid::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #137333;
  border-radius: 50%;
  margin-right: 8px;
}

.status-invalid {
  color: #c5221f;
  font-weight: 500;
}

.status-invalid::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #c5221f;
  border-radius: 50%;
  margin-right: 8px;
}

/* Delete Button */
.btn-delete-workspace {
  padding: 6px 12px;
  background: #fff;
  color: #c5221f;
  border: 1px solid #c5221f;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete-workspace:hover {
  background: #c5221f;
  color: #fff;
}

/* No Workspaces Message */
.no-workspaces-msg {
  padding: 40px 20px;
  text-align: center;
  color: #5f6368;
}

.no-workspaces {
  padding: 60px 20px;
  text-align: center;
  color: #5f6368;
}

.no-workspaces p {
  font-size: 16px;
  margin-bottom: 10px;
}

/* Add Workspace Form */
.add-workspace-form {
  margin-top: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}

.form-group label {
  font-size: 12px;
  color: #5f6368;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="password"] {
  padding: 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 14px;
  color: #202124;
}

.form-group input:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.form-actions {
  flex: 0 0 auto;
  min-width: auto;
}

.btn-add {
  padding: 10px 24px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add:hover {
  background: #1557b0;
}

.btn-add:disabled {
  background: #dadce0;
  cursor: not-allowed;
}

/* Form Status Message */
.form-status {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 14px;
}

.form-status.success {
  background: #e6f4ea;
  color: #137333;
  border: 1px solid #137333;
}

.form-status.error {
  background: #fce8e6;
  color: #c5221f;
  border: 1px solid #c5221f;
}

.form-status.loading {
  background: #e8f0fe;
  color: #1a73e8;
  border: 1px solid #1a73e8;
}

/* ============== DELETE MODAL ============== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-content h3 {
  font-size: 18px;
  font-weight: 500;
  color: #202124;
  margin-bottom: 12px;
}

.modal-content p {
  font-size: 14px;
  color: #5f6368;
  margin-bottom: 8px;
}

.modal-warning {
  color: #c5221f !important;
  font-size: 13px !important;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn-cancel {
  padding: 10px 20px;
  background: #f1f3f4;
  color: #5f6368;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-cancel:hover {
  background: #e8eaed;
}

.btn-delete {
  padding: 10px 20px;
  background: #c5221f;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-delete:hover {
  background: #a31a16;
}

/* ============== PAGINATION ============== */

.pagination-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px 20px;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  position: sticky;
  bottom: 0;
}

.btn-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  color: #1a73e8;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pagination:hover:not(.disabled) {
  background: #e8f0fe;
  border-color: #1a73e8;
}

.btn-pagination.disabled {
  color: #9aa0a6;
  cursor: not-allowed;
  background: #f8f9fa;
}

.btn-pagination .arrow {
  font-size: 16px;
  font-weight: bold;
}

.page-info {
  font-size: 14px;
  color: #5f6368;
  font-weight: 500;
  min-width: 120px;
  text-align: center;
}

/* Go to Latest Button */
.btn-go-to-latest {
  padding: 8px 16px;
  background: #34a853;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  margin-left: 16px;
}

.btn-go-to-latest:hover {
  background: #2d8e47;
}

/* Header Left with Go to Latest */
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Table Loading Overlay */
.table-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.table-loading-content {
  text-align: center;
}

.table-loading-content p {
  margin-top: 12px;
  color: #5f6368;
  font-size: 14px;
}

/* Make table container relative for overlay positioning */
.table-container {
  position: relative;
}

/* New Replies Notification */
.new-replies-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 16px 24px;
  background: #1a73e8;
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 500;
}

.new-replies-notification.show {
  opacity: 1;
  transform: translateY(0);
}

/* Adjust dashboard layout for pagination */
.dashboard {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.table-container {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

/* ============== COLUMN WIDTHS ============== */

/* Marker column - very small, just for checkbox */
.data-table th.col-marker,
.data-table td.col-marker {
  width: 55px;
  min-width: 55px;
  max-width: 55px;
  text-align: center;
  padding: 10px 8px;
}

/* Viewed column - very small, just for checkbox */
.data-table th.col-viewed,
.data-table td.col-viewed {
  width: 55px;
  min-width: 55px;
  max-width: 55px;
  text-align: center;
  padding: 10px 8px;
}

/* Lead Email column - 10% smaller (column 3) */
.data-table th:nth-child(3),
.data-table td:nth-child(3) {
  width: 180px;
  max-width: 180px;
}

/* Subject column - 10% smaller (column 4) */
.data-table th:nth-child(4),
.data-table td:nth-child(4) {
  width: 180px;
  max-width: 180px;
}

/* Reply Preview column - 30% larger (column 5) */
.data-table th:nth-child(5),
.data-table td:nth-child(5) {
  width: 520px;
  max-width: 520px;
}

/* Campaign column - 20% larger (column 6) */
.data-table th:nth-child(6),
.data-table td:nth-child(6) {
  width: 144px;
  max-width: 144px;
}

/* Interest Status column (column 7) */
.data-table th:nth-child(7),
.data-table td:nth-child(7) {
  width: 125px;
  max-width: 125px;
}

/* ============== VIEWED/UNVIEWED ROW STYLING ============== */

/* Unviewed rows - darker background */
.data-table tbody tr.row-unviewed {
  background-color: #e8eaed;
}

.data-table tbody tr.row-unviewed:nth-child(even) {
  background-color: #dfe1e5;
}

.data-table tbody tr.row-unviewed:hover {
  background-color: #d2d4d8;
}

/* Viewed rows - lighter background (default) */
.data-table tbody tr.row-viewed {
  background-color: #fff;
}

.data-table tbody tr.row-viewed:nth-child(even) {
  background-color: #fafbfc;
}

.data-table tbody tr.row-viewed:hover {
  background-color: #f1f3f4;
}

/* Viewed checkbox styling */
.viewed-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #1a73e8;
}

/* Marker checkbox styling */
.marker-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #ef5350;
}

/* ============== MARKED ROW STYLING ============== */

/* Marked row - medium red background (overrides viewed/unviewed) */
.data-table tbody tr.row-marked {
  background-color: #ef9a9a !important;
}

.data-table tbody tr.row-marked:nth-child(even) {
  background-color: #ef9a9a !important;
}

.data-table tbody tr.row-marked:hover {
  background-color: #e57373 !important;
}

/* Ensure marked row cells maintain red background */
.data-table tbody tr.row-marked td {
  background-color: transparent !important;
}

.data-table tbody tr.row-marked td.expandable:hover {
  background-color: rgba(0, 0, 0, 0.1) !important;
}

/* Interest status cells in marked rows - keep their text color but transparent background */
.data-table tbody tr.row-marked td.interest-interested,
.data-table tbody tr.row-marked td.interest-not-interested {
  background-color: transparent !important;
}

/* ============== CELL POPUP MODAL ============== */

.cell-popup-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.cell-popup-content {
  background: #fff;
  border-radius: 8px;
  padding: 20px 24px;
  max-width: 600px;
  max-height: 400px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  overflow: auto;
}

.cell-popup-text {
  font-size: 14px;
  line-height: 1.6;
  color: #202124;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============== MARKER NOTIFICATION ============== */

.marker-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 16px 24px;
  background: #ffcdd2;
  color: #b71c1c;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 500;
  border: 1px solid #ef9a9a;
}

.marker-notification.clickable {
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.marker-notification.clickable:hover {
  background: #ef9a9a;
  transform: translateY(-2px);
}
