/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Loading Button Styles */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  opacity: 0.7;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: btn-spin 1s linear infinite;
  color: inherit;
}

.btn-loading.action-btn::after,
.btn-loading.messaging-action-btn::after {
  border-top-color: #ffffff;
}

.btn-loading.messaging-action-btn.secondary::after {
  border-top-color: #000000;
}

.dark-theme .btn-loading.messaging-action-btn.secondary::after {
  border-top-color: #ffffff;
}

.btn-loading.action-btn.secondary::after {
  border-top-color: #000000;
}

.btn-loading.action-btn.danger::after {
  border-top-color: #ffffff;
}

.btn-loading.action-btn.cancel::after {
  border-top-color: #000000;
}

.dark-theme .btn-loading.action-btn.secondary::after,
.dark-theme .btn-loading.action-btn.cancel::after {
  border-top-color: #ffffff;
}

/* Loading spinner for different button types */
.btn-loading.new-ticket-btn::after,
.btn-loading.export-btn::after {
  border-top-color: #ffffff;
}

.btn-loading.btn-primary::after {
  border-top-color: #ffffff;
}

.btn-loading.quick-action-btn::after,
.btn-loading.tool-btn::after {
  border-top-color: #3b82f6;
}

.btn-loading.send-button::after,
.btn-loading.ai-send-button::after {
  border-top-color: #ffffff;
}

.btn-loading.feedback-submit-btn::after {
  border-top-color: #ffffff;
}

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

/* CSS Variables for ApexCharts */
:root {
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
}

body.dark-theme {
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --border-color: #374151;
  --bg-primary: #1f2937;
  --bg-secondary: #111827;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  height: 100vh;
  overflow: hidden;
  background: #f8f9fa;
  padding: 20px;
  box-sizing: border-box;
  position: relative;
  font-weight: 400;
  color: #374151;
  line-height: 1.5;
}

/* Dashboard Body */
.dashboard-body {
  padding: 0;
  overflow: hidden;
  display: flex;
  height: 100vh;
  background: #fafbfc;
}

/* Sidebar Styles */
.sidebar {
  width: 250px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.02);
}

/* Collapsed sidebar state */
body.sidebar-collapsed .sidebar {
  width: 72px;
}

body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .nav-text,
body.sidebar-collapsed .sidebar .sidebar-footer .user-info,
body.sidebar-collapsed .sidebar .logout-btn span:last-child {
  display: none;
}

body.sidebar-collapsed .sidebar .logo-wrapper {
  width: 40px;
  height: 20px;
}

body.sidebar-collapsed .sidebar .sidebar-logo {
  width: 100%;
  height: auto;
}

/* Keep nav items compact when collapsed */
body.sidebar-collapsed .sidebar .nav-item {
  justify-content: center;
  padding: 10px 12px;
}

/* Hover circle background on icons when collapsed */
body.sidebar-collapsed .sidebar .nav-item .nav-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}
/* Remove full-row hover/active background when collapsed */
body.sidebar-collapsed .sidebar .nav-item:hover,
body.sidebar-collapsed .sidebar .nav-item.active {
  background: transparent;
}
body.sidebar-collapsed .sidebar .nav-item:hover .nav-icon {
  background: #f3f4f6;
}
body.dark-theme.sidebar-collapsed .sidebar .nav-item:hover .nav-icon {
  background: #374151;
}
/* Active state indicator on icon when collapsed */
body.sidebar-collapsed .sidebar .nav-item.active .nav-icon {
  background: #e5edfa;
}
body.dark-theme.sidebar-collapsed .sidebar .nav-item.active .nav-icon {
  background: #374151;
}

/* Smaller icon graphic inside circle when collapsed */
body.sidebar-collapsed .sidebar .nav-icon-img {
  width: 22px;
  height: 22px;
  position: relative;
}

/* Adjust footer layout when collapsed */
body.sidebar-collapsed .sidebar .user-profile {
  justify-content: center;
}

/* Shift main content when collapsed */
/* If layout relies on flex, we just allow the aside to shrink; keep content fluid */

.sidebar-header {
  padding: 12px 64px 16px 12px; /* reserve space on right for toggle */
  border-bottom: 1px solid #f3f4f6;
  position: relative; /* anchor for absolute toggle */
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center; /* center contents in expanded */
}

.logo-row {
  display: flex;
  align-items: center;
  justify-content: center; /* center logo regardless of toggle */
  gap: 8px;
}

.logo-wrapper {
  position: relative;
  width: 110px; /* larger logo in expanded */
  height: 96px; /* slightly shorter to close vertical gap */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible; /* allow full logo */
  z-index: 1;
}

.sidebar-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0;
  position: static;
  transform: none;
  display: block;
}

.sidebar-logo.dark-logo {
  display: none;
}

body.dark-theme .sidebar-logo.light-logo {
  display: none;
}

body.dark-theme .sidebar-logo.dark-logo {
  display: block;
}

.brand-text {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.025em;
  text-align: center;
  margin-top: -10px; /* pull closer to logo */
  line-height: 1.1;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-list {
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #6b7280;
  font-weight: 500;
  margin: 2px 12px;
  border-radius: 8px;
  font-size: 14px;
  flex-direction: row !important;
}

.nav-item:hover {
  background: #f9fafb;
  color: #374151;
}

.nav-item.active {
  background: #f3f4f6;
  color: #111827;
  font-weight: 600;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  opacity: 0.8;
  flex-shrink: 0;
}

.nav-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  top: 0;
  left: 0;
}

/* Light/Dark icon switching for dashboard only */
.nav-icon-img.dark-icon {
  display: none;
}

body.dark-theme .nav-icon-img.light-icon {
  display: none;
}

body.dark-theme .nav-icon-img.dark-icon {
  display: block;
}

/* Dark mode icon filter for light icons */
body.dark-theme .nav-icon-img:not(.light-icon):not(.dark-icon) {
  filter: brightness(0) invert(1);
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-text {
  font-size: 14px;
  line-height: 1.4;
}

.sidebar-footer {
  padding: 16px 20px 20px 20px;
  border-top: 1px solid #f3f4f6;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.user-info {
  flex: 1;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1px;
}

.user-role {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #6b7280;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
}

.logout-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #374151;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fafbfc;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
}

