/* Dashboard-specific styles */

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Dashboard Filters */
.dashboard-filters {
  background-color: var(--bg-white);
  border-radius: 0.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 200px;
  flex: 1;
}

.filter-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.filter-input-dash {
  padding: 0.5rem 0.75rem;
  border: 1px solid #c5cbd3;
  border-radius: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  background-color: var(--bg-white);
  cursor: pointer;
}

.filter-input-dash:focus {
  border-color: var(--primaris-red);
  box-shadow: 0 0 0 1px rgba(0, 69, 120, 0.2);
  outline: none;
}

.filter-actions {
  display: flex;
  align-items: flex-end;
  padding-top: 1.75rem;
}

.clear-filters-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.4rem;
  border: 1px solid var(--primaris-red);
  background-color: var(--bg-white);
  color: var(--primaris-red);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}

.clear-filters-btn:hover {
  background-color: var(--primaris-light-gray-1);
}

.nav-button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: none;
  border-radius: 0.4rem;
  cursor: pointer;
  background-color: var(--bg-white);
  color: var(--primaris-red);
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.2s;
}

.nav-button:hover {
  background-color: var(--primaris-light-gray-1);
}

.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.kpi-card {
  background-color: var(--bg-white);
  border-radius: 0.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.kpi-icon {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
}

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

.kpi-label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--primaris-red);
  line-height: 1.2;
}

.kpi-subtext {
  font-size: 0.85rem;
  color: #888;
  margin-top: 0.25rem;
}

/* Charts */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  width: 100%;
}

.chart-grid-full {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.chart-grid-full .chart-card {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.chart-card {
  background-color: var(--bg-white);
  border-radius: 0.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  box-sizing: border-box;
  overflow: hidden;
}

.chart-card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--primaris-red);
  font-weight: 600;
}

/* Trend Chart Filters */
.trend-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.trend-filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.trend-filter-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.trend-filter-select {
  padding: 0.4rem 0.6rem;
  border: 1px solid #c5cbd3;
  border-radius: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  background-color: var(--bg-white);
  cursor: pointer;
  min-width: 150px;
}

.trend-filter-select:focus {
  border-color: var(--primaris-red);
  box-shadow: 0 0 0 1px rgba(0, 69, 120, 0.2);
  outline: none;
}

.chart-content {
  position: relative;
  height: 300px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.chart-content-tall {
  position: relative;
  height: 500px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.chart-content canvas,
.chart-content-tall canvas {
  max-height: 100%;
  max-width: 100%;
  cursor: pointer;
}

.chart-content canvas:hover {
  opacity: 0.9;
}

/* Data Tables */
.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 1.5rem;
}

.data-table-card {
  background-color: var(--bg-white);
  border-radius: 0.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
}

.data-table-card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--primaris-red);
  font-weight: 600;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
}

.data-table th {
  padding: 0.75rem 0.5rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  color: var(--text-primary);
}

/* Column widths for better spacing */
.data-table th:nth-child(1),
.data-table td:nth-child(1) {
  width: 15%;
  min-width: 100px;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
  width: 50%;
  min-width: 200px;
}

.data-table th:nth-child(3),
.data-table td:nth-child(3) {
  width: 20%;
  min-width: 120px;
}

.data-table th:nth-child(4),
.data-table td:nth-child(4) {
  width: 15%;
  min-width: 100px;
  white-space: nowrap;
}

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

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .ticket-id {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.75rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table .ticket-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.data-table .age-cell,
.data-table .date-cell {
  white-space: nowrap;
  font-weight: 500;
  color: var(--primaris-red);
}

.data-table .empty-cell {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 2rem 1rem;
}

/* Responsive design */
@media (max-width: 1600px) {
  .chart-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1200px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .table-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dashboard-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    min-width: 100%;
  }

  .filter-actions {
    padding-top: 0;
    width: 100%;
  }

  .clear-filters-btn {
    width: 100%;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    padding: 1rem;
  }

  .kpi-icon {
    font-size: 2rem;
  }

  .kpi-value {
    font-size: 1.75rem;
  }

  .chart-content {
    height: 250px;
  }

  .header-actions {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .nav-button {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .dashboard-container {
    gap: 1rem;
  }

  .chart-card,
  .data-table-card {
    padding: 1rem;
  }

  .chart-content {
    height: 200px;
  }
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background-color: var(--bg-white);
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 800px;
  max-height: 90vh;
  width: 90%;
  overflow-y: auto;
  z-index: 1001;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 2px solid #e5e7eb;
  position: sticky;
  top: 0;
  background-color: var(--bg-white);
  border-radius: 0.75rem 0.75rem 0 0;
  z-index: 10;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--primaris-red);
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: background-color 0.2s, color 0.2s;
}

.modal-close:hover {
  background-color: #f0f0f0;
  color: var(--text-primary);
}

.modal-status {
  padding: 1rem 1.5rem;
  font-size: 0.9rem;
}

.modal-status.error {
  background-color: #fee;
  color: #d00;
  border-left: 4px solid #d00;
}

.modal-status.success {
  background-color: #efe;
  color: #0a0;
  border-left: 4px solid #0a0;
}

.modal-body {
  padding: 1.5rem;
}

.modal-section {
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.modal-section h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--primaris-red);
  font-weight: 600;
}

.loading-spinner {
  text-align: center;
  padding: 2rem;
  color: #666;
  font-style: italic;
}

.ticket-details-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem 1.5rem;
  font-size: 0.95rem;
}

.ticket-detail-label {
  font-weight: 600;
  color: #555;
  text-align: right;
}

.ticket-detail-value {
  color: var(--text-primary);
}

.ticket-detail-value code {
  background-color: #f5f5f5;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.85rem;
}

#modalActivitiesList {
  list-style: none;
  padding: 0;
  margin: 0;
}

#modalActivitiesList li {
  padding: 0.75rem;
  background-color: #f9fafb;
  border-radius: 0.25rem;
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--primaris-red);
}

#modalActivitiesList li:last-child {
  margin-bottom: 0;
}

.empty-state {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 2rem 1rem;
}

/* Description expand/collapse */
.description-container {
  position: relative;
}

.description-preview,
.description-full {
  white-space: pre-wrap;
  word-break: break-word;
}

.hidden {
  display: none;
}

.toggle-description {
  margin-top: 0.5rem;
  padding: 0.25rem 0.75rem;
  background-color: var(--primaris-red);
  color: white;
  border: none;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.toggle-description:hover {
  background-color: #0078d4;
}

/* Make table rows clickable */
.data-table tbody tr {
  cursor: pointer;
  transition: background-color 0.15s;
}

.data-table tbody tr:hover {
  background-color: var(--primaris-light-gray-1) !important;
}

/* Responsive modal */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-header h2 {
    font-size: 1.25rem;
  }

  .modal-body,
  .modal-section {
    padding: 1rem;
  }

  .ticket-details-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .ticket-detail-label {
    text-align: left;
    font-weight: 700;
  }
}

@media (max-width: 480px) {
  .modal-content {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-header {
    border-radius: 0;
  }
}