/* Sidebar toggle inside sidebar header */
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 3; /* above logo */
}
.sidebar-toggle:hover { background: #f3f4f6; border-color: #d1d5db; }
.dark-theme .sidebar-toggle { background: #374151; border-color: #4b5563; color: #f3f4f6; }
.dark-theme .sidebar-toggle:hover { background: #4b5563; border-color: #6b7280; }

/* Switch collapse/expand icon visibility based on state */
.icon-expand { display: none; }
body.sidebar-collapsed .icon-collapse { display: none; }
body.sidebar-collapsed .icon-expand { display: inline; }

/* Collapsed header layout: center toggle and hide logo/text */
body.sidebar-collapsed .sidebar-header { padding: 12px; }
body.sidebar-collapsed .sidebar .logo-wrapper { display: none; }
body.sidebar-collapsed .sidebar .brand-text { display: none; }
body.sidebar-collapsed .sidebar .sidebar-toggle {
  position: static;
  margin: 0 auto; /* center within header */
}

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

.header-titles {
  display: flex;
  flex-direction: column;
}

.header-left h1 {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 2px;
  letter-spacing: -0.025em;
}

.page-subtitle {
  color: #6b7280;
  font-size: 14px;
  font-weight: 400;
}

.header-right {
  display: flex;
  gap: 8px;
}

.export-btn,
.new-ticket-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}

.export-btn {
  background: #f9fafb;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.export-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.new-ticket-btn {
  background: #3b82f6;
  color: white;
}

.new-ticket-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

/* Dashboard Sections */
.dashboard-section {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
  display: none;
}

.dashboard-section.active {
  display: block;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.15s ease;
}

.stat-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stat-content {
  text-align: left;
}

.stat-label {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 4px;
  font-weight: 500;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.chart-container {
  background: white;
  padding: 24px 24px 60px 24px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.chart-container > div {
  max-height: 350px;
}

/* ApexCharts custom styling */
.chart-container .apexcharts-canvas {
  max-height: 350px;
}

.chart-container .apexcharts-svg {
  background: transparent;
}

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

.chart-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.chart-header select {
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  background: white;
  color: #374151;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("../images/light-dropdown-arrow.svg");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 12px;
  padding-right: 26px;
}

.chart-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 15px;
  text-align: center;
  padding: 5px;
  border-bottom: 1px solid #e5e7eb;
}

.chart-subtitle span {
  font-weight: 500;
  color: #374151;
}

.quick-stats {
  background: white;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.quick-stats h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 16px;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
}

.quick-action-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  transform: translateY(-1px);
}

.quick-action-btn span {
  font-size: 16px;
}

.action-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
}

.action-desc {
  font-size: 12px;
  color: #6b7280;
}

.ticket-types-chart {
  border-top: 1px solid #f3f4f6;
  padding-top: 20px;
}

.ticket-types-chart > div {
  max-height: 180px;
}

/* ApexCharts custom styling for ticket types chart */
.ticket-types-chart .apexcharts-canvas {
  max-height: 180px;
}

.ticket-types-chart h4 {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 12px;
}

/* Recent Tickets */
.recent-tickets {
  background: white;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #f3f4f6;
}

.section-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.view-all-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-all-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

/* Section Controls */
.section-controls {
  margin-bottom: 24px;
}

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

.filter-controls select,
.filter-controls input {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: #fafbfc;
  color: #374151;
}

.filter-controls select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("../images/light-dropdown-arrow.svg");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 12px;
  padding-right: 26px;
  cursor: pointer;
}

/* Filter controls use unified styling - no override needed */

.filter-controls input {
  min-width: 200px;
}

/* Sorting controls use unified styling with specific width */
#sort-filter,
#all-sort-filter {
  min-width: 160px;
}

/* Multi-Select Server Filter */
.server-filter-container {
  position: relative;
  display: inline-block;
}

.server-filter-button {
  display: flex;
  align-items: center;
  padding: 8px 26px 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: white;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  min-width: 150px;
  transition: all 0.2s ease;
  background-image: url("../images/light-dropdown-arrow.svg");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 12px;
}

.server-filter-button:hover { border-color: #e5e7eb; }

.server-filter-button.active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.server-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fafbfc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  margin-top: 4px;
  overflow: hidden;
}

.server-filter-dropdown.active {
  display: block;
}

.server-filter-header {
  background: #f3f4f6;
}

.server-filter-divider {
  height: 1px;
  background: #f3f4f6;
}

.server-filter-list {
  padding: 0;
}

.server-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 13px;
  color: #374151;
}

.server-checkbox-item:hover {
  background: #f3f4f6;
}

.server-checkbox-item:last-child {
  border-bottom: none;
}

.server-checkbox-item input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 16px;
  height: 16px;
  border: 2px solid #d1d5db;
  border-radius: 3px;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.server-checkbox-item input[type="checkbox"]:checked + .checkmark {
  background: #3b82f6;
  border-color: #3b82f6;
}

.server-checkbox-item input[type="checkbox"]:checked + .checkmark::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 10px;
  font-weight: bold;
}

.server-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-count {
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
}

/* Dark theme styles for server filter */
.dark-theme .server-filter-button {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
  background-image: url("../images/dark-dropdown-arrow.svg");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 12px;
}

.dark-theme .server-filter-button:hover { border-color: #4b5563; }

.dark-theme .server-filter-dropdown {
  background: #1f2937;
  border-color: var(--border-color);
}

.dark-theme .server-filter-header {
  background: #111827;
  border-color: #374151;
}

.dark-theme .server-filter-divider {
  background: #374151;
}

.dark-theme .server-checkbox-item {
  color: #f3f4f6;
}

.dark-theme .server-checkbox-item:hover {
  background: #374151;
}

.dark-theme .checkmark {
  border-color: #6b7280;
}

.dark-theme .server-checkbox-item input[type="checkbox"]:checked + .checkmark {
  background: #3b82f6;
  border-color: #3b82f6;
}

.dark-theme .server-count {
  background: #374151;
  color: #9ca3af;
}

/* Tables */
.tickets-table-container {
  overflow-x: auto;
}

.tickets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tickets-table th,
.tickets-table td {
  text-align: left;
  padding: 12px; /* reduce horizontal padding to tighten column spacing */
  border-bottom: 1px solid #f3f4f6;
}

.tickets-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.tickets-table td {
  color: #6b7280;
}

.tickets-table tr:hover {
  background: #fafbfc;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-open {
  background: #fef3c7;
  color: #92400e;
}
.status-closed {
  background: #d1fae5;
  color: #065f46;
}
.status-claimed {
  background: #dbeafe;
  color: #1e40af;
}
.status-active {
  background: #d1fae5;
  color: #065f46;
}
.status-inactive {
  background: #fecaca;
  color: #b91c1c;
}

/* Priority badges */
.priority-badge {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
  min-width: 60px;
  text-align: center;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.priority-low {
  background: #f3f4f6;
  color: #6b7280;
}
.priority-medium {
  background: #fef3c7;
  color: #92400e;
}
.priority-high {
  background: #fed7aa;
  color: #c2410c;
}
.priority-urgent {
  background: #fecaca;
  color: #dc2626;
}

/* Action Buttons */
.action-btn {
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: white;
  color: #374151;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 100px;
  width: 100px;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.action-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.action-btn.primary {
  background: #3b82f6;
  color: white;
  border: 1px solid #3b82f6;
}

.action-btn.primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.action-btn.secondary {
  background: #3b82f6;
  color: #ffffff;
  border: 1px solid #3b82f6;
}

.action-btn.secondary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

/* Cancel (grey) button */
.action-btn.cancel {
  background: #e5e7eb;
  color: #374151;
  border: 1px solid #d1d5db;
  height: 40px;
}

.action-btn.cancel:hover {
  background: #d1d5db;
  border-color: #9ca3af;
}

.action-btn.success {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.4);
}

.action-btn.success:hover {
  background: #047857;
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.5);
}

.action-btn.warning {
  background: #d97706;
  color: #ffffff;
  border-color: #d97706;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.4);
}

.action-btn.warning:hover {
  background: #b45309;
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.5);
}

.action-btn.danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

.action-btn.danger:hover {
  background: #b91c1c;
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.5);
}

/* Action buttons container */
.ticket-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* Button icons (if added later) */
.action-btn .icon {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

.action-btn:hover .icon {
  opacity: 1;
}

/* Priority Selection Modal */
.priority-selection {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}

.priority-option {
  padding: 12px 16px !important;
  width: 100% !important;
  min-width: auto !important;
  text-transform: capitalize;
  font-weight: 600;
  border: 2px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  transition: all 0.2s ease;
  position: relative;
}

.priority-option:hover {
  border-color: #3b82f6;
  background: #f0f9ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.15);
  cursor: pointer;
}

.priority-option.selected {
  border-color: #3b82f6 !important;
  background: #dbeafe !important;
  color: #1e40af !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.priority-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border-bottom: 1px solid #e5e7eb;
  padding: 20px 24px;
  border-radius: 8px 8px 0 0;
}

.priority-modal-content {
  background: #ffffff;
  padding: 24px;
  border-radius: 0 0 8px 8px;
}

.priority-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.priority-modal-subtitle {
  color: #6b7280;
  font-size: 14px;
  margin: 16px 0 24px 0;
  font-weight: 500;
}

/* Analytics Grid */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 24px 0;
}

.analytics-grid .chart-container {
  height: 320px;
  max-height: 320px;
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* Tools Stack */
.tools-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tool-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.15s ease;
}

.tool-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Selected tool card highlight (e.g., chosen bot set) */
.tool-card.selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark-theme .tool-card.selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.tool-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 16px;
}

.tool-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-btn {
  padding: 10px 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.tool-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.setting-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.15s ease;
}

.setting-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.setting-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 16px;
}

.setting-item {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-item label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.theme-dropdown {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("../images/light-dropdown-arrow.svg");
  background-size: 12px;
  background-position: right 10px center;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.theme-dropdown:hover {
  border-color: #9ca3af;
}

.theme-dropdown:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1100;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid #e5e7eb;
}

.modal-content.large {
  max-width: 720px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.modal-close:hover {
  color: #6b7280;
  background: #f3f4f6;
}

/* Allow stacking a modal above another */
.modal.stack-top {
  z-index: 1200;
}

/* Generic modal body spacing */
.modal-body {
  padding: 20px 24px;
}

/* Bot Sets modal helpers */
.cards-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* Danger variant for small tool buttons */
.tool-btn.danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

.tool-btn.danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* Allow server channel assignment to use radio inputs too */
.server-checkbox-item input[type="radio"] {
  display: none;
}

.server-checkbox-item input[type="radio"]:checked + .checkmark {
  background: #3b82f6;
  border-color: #3b82f6;
}

.server-checkbox-item input[type="radio"]:checked + .checkmark::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 10px;
  font-weight: bold;
}

/* Dark theme parity for danger tool button */
.dark-theme .tool-btn.danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

.dark-theme .tool-btn.danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* Form Styles */
.form-group {
  margin: 12px 0 12px 0;
  padding: 0 24px;
}

.form-group:first-child {
  padding-top: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.15s ease;
  background: white;
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("../images/light-dropdown-arrow.svg");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 12px;
  padding-right: 30px;
  cursor: pointer;
}

/* Form group selects inherit from unified select styling above */

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 24px 32px;
  border-top: 1px solid #e5e7eb;
  background: #fafbfc;
}

.btn-primary,
.btn-secondary {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-secondary {
  background: white;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

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

  .sidebar {
    width: 240px;
  }

  /* AI Assistant tablet sizing */
  .ai-chat-container {
    height: calc(100vh - 160px);
    min-height: 550px;
  }
}

@media (max-width: 768px) {
  .dashboard-body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }

  .sidebar-nav {
    padding: 8px 0;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 0 16px;
  }

  .nav-item {
    margin: 0;
    white-space: nowrap;
    min-width: 120px;
    justify-content: center;
  }

  .sidebar-footer {
    display: none;
  }

  .main-header {
    padding: 20px;
  }

  .header-left h1 {
    font-size: 24px;
  }

  .dashboard-section {
    padding: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }

  .filter-controls {
    flex-direction: column;
  }

  .filter-controls select,
  .filter-controls input {
    min-width: auto;
    width: 100%;
  }

  /* AI Assistant responsive sizing */
  .ai-chat-container {
    height: calc(100vh - 180px);
    min-height: 500px;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .ai-chat-container {
    height: calc(100vh - 160px);
    min-height: 450px;
  }

  .dashboard-section {
    padding: 16px;
  }

  .main-header {
    padding: 16px;
  }
}

/* Top Logo - keeping original login styles for index page */
.top-logo {
  position: absolute;
  top: 30px;
  left: 60px;
}

.top-logo .logo-icon {
  position: relative;
  width: 120px;
  height: 120px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  z-index: 1000;
}

.logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.logo-image.dark-logo {
  display: none;
}

body.dark-theme .logo-image.light-logo {
  display: none;
}

body.dark-theme .logo-image.dark-logo {
  display: block;
}

/* Main login wrapper */
.login-wrapper {
  display: flex;
  height: calc(100vh - 40px);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Left Branding Section */
.branding-section {
  flex: 1;
  background: linear-gradient(135deg, #2d3748 0%, #4a5568 50%, #2d3748 100%);
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 60px;
  overflow: hidden;
}

.branding-content {
  position: relative;
  z-index: 2;
  color: white;
}

.welcome-text h1 {
  font-size: 42px;
  font-weight: 700;
  line-height: 1.2;
  color: white;
  letter-spacing: -0.02em;
}

/* Decorative Elements */
.curve-decoration {
  position: absolute;
  right: -100px;
  top: 25%;
  transform: translateY(-50%);
  width: 300px;
  height: 600px;
  background: linear-gradient(45deg, #718096 0%, #a0aec0 100%);
  border-radius: 50%;
  opacity: 0.6;
}

.circle-decoration {
  position: absolute;
  right: -50px;
  bottom: -120px;
  width: 500px;
  height: 500px;
  background: #e2e8f0;
  border-radius: 50%;
  opacity: 0.8;
}

/* Right Login Section */
.login-section {
  flex: 1;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-form-container {
  width: 100%;
  max-width: 400px;
}

.login-title {
  font-size: 36px;
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 12px;
  text-align: left;
}

.login-subtitle {
  color: #718096;
  font-size: 16px;
  margin-bottom: 40px;
  line-height: 1.5;
}

.login-form {
  width: 100%;
}

.discord-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 18px 24px;
  background: #5865f2;
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  margin-bottom: 30px;
}

.discord-btn:hover {
  background: #4752c4;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(88, 101, 242, 0.3);
}

.discord-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.auth-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #718096;
  font-size: 14px;
  margin-bottom: 20px;
}

.shield-icon {
  width: 16px;
  height: 16px;
  color: #10b981;
}

.support-note {
  text-align: center;
  font-size: 13px;
  color: #718096;
  line-height: 1.5;
}

.support-note p {
  margin-bottom: 4px;
}

.support-email {
  color: #4a5568;
  text-decoration: none;
  font-weight: 500;
}

.support-email:hover {
  text-decoration: underline;
}

/* Error Message Styles */
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 24px;
}

.error-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.error-text {
  color: #dc2626;
  font-size: 14px;
  font-weight: 500;
}

/* Ticket Tabs */
.ticket-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 24px;
  background: #f3f4f6;
  padding: 4px;
  border-radius: 8px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background: white;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tab-btn:hover:not(.active) {
  color: #374151;
}

.tab-count {
  background: #e5e7eb;
  color: #6b7280;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

.tab-btn.active .tab-count {
  background: #dbeafe;
  color: #1e40af;
}

.ticket-tab-content {
  display: none;
}

.ticket-tab-content.active {
  display: block;
}

/* Dark Mode Styles */
body.dark-theme {
  color: #f9fafb;
}

/* Keep login page background light even in dark mode */
body.dark-theme .login-wrapper {
  background: #f8f9fa;
}

/* Apply dark background to dashboard body when in dark theme */
.dark-theme .dashboard-body {
  background: #111827;
}

/* Sidebar Dark Mode */
.dark-theme .sidebar {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .sidebar-header {
  border-color: #374151;
}

.dark-theme .brand-text {
  color: #f9fafb;
  text-align: center;
}

.dark-theme .nav-item {
  color: #9ca3af;
}

.dark-theme .nav-item:hover {
  background: #374151;
  color: #f3f4f6;
}

.dark-theme .nav-item.active {
  background: #374151;
  color: #f9fafb;
}

.dark-theme .sidebar-footer {
  border-color: #374151;
}

.dark-theme .user-name {
  color: #f9fafb;
}

.dark-theme .user-role {
  color: #9ca3af;
}

.dark-theme .logout-btn {
  border-color: #4b5563;
  color: #9ca3af;
}

.dark-theme .logout-btn:hover {
  background: #374151;
  border-color: #6b7280;
  color: #f3f4f6;
}

/* Main Content Dark Mode */
.dark-theme .main-content {
  background: #111827;
}

.dark-theme .main-header {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .page-title {
  color: #f9fafb;
}

.dark-theme .page-subtitle {
  color: #9ca3af;
}

.dark-theme .export-btn {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.dark-theme .export-btn:hover {
  background: #4b5563;
  border-color: #6b7280;
}

.dark-theme .new-ticket-btn {
  border-color: #4b5563;
  color: #f3f4f6;
}

.dark-theme .new-ticket-btn {
  background: #3b82f6;
}

.dark-theme .new-ticket-btn:hover {
  background: #2563eb;
}

/* Cards and Content Dark Mode */
.dark-theme .stat-card {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .stat-card:hover {
  border-color: #4b5563;
}

.dark-theme .stat-label {
  color: #9ca3af;
}

.dark-theme .stat-value {
  color: #f9fafb;
}

.dark-theme .chart-container {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .chart-header h3 {
  color: #f9fafb;
}

.dark-theme .chart-header select {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
  background-image: url("../images/dark-dropdown-arrow.svg");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 12px;
}

.dark-theme .chart-subtitle {
  color: #9ca3af;
  border-bottom-color: #374151;
}

.dark-theme .chart-subtitle span {
  color: #f3f4f6;
}

.dark-theme .quick-stats {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .quick-stats h3 {
  color: #f9fafb;
}

.dark-theme .quick-action-btn {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.dark-theme .quick-action-btn:hover {
  background: #4b5563;
  border-color: #6b7280;
}

.dark-theme .action-title {
  color: #f9fafb;
}

.dark-theme .action-desc {
  color: #9ca3af;
}

.dark-theme .ticket-types-chart h4 {
  color: #f9fafb;
}

.dark-theme .section-header h3 {
  color: #f9fafb;
}

.dark-theme .view-all-btn {
  color: #3b82f6;
}

.dark-theme .view-all-btn:hover {
  color: #2563eb;
}

/* Recent Tickets Dark Mode */
.dark-theme .recent-tickets {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .section-header {
  border-color: #374151;
}

/* Action Buttons Dark Mode */
.dark-theme .action-btn {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.dark-theme .action-btn:hover {
  background: #4b5563;
  border-color: #6b7280;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.dark-theme .action-btn.primary {
  background: #3b82f6;
  color: white;
  border: 1px solid #3b82f6;
}

.dark-theme .action-btn.primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.dark-theme .action-btn.secondary {
  background: #4b5563;
  color: #f9fafb;
  border-color: #6b7280;
  box-shadow: 0 2px 4px rgba(107, 114, 128, 0.4);
}

.dark-theme .action-btn.secondary:hover {
  background: #374151;
  border-color: #6b7280;
  box-shadow: 0 4px 8px rgba(107, 114, 128, 0.5);
}

.dark-theme .action-btn.success {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.4);
}

.dark-theme .action-btn.success:hover {
  background: #047857;
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.5);
}

.dark-theme .action-btn.warning {
  background: #d97706;
  color: #ffffff;
  border-color: #d97706;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.4);
}

.dark-theme .action-btn.warning:hover {
  background: #b45309;
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.5);
}

.dark-theme .action-btn.danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

.dark-theme .action-btn.danger:hover {
  background: #b91c1c;
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.5);
}

/* Table Dark Mode */
.dark-theme .tickets-table-container {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .tickets-table {
  background: #1f2937;
}

.dark-theme .tickets-table th {
  background: #374151;
  color: #f3f4f6;
  border-color: #4b5563;
}

.dark-theme .tickets-table td {
  border-color: #374151;
  color: #f3f4f6;
}

.dark-theme .tickets-table tr:hover {
  background: #374151;
}

/* Filter Controls Dark Mode */
.dark-theme .filter-controls input {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.dark-theme .filter-controls input::placeholder {
  color: #9ca3af;
}

.dark-theme .filter-controls select {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
  background-image: url("../images/dark-dropdown-arrow.svg");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 12px;
}

/* Dark theme styling for sorting controls */
/* Dark theme sort filters use unified dark theme styling */

/* Tools and Settings Dark Mode */
.dark-theme .tool-card,
.dark-theme .setting-card {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .tool-card:hover,
.dark-theme .setting-card:hover {
  border-color: #4b5563;
}

.dark-theme .tool-card h3,
.dark-theme .setting-card h3 {
  color: #f9fafb;
}

.dark-theme .tool-btn {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.dark-theme .tool-btn:hover {
  background: #4b5563;
  border-color: #6b7280;
}

.dark-theme .setting-item label {
  color: #f3f4f6;
}

.dark-theme .theme-dropdown {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
  background-image: url("../images/dark-dropdown-arrow.svg");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 12px;
}

.dark-theme .theme-dropdown:hover {
  border-color: #6b7280;
}

.dark-theme .theme-dropdown:focus {
  border-color: #3b82f6;
}

/* Modal Dark Mode */
.dark-theme .modal-content {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .modal-header {
  border-color: #374151;
}

.dark-theme .modal-header h3 {
  color: #f9fafb;
}

.dark-theme .modal-close {
  color: #9ca3af;
}

.dark-theme .modal-close:hover {
  color: #f3f4f6;
  background: #374151;
}

.dark-theme .form-group label {
  color: #f3f4f6;
}

.dark-theme .form-group input,
.dark-theme .form-group select,
.dark-theme .form-group textarea {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.dark-theme .form-group select {
  background-image: url("../images/dark-dropdown-arrow.svg");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 12px;
}

/* Dark theme form selects inherit from unified dark theme styling below */

.dark-theme .form-group input:focus,
.dark-theme .form-group select:focus,
.dark-theme .form-group textarea:focus {
  border-color: #3b82f6;
}

.dark-theme .form-group input::placeholder,
.dark-theme .form-group textarea::placeholder {
  color: #9ca3af;
}

/* Dark theme unified select styling */
.dark-theme select {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
  background-image: url("../images/dark-dropdown-arrow.svg");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 12px;
}

.dark-theme select:hover {
  border-color: #6b7280;
}

.dark-theme select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Dark theme option styling */
.dark-theme select option {
  padding: 8px 12px;
  background: white;
  color: #374151;
  border-bottom: 1px solid var(--border-color);
  /* left + right borders via box-shadow so entire list has frame */
  box-shadow: inset 1px 0 var(--border-color), inset -1px 0 var(--border-color);
  font-size: 14px;
  line-height: 1.4;
}

.dark-theme select option:first-child {
  border-top: 1px solid var(--border-color);
}

.dark-theme select option:hover,
.dark-theme select option:focus {
  background: #f8fafc !important;
  color: #1f2937 !important;
}

.dark-theme select option:checked,
.dark-theme select option:selected {
  background: #3b82f6 !important;
  color: white !important;
}

.dark-theme .btn-primary {
  background: #3b82f6;
}

.dark-theme .btn-primary:hover {
  background: #2563eb;
}

.dark-theme .btn-secondary {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.dark-theme .btn-secondary:hover {
  background: #4b5563;
  border-color: #6b7280;
}

/* Tabs Dark Mode */
.dark-theme .ticket-tabs {
  background: #374151;
}

.dark-theme .tab-btn {
  color: #9ca3af;
}

.dark-theme .tab-btn.active {
  background: #1f2937;
  color: #f9fafb;
}

.dark-theme .tab-btn:hover:not(.active) {
  color: #f3f4f6;
}

.dark-theme .tab-count {
  background: #4b5563;
  color: #9ca3af;
}

.dark-theme .tab-btn.active .tab-count {
  background: #3b82f6;
  color: #ffffff;
}

/* Dark theme priority badges */
.dark-theme .priority-low {
  background: #374151;
  color: #9ca3af;
}
.dark-theme .priority-medium {
  background: #92400e;
  color: #fef3c7;
}
.dark-theme .priority-high {
  background: #c2410c;
  color: #fed7aa;
}
.dark-theme .priority-urgent {
  background: #dc2626;
  color: #fecaca;
}

/* Priority Modal Dark Theme */
.dark-theme .priority-option {
  background: #374151;
  color: #f3f4f6;
  border-color: #4b5563;
}

.dark-theme .priority-option:hover {
  border-color: #3b82f6;
  background: #1e3a8a;
  color: #93c5fd;
}

.dark-theme .priority-option.selected {
  border-color: #3b82f6 !important;
  background: #1e3a8a !important;
  color: #dbeafe !important;
}

.dark-theme .priority-modal-header {
  background: linear-gradient(135deg, #1f2937, #374151);
  border-color: #4b5563;
}

.dark-theme .priority-modal-content {
  background: #1f2937;
}

.dark-theme .priority-modal-title {
  color: #f9fafb;
}

.dark-theme .priority-modal-subtitle {
  color: #9ca3af;
}

/* Login Page Dark Mode - Removed to keep login page always in light mode */

/* Larger modal action buttons */
.action-btn.modal-action {
  font-size: 14px;
  padding: 10px 20px;
  width: auto;
  min-width: 120px;
}

.dark-theme .action-btn.cancel {
  background: #4b5563;
  color: #f3f4f6;
  border-color: #6b7280;
}

.dark-theme .action-btn.cancel:hover {
  background: #374151;
  border-color: #6b7280;
}

/* Messaging Interface Styles */
.messaging-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1001;
  align-items: center;
  justify-content: center;
}

.messaging-modal.active {
  display: flex;
}

.messaging-container {
  background: white;
  border-radius: 16px;
  width: 95%;
  max-width: 1200px;
  height: 85vh;
  max-height: 800px;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.messaging-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border-radius: 16px 16px 0 0;
}

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

.messaging-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
}

.messaging-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.messaging-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 2px 0 0 0;
}

.messaging-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.messaging-close:hover {
  color: #6b7280;
  background: #f3f4f6;
}

.messaging-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.conversation-panel {
  flex: 2;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e5e7eb;
}

/* Create a scrollable wrapper for messages and feedback */
.conversation-scroll-area {
  flex: 1;
  overflow-y: auto;
  background: #fafbfc;
}

.messages-container {
  padding: 20px;
  min-height: 0; /* Allow container to shrink */
}

.message {
  margin-bottom: 16px;
  max-width: 80%;
  animation: fadeInUp 0.3s ease;
}

.message.outgoing {
  margin-left: auto;
  text-align: right;
}

.message.incoming {
  margin-right: auto;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #6b7280;
}

.message.outgoing .message-header {
  justify-content: flex-end;
}

.message-author {
  font-weight: 600;
  color: #374151;
}

.message-time {
  color: #9ca3af;
}

.message-source {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.message-source.discord {
  background: #5865f2;
  color: white;
}

.message-source.webapp {
  background: #10b981;
  color: white;
}

.message-content {
  background: white;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  word-wrap: break-word;
  line-height: 1.5;
}

.message.outgoing .message-content {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.message.system .message-content {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #d1d5db;
  font-style: italic;
  text-align: center;
}

.message-input-area {
  padding: 20px;
  border-top: 1px solid #e5e7eb;
  background: white;
}

.message-input-container {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.message-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 22px;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  transition: all 0.15s ease;
  background: #f9fafb;
  overflow: hidden;
}

.message-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: white;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.message-input::placeholder {
  color: #9ca3af;
}

.send-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #3b82f6;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.send-button:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.send-button:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.info-panel {
  flex: 1;
  background: white;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.ticket-info-header {
  padding: 20px;
  border-bottom: 1px solid #f3f4f6;
}

.ticket-info-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 16px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
}

.info-label {
  color: #6b7280;
  font-weight: 500;
}

.info-value {
  color: #111827;
  font-weight: 600;
}

.ticket-actions-panel {
  padding: 20px;
  border-top: 1px solid #f3f4f6;
  background: #fafbfc;
}

.action-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.messaging-action-btn {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.messaging-action-btn.primary {
  background: #3b82f6;
  color: white;
}

.messaging-action-btn.primary:hover {
  background: #2563eb;
}

.messaging-action-btn.secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.messaging-action-btn.secondary:hover {
  background: #e5e7eb;
}

.messaging-action-btn.danger {
  background: #ef4444;
  color: white;
}

.messaging-action-btn.danger:hover {
  background: #dc2626;
}

.typing-indicator {
  display: none;
  padding: 12px 20px;
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
  background: #f9fafb;
  border-top: 1px solid #f3f4f6;
}

.typing-indicator.active {
  display: block;
}

.typing-dots {
  display: inline-block;
  margin-left: 8px;
}

.typing-dots::after {
  content: "";
  animation: typingDots 1.5s infinite;
}

@keyframes typingDots {
  0%,
  60% {
    content: "";
  }
  20% {
    content: ".";
  }
  40% {
    content: "..";
  }
  60% {
    content: "...";
  }
}

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

/* Optimistic message styling */
.message.optimistic .message-content {
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.message.optimistic .message-header {
  opacity: 0.6;
}

/* Dark Mode for Messaging Interface */
.dark-theme .messaging-container {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .messaging-header {
  background: linear-gradient(135deg, #1f2937, #374151);
  border-color: #4b5563;
}

.dark-theme .messaging-title {
  color: #f9fafb;
}

.dark-theme .messaging-subtitle {
  color: #9ca3af;
}

.dark-theme .messaging-close {
  color: #9ca3af;
}

.dark-theme .messaging-close:hover {
  color: #f3f4f6;
  background: #374151;
}

.dark-theme .conversation-panel {
  border-color: #374151;
}

.dark-theme .conversation-scroll-area {
  background: #111827;
}

.dark-theme .messages-container {
  background: transparent;
}

.dark-theme .message-content {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.dark-theme .message.outgoing .message-content {
  background: #3b82f6;
  color: white;
}

.dark-theme .message.system .message-content {
  background: #374151;
  color: #9ca3af;
  border-color: #4b5563;
}

.dark-theme .message-author {
  color: #f3f4f6;
}

.dark-theme .message-input-area {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .message-input {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.dark-theme .message-input:focus {
  background: #4b5563;
  border-color: #3b82f6;
}

.dark-theme .message-input::placeholder {
  color: #9ca3af;
}

.dark-theme .info-panel {
  background: #1f2937;
}

.dark-theme .ticket-info-header {
  border-color: #374151;
}

.dark-theme .ticket-info-title {
  color: #f9fafb;
}

.dark-theme .info-label {
  color: #9ca3af;
}

.dark-theme .info-value {
  color: #f3f4f6;
}

.dark-theme .ticket-actions-panel {
  background: #111827;
  border-color: #374151;
}

.dark-theme .messaging-action-btn.secondary {
  background: #374151;
  color: #f3f4f6;
  border-color: #4b5563;
}

.dark-theme .messaging-action-btn.secondary:hover {
  background: #4b5563;
}

.dark-theme .typing-indicator {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

/* Responsive Design for Messaging */
@media (max-width: 768px) {
  .messaging-container {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

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

  .messaging-body {
    flex-direction: column;
  }

  .conversation-panel {
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    flex: 2;
  }

  .conversation-scroll-area {
    flex: 1;
  }

  .info-panel {
    flex: 1;
    min-height: 300px;
  }

  .action-buttons-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .message {
    max-width: 90%;
  }
}

/* Hide dashboard during initial load to prevent flicker */
body.loading .sidebar,
body.loading .main-content {
  visibility: hidden;
}
body.loading {
  overflow: hidden;
}

/* Unread message indicator */
.unread-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444; /* red */
  margin-right: 6px;
  animation: pulse 1.5s infinite;
}

/* New ticket indicator */
.new-ticket-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444; /* red */
  margin-right: 6px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.4;
  }
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
}

/* Ticket stats small counter */
.ticket-stats {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

body.dark-theme .ticket-stats {
  color: #d1d5db;
}

/* Ticket statistics badges */
.ticket-stats-badges {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ticket-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.ticket-badge.open,
.ticket-badge.closed,
.ticket-badge.total {
  background: #f3f4f6;
  color: #374151;
}

/* Dark theme ticket badges */
body.dark-theme .ticket-badge.open,
body.dark-theme .ticket-badge.closed,
body.dark-theme .ticket-badge.total {
  background: #374151;
  color: #d1d5db;
}

/* Make section controls flex to position badges on right */
.section-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.unread-row td {
  font-weight: 700;
}

body.dark-theme .unread-row td {
  font-weight: 700;
}

.new-ticket-row td {
  font-weight: 700;
}

body.dark-theme .new-ticket-row td {
  font-weight: 700;
}

/* Transfer staff select uses unified styling - no override needed */

/* Unified dropdown styling - consistent with sort dropdowns */
select {
  cursor: pointer;
  transition: all 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: white;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 500;
  min-height: 32px;
  line-height: 1.3;
  background-image: url("../images/light-dropdown-arrow.svg");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 12px;
  padding-right: 28px;
  box-sizing: border-box;
}

select:hover {
  border-color: #9ca3af;
}

select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Better option styling for dropdown visibility */
select option {
  padding: 8px 12px;
  background: white;
  color: #374151;
  border: none; /* avoid inconsistent native borders */
  font-size: 14px;
  line-height: 1.4;
  /* draw right and bottom borders via background images for consistency */
  background-image:
    linear-gradient(to right, var(--border-color), var(--border-color)), /* right */
    linear-gradient(var(--border-color), var(--border-color)); /* bottom */
  background-position: right top, left bottom;
  background-size: 1px 100%, 100% 1px;
  background-repeat: no-repeat;
}

/* Add a top border for the first option to complete the frame */
select option:first-child {
  background-image:
    linear-gradient(to right, var(--border-color), var(--border-color)), /* right */
    linear-gradient(var(--border-color), var(--border-color)), /* bottom */
    linear-gradient(var(--border-color), var(--border-color)); /* top */
  background-position: right top, left bottom, left top;
  background-size: 1px 100%, 100% 1px, 100% 1px;
  background-repeat: no-repeat;
}

/* Ensure options have proper contrast and borders */
select option:hover,
select option:focus {
  background: #f8fafc !important;
  color: #1f2937 !important;
}

select option:checked,
select option:selected {
  background: #3b82f6 !important;
  color: white !important;
}

/* Remove italic styling for ticket info messages */
.message.ticket-info {
  max-width: 100%;
  padding-bottom: 0;
  margin-bottom: 0;
}

.message.ticket-info .message-content {
  font-style: normal;
  background: transparent;
  color: #374151;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Dark mode styles for ticket info */
.dark-theme .message.ticket-info {
  border-bottom: 1px solid #4b5563;
}

.dark-theme .message.ticket-info .message-content {
  color: #d1d5db;
}

/* Divider under ticket info with centered text */
.ticket-info-divider {
  position: relative;
  text-align: center;
  margin: 20px 0;
  height: 1px;
  background: #e5e7eb;
}

.ticket-info-divider span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--ticket-info-bg, #fff);
  color: #9ca3af;
  padding: 0 15px;
  font-size: 12px;
  white-space: nowrap;
}

.dark-theme .ticket-info-divider {
  background: #4b5563;
}

.dark-theme .ticket-info-divider span {
  background: #181e29;
  color: #6b7280;
}

/* Attachment button and preview */
.attachment-button {
  background: transparent;
  border: none;
  color: #4b5563;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  transition: background-color 0.2s ease, color 0.2s ease;
  height: 44px;
  width: 44px;
  flex-shrink: 0;
}

.attachment-button:hover {
  background: #f3f4f6;
  color: #111827;
}

.dark-theme .attachment-button:hover {
  background: #4b5563;
  color: #d1d5db;
}

.attachment-preview {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
  display: none;
  flex-direction: column;
  gap: 4px;
}

.attachment-preview:not(:empty) {
  display: flex;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
}

.attachment-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.attachment-name {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.attachment-size {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

.attachment-remove {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  border-radius: 3px;
  margin-left: 8px;
}

.attachment-remove:hover {
  background: #f3f4f6;
  color: #ef4444;
}

.attachment-chip {
  background: #e5e7eb;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #374151;
}

body.dark-theme .attachment-chip {
  background: #374151;
  color: #d1d5db;
}

.message-attachments {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-attachment {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-image-attachment {
  max-width: 250px;
  max-height: 200px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  transition: transform 0.2s ease;
}

.message-image-attachment:hover {
  transform: scale(1.02);
}

.message-file-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f3f4f6;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
  text-decoration: none;
  border: 1px solid #e5e7eb;
  transition: background-color 0.2s ease;
  max-width: 300px;
}

.message-file-attachment:hover {
  background: #e5e7eb;
  text-decoration: none;
}

.attachment-name {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
  word-break: break-all;
}

body.dark-theme .message-image-attachment {
  border-color: #4b5563;
}

body.dark-theme .message-file-attachment {
  background: #374151;
  color: #d1d5db;
  border-color: #4b5563;
}

body.dark-theme .message-file-attachment:hover {
  background: #4b5563;
}

body.dark-theme .attachment-name {
  color: #9ca3af;
}

/* Dark theme attachment preview */
.dark-theme .attachment-preview {
  background: #374151;
  border-color: #4b5563;
}

.dark-theme .attachment-item {
  background: #1f2937;
  border-color: #4b5563;
}

.dark-theme .attachment-name {
  color: #d1d5db;
}

.dark-theme .attachment-size {
  color: #9ca3af;
}

.dark-theme .attachment-remove {
  color: #9ca3af;
}

.dark-theme .attachment-remove:hover {
  background: #4b5563;
  color: #ef4444;
}

.action-buttons-grid .ai-summary {
  grid-column: 1 / -1;
  font-size: 14px;
}

.ai-btn-icon {
  display: inline-flex;
  margin-right: 6px;
}

.ai-btn-icon img {
  width: 16px;
  height: 16px;
}

.dark-theme .ai-icon-img {
  filter: invert(1) brightness(1.2);
}

/* AI Chat Styles */
.ai-chat-container {
  display: flex;
  flex-direction: column;
  height: 83vh;
  min-height: 600px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-primary);
  overflow: hidden;
}

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

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

.ai-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-avatar-img {
  width: 24px;
  height: 24px;
  filter: invert(1) brightness(1.2);
}

.ai-chat-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.ai-chat-subtitle {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-primary);
  scroll-behavior: smooth;
}

.ai-message {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.ai-message.user {
  flex-direction: row-reverse;
}

.ai-message.assistant {
  flex-direction: row;
}

.ai-message .msg-box {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.ai-message.user .msg-box {
  background: #3b82f6;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.ai-message.assistant .msg-box {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.ai-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.ai-input-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 8px 12px;
  transition: border-color 0.2s ease;
}

.ai-input-container:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ai-input-field {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  padding: 8px 0;
  max-height: 120px;
  min-height: 20px;
  line-height: 1.4;
}

.ai-input-field::placeholder {
  color: var(--text-secondary);
}

.ai-attachment-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-attachment-button:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.ai-send-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: #3b82f6;
  color: white;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-send-button:hover {
  background: #2563eb;
  transform: scale(1.05);
}

.ai-send-button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

.ai-attachment-preview {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-attachment-preview:empty {
  display: none;
}

.ai-attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 13px;
}

.ai-attachment-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  margin-left: 4px;
  font-size: 16px;
  line-height: 1;
}

.ai-attachment-remove:hover {
  background: #f3f4f6;
  color: #ef4444;
}

/* Dark theme styles */
.dark-theme .ai-chat-header {
  background: #1f2937;
  border-bottom-color: #374151;
}

.dark-theme .ai-chat-title {
  color: #f9fafb;
}

.dark-theme .ai-chat-subtitle {
  color: #9ca3af;
}

.dark-theme .ai-messages {
  background: #111827;
}

.dark-theme .ai-message.assistant .msg-box {
  background: #1f2937;
  color: #f9fafb;
  border-color: #374151;
}

.dark-theme .ai-input-area {
  background: #111827;
  border-top-color: #374151;
}

.dark-theme .ai-input-container {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .ai-input-container:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark-theme .ai-input-field {
  color: #f9fafb;
}

.dark-theme .ai-input-field::placeholder {
  color: #6b7280;
}

.dark-theme .ai-attachment-button:hover {
  background: #374151;
  color: #f9fafb;
}

.dark-theme .ai-attachment-item {
  background: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

.dark-theme .ai-attachment-remove:hover {
  background: #374151;
  color: #ef4444;
}

/* AI Chart Styles */
.ai-chart-container {
  margin-top: 12px;
  background: var(--bg-secondary, white);
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color, #e5e7eb);
}

.dark-theme .ai-chart-container {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .ai-input-area {
  border-top: 1px solid #374151;
  background: #1f2937;
}

/* ApexCharts Professional Styling */
.apexcharts-canvas {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif !important;
}

.apexcharts-tooltip {
  border-radius: 8px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid var(--border-color) !important;
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.apexcharts-tooltip-title {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-color) !important;
  font-weight: 600 !important;
}

.apexcharts-legend {
  color: var(--text-secondary) !important;
}

.apexcharts-legend-text {
  color: var(--text-secondary) !important;
}

.apexcharts-gridline {
  stroke: var(--border-color) !important;
}

.apexcharts-text {
  fill: var(--text-secondary) !important;
}

.apexcharts-xaxistooltip {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
}

.apexcharts-yaxistooltip {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* Dark theme specific ApexCharts adjustments */
.dark-theme .apexcharts-tooltip {
  background: #1f2937 !important;
  border-color: #374151 !important;
}

.dark-theme .apexcharts-tooltip-title {
  background: #111827 !important;
  border-color: #374151 !important;
}

.dark-theme .apexcharts-gridline {
  stroke: #374151 !important;
}

/* Chart container improvements */
.chart-container {
  position: relative;
  min-height: 300px;
}

.ticket-types-chart {
  position: relative;
  min-height: 180px;
}

/* Ensure charts are responsive */
.apexcharts-svg {
  width: 100% !important;
}

/* Ticket Type Management Styles */
.ticket-type-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
}

.ticket-type-item input[type="text"] {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
}

.ticket-type-item input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

.ticket-type-remove {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 12px;
  min-width: 60px;
}

.ticket-type-remove:hover {
  background: #dc2626;
}

.dark-theme .ticket-type-item {
  background: #374151;
  border-color: #4b5563;
}

.dark-theme .ticket-type-item input[type="text"] {
  background: #1f2937;
  border-color: #4b5563;
  color: #f9fafb;
}

.dark-theme .ticket-type-item input[type="text"]:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px #60a5fa;
}

/* Professional gradient animations */
@keyframes chartFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chart-container > div {
  animation: chartFadeIn 0.8s ease-out;
}

/* Feedback System Styles */
.feedback-section {
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.feedback-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  margin: 16px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.feedback-header {
  text-align: center;
  margin-bottom: 24px;
}

.feedback-header h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.feedback-header p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.rating-section {
  margin-bottom: 20px;
  text-align: center;
}

.rating-section label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.star-rating {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.star {
  font-size: 32px;
  color: #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.star:hover,
.star.active {
  color: #fbbf24;
  transform: scale(1.1);
}

.star.active {
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
}

.feedback-message-section {
  margin-bottom: 24px;
}

.feedback-message-section label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.feedback-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  resize: vertical;
  transition: border-color 0.2s ease;
}

.feedback-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.feedback-textarea::placeholder {
  color: var(--text-secondary);
}

.feedback-submit-btn {
  width: 100%;
  padding: 14px 24px;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.feedback-submit-btn:hover {
  background: #16a34a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.feedback-submit-btn:active {
  transform: translateY(0);
}

.feedback-submit-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Feedback Submitted Styles */
.feedback-submitted {
  margin-top: 20px;
  padding-top: 20px;
}

.feedback-thank-you {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 32px 24px;
  margin: 16px 0;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.feedback-icon {
  width: 48px;
  height: 48px;
  background: #22c55e;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  margin: 0 auto 16px;
}

.feedback-thank-you h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.feedback-thank-you p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.submitted-feedback {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.submitted-rating {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 12px;
}

.submitted-rating .star {
  font-size: 20px;
  color: #fbbf24;
}

.submitted-message {
  font-size: 14px;
  color: var(--text-primary);
  font-style: italic;
  line-height: 1.5;
}

/* Conversation divider for end of conversation */
.conversation-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  position: relative;
}

.conversation-divider::before {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.conversation-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.conversation-divider span {
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-primary);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Dark theme adjustments */
.dark-theme .feedback-container,
.dark-theme .feedback-thank-you {
  background: #1f2937;
  border-color: #374151;
}

.dark-theme .feedback-textarea {
  background: #111827;
  border-color: #374151;
  color: #f9fafb;
}

.dark-theme .feedback-textarea:focus {
  border-color: #3b82f6;
}

.dark-theme .submitted-feedback {
  background: #111827;
}

.dark-theme .conversation-divider span {
  background: #1f2937;
}

/* Animation for feedback form */
@keyframes feedbackSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feedback-section,
.feedback-submitted {
  animation: feedbackSlideIn 0.5s ease-out;
}

/* ApexCharts menu styling */
.apexcharts-menu {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.apexcharts-menu-item {
  color: var(--text-primary) !important;
}

.apexcharts-menu-item:hover {
  background: var(--bg-secondary) !important;
}

/* ApexCharts zoom controls */
.apexcharts-toolbar {
  color: var(--text-secondary) !important;
}

.apexcharts-zoom-icon,
.apexcharts-zoomin-icon,
.apexcharts-zoomout-icon,
.apexcharts-reset-icon {
  fill: var(--text-secondary) !important;
}

.apexcharts-zoom-icon:hover,
.apexcharts-zoomin-icon:hover,
.apexcharts-zoomout-icon:hover,
.apexcharts-reset-icon:hover {
  fill: var(--text-primary) !important;
}

/* Notes Management Styles */
.notes-container {
  padding: 24px;
}

.notes-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.notes-tab-btn {
  background: none;
  border: none;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.notes-tab-btn:hover {
  color: var(--text-color);
  background-color: rgba(0, 0, 0, 0.05);
}

.notes-tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.notes-tab-content {
  display: none;
}

.notes-tab-content.active {
  display: block;
}

.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.notes-header h4 {
  margin: 0;
  color: var(--text-color);
  font-size: 18px;
  font-weight: 600;
}

.notes-header .btn {
  margin-left: auto;
}

/* Dark theme adjustments for tabs */
[data-theme="dark"] .notes-tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.notes-list {
  max-height: 500px;
  overflow-y: auto;
}

.note-item {
  background: #f3f4f6; /* slightly darker background for light theme */
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

[data-theme="dark"] .note-item {
  background: #1f2937; /* darker card for dark theme */
}

/* Icon style buttons */
.btn-icon {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--primary-color);
}

.btn-icon.delete:hover {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

[data-theme="dark"] .btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.note-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.note-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  flex: 1;
  margin-right: 12px;
}

.note-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.note-content {
  color: var(--text-color);
  line-height: 1.6;
  margin-bottom: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.note-meta {
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
}

.no-notes {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 40px 20px;
}

/* Dark theme adjustments for notes */
[data-theme="dark"] .btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Form styles for notes */
.form-group textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.form-group textarea:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Generic button styles for modal actions and note tools */
.btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn.primary {
  background: #3b82f6;
  color: #ffffff;
  border: none;
}

.btn.primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
}

.btn.secondary {
  background: #ffffff;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn.secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* Ensure svg icons within icon buttons size consistently */
.btn-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Form actions for Add/Edit Note modal */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 24px 32px;
  border-top: 1px solid #e5e7eb;
}

/* Disable outer scroll for Manage Notes modal */
#manage-notes-modal .modal-content {
  overflow-y: hidden;
}

/* Ensure notes list can grow to fit modal height and scroll */
#manage-notes-modal .notes-list {
  max-height: 60vh; /* adapt to viewport */
  overflow-y: auto;
}

.dark-theme select option:last-child {
  border-bottom: 1px solid var(--border-color);
}

/* Refresh Button */
.refresh-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(107, 114, 128, 0.1);
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 6px 8px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 8px;
}

.refresh-btn:hover {
  background: rgba(107, 114, 128, 0.15);
  border-color: #9ca3af;
  transform: translateY(-1px);
}

.refresh-btn:active {
  transform: translateY(0);
}

.refresh-icon {
  font-size: 16px;
  transition: transform 0.3s ease;
}

.refresh-btn:hover .refresh-icon {
  transform: rotate(180deg);
}

.refresh-btn.refreshing .refresh-icon {
  animation: spin 1s linear infinite;
}

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

/* Dark theme styles for refresh button */
.dark-theme .refresh-btn {
  background: rgba(156, 163, 175, 0.1);
  color: #f3f4f6;
  border-color: #4b5563;
}

.dark-theme .refresh-btn:hover {
  background: rgba(156, 163, 175, 0.15);
  border-color: #6b7280;
}

/* --- DARK MODE FIXES (2024-06) --- */

/* 1. Modal action button backgrounds (ensure contrast) */
.dark-theme .modal-actions {
  background: #232b38;
  border-top: 1px solid #374151;
}
.dark-theme .action-btn.modal-action {
  background: #2563eb;
  color: #fff;
  border: none;
}
.dark-theme .action-btn.modal-action:hover {
  background: #1d4ed8;
  color: #fff;
}

/* 3. Attachment icon should be white in dark mode */
.dark-theme .btn-icon svg,
.dark-theme .attachment-button svg {
  color: #fff !important;
  fill: #fff !important;
}
.dark-theme .attachment-button {
  color: #fff;
}

/* 4. Keep servers dropdown background white in dark mode */
.dark-theme .server-filter-dropdown {
  background: #fff !important;
  color: #232b38 !important;
  border-color: #374151;
}
.dark-theme .server-filter-dropdown * {
  color: #232b38 !important;
}

/* 5. Notes background and text color in dark mode */
[data-theme="dark"] .note-item {
  background: #232b38 !important;
  color: #f3f4f6 !important;
}
[data-theme="dark"] .note-title,
[data-theme="dark"] .note-content,
[data-theme="dark"] .note-meta {
  color: #f3f4f6 !important;
}
[data-theme="dark"] .notes-tab-content {
  background: #1f2937 !important;
}

/* 6. Modal label/value color consistency in dark mode */
.dark-theme .form-group label,
.dark-theme .form-group input,
.dark-theme .form-group select,
.dark-theme .form-group textarea,
.dark-theme .form-group .info-label,
.dark-theme .form-group .info-value {
  color: #fff !important;
}
.dark-theme .form-group input,
.dark-theme .form-group select,
.dark-theme .form-group textarea {
  background: #232b38 !important;
  border-color: #4b5563;
}

/* Ensure all .info-label and .info-value in modals are white */
.dark-theme .info-label,
.dark-theme .info-value {
  color: #fff !important;
}

/* --- END DARK MODE FIXES --- */

/* 2. 'All Servers' option in server dropdown white in dark mode */
.dark-theme .server-filter-dropdown option[value="all"],
.dark-theme .server-filter-dropdown option:first-child {
  background: #fff !important;
  color: #232b38 !important;
}

/* 3. Modal table text (th, td) white in dark mode */
.dark-theme .modal-content th,
.dark-theme .modal-content td {
  color: #fff !important;
}

/* 4. Modal muted/secondary text white in dark mode */
.dark-theme .modal-content .text-muted,
.dark-theme .modal-content .text-secondary,
.dark-theme .modal-content .text-grey,
.dark-theme .modal-content .text-gray {
  color: #fff !important;
  opacity: 0.85;
}

/* --- DARK MODE PATCH 4: Manage Notes Modal --- */
[data-theme="dark"] .notes-tab-content,
[data-theme="dark"] .note-item,
[data-theme="dark"] textarea,
.dark-theme .modal-content textarea {
  background: #232b38 !important;
  color: #f3f4f6 !important;
  border-color: #374151 !important;
}
[data-theme="dark"] textarea::placeholder,
.dark-theme .modal-content textarea::placeholder {
  color: #9ca3af !important;
  opacity: 1;
}
/* --- END PATCH 4 --- */

/* --- DARK MODE PATCH 5: Notes Display Card --- */
[data-theme="dark"] .note-item,
[data-theme="dark"] .notes-list,
[data-theme="dark"] .notes-tab-content,
[data-theme="dark"] .notes-container,
.dark-theme .modal-content .note-item,
.dark-theme .modal-content .notes-list,
.dark-theme .modal-content .notes-tab-content,
.dark-theme .modal-content .notes-container,
.dark-theme .modal-content .note-content,
.dark-theme .modal-content .note-title {
  background: #232b38 !important;
  color: #f3f4f6 !important;
  border-color: #374151 !important;
}
.dark-theme .modal-content .note-meta {
  color: #9ca3af !important;
}
/* --- END PATCH 5 --- */

/* --- DARK MODE PATCH 6: Scrollbar Styling --- */
.dark-theme ::-webkit-scrollbar,
[data-theme="dark"] ::-webkit-scrollbar {
  width: 10px;
  background: #232b38;
}
.dark-theme ::-webkit-scrollbar-thumb,
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 8px;
  border: 2px solid #232b38;
}
.dark-theme ::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}
.dark-theme ::-webkit-scrollbar-corner,
[data-theme="dark"] ::-webkit-scrollbar-corner {
  background: #232b38;
}

/* Firefox */
.dark-theme,
[data-theme="dark"] {
  scrollbar-color: #374151 #232b38;
  scrollbar-width: thin;
}
/* --- END PATCH 6 --- */

/* --- DARK MODE PATCH 7: Note Card Separation --- */
.dark-theme .modal-content .note-item,
[data-theme="dark"] .note-item {
  background: #283347 !important; /* lighter than modal bg */
  border: 1px solid #374151 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
/* --- END PATCH 7 --- */

/* --- DARK MODE PATCH 8: Note Card Child Background Consistency --- */
.dark-theme .modal-content .note-item *,
[data-theme="dark"] .note-item * {
  background: #283347 !important;
}
/* --- END PATCH 8 --- */

/* --- MODERN SQUARE STAT ICON --- */
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #e5edfa;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.stat-icon svg,
.stat-icon img {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  display: block;
}
.dark-theme .stat-icon {
  background: #393b4d;
}
.stat-icon:focus,
.stat-icon:active {
  outline: none;
  box-shadow: none;
}
/* --- END MODERN SQUARE STAT ICON --- */

/* --- DARK MODE: STAT ICONS BLACK --- */
.dark-theme .stat-icon svg,
.dark-theme .stat-icon img {
  color: #111827 !important;
  fill: #111827 !important;
  filter: none !important;
}
/* --- END DARK MODE: STAT ICONS BLACK --- */

/* --- THEME ICON SWITCHING FOR STAT CARDS (STRONG) --- */
.light-icon {
  display: inline !important;
}
.dark-icon {
  display: none !important;
}
body.dark-theme .light-icon {
  display: none !important;
}
body.dark-theme .dark-icon {
  display: inline !important;
}
/* --- END THEME ICON SWITCHING (STRONG) --- */

/* --- DARK MODE: ATTACHMENT ICONS WHITE --- */
.dark-theme .attachment-button svg,
.dark-theme .attachment-button img,
.dark-theme .ai-attachment-button svg,
.dark-theme .ai-attachment-button img {
  color: #fff !important;
  fill: #fff !important;
  filter: none !important;
}
/* --- END DARK MODE: ATTACHMENT ICONS WHITE --- */
