/* --- START: Custom UI Overrides --- */

:root {
  /* Primary Colors */
  --primary-color: #6c5b7b;
  --primary-light: #9f7aea;
  --primary-dark: #44337a;

  /* Secondary Colors */
  --secondary-color: #d53f8c;
  --secondary-light: #ed64a6;
  --secondary-dark: #97266d;

  /* Background Colors */
  --bg-light: #f7fafc;
  --bg-dark: #07090f;

  /* Card Colors */
  --card-bg-light: #ffffff;
  --card-bg-dark: #181d2b;

  /* Text Colors */
  --text-light: #8480ae;
  --text-dark: #e2e8f0;

  /* Accent Colors */
  --accent-success: #48bb78;
  --accent-danger: #e53e3e;
  --accent-warning: #ed8936;
  --accent-info: #4299e1;
}

/* --- START: Common Base Styles --- */

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
}

p {
  color: #6c757d;
  margin-bottom: 1rem;
  line-height: 1.5;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: none;
}

/* Spacing utilities */
.mb-0-5 {
  margin-bottom: 0.5rem;
}

.mb-1-5 {
  margin-bottom: 1.5rem;
}

.mt-0-5 {
  margin-top: 0.5rem;
}

.mt-1-5 {
  margin-top: 1.5rem;
}

.p-0-5 {
  padding: 0.5rem;
}

/* Flex utilities */
.d-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.d-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Common animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

/* Responsive text truncation */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Form elements consistent styling */
input,
select,
textarea {
  border-radius: 0.5rem;
  border: 1px solid #dee2e6;
  padding: 0.5rem 0.75rem;
  transition:
    border-color 0.15s ease-in-out,
    box-shadow 0.15s ease-in-out;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(108, 91, 123, 0.25);
  outline: 0;
}

/* Dark mode compatibility for base elements */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
  color: #f8f9fa;
}

[data-theme="dark"] p {
  color: #adb5bd;
}

[data-theme="dark"] a:hover {
  color: var(--secondary-light);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background-color: #2a3445;
  border-color: #495057;
  color: #e0e0e0;
}

/* --- END: Common Base Styles --- */

body {
  background-color: var(--bg-light);
  color: var(--text-light);
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

body.dark-mode {
  background-color: #07090f;
  color: var(--text-dark);
}

.card {
  background-color: var(--card-bg-light);
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

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

.dark-mode .card {
  background-color: #181d2b;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  border: none;
  border-radius: 0.75rem;
  color: #ffffff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.btn-primary:hover {
  background: linear-gradient(
    135deg,
    var(--primary-dark),
    var(--secondary-dark)
  );
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  border-radius: 0.75rem;
  color: #ffffff;
}

.btn-secondary:hover {
  background-color: var(--secondary-dark);
  border-color: var(--secondary-dark);
}

/* Accent buttons */
.btn-success {
  background-color: var(--accent-success);
  border-color: var(--accent-success);
  border-radius: 0.75rem;
}

.btn-danger {
  background-color: var(--accent-danger);
  border-color: var(--accent-danger);
  border-radius: 0.75rem;
}

.btn-warning {
  background-color: var(--accent-warning);
  border-color: var(--accent-warning);
  border-radius: 0.75rem;
}

.btn-info {
  background-color: var(--accent-info);
  border-color: var(--accent-info);
  border-radius: 0.75rem;
}
.btn-dark {
  background-color: var(--bg-dark);
  border-color: var(--bg-dark);
  border-radius: 0.75rem;
}

/* Page Background */
body,
.page-content-wrapper {
  background-color: #f0f4f8 !important;
}

/* Ensure card backgrounds are distinct */
.card {
  background-color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
  border-radius: 0.75rem !important;
}

/* Styling for the action grid buttons */
.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.action-grid .btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  height: 100px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  text-align: center;
  line-height: 1.2;
  border: none;
}

.action-grid .btn i,
.action-grid .btn svg {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.action-grid .btn-primary {
  background-color: #0d6efd !important;
  border-color: #0d6efd !important;
  color: white !important;
}

.action-grid .btn-secondary,
.action-grid .btn-light {
  background-color: #f0f4f8 !important;
  border-color: #dee2e6 !important;
  color: #6c757d !important;
}

/* Welcome message card styling */
.welcome-card {
  display: flex;
  align-items: center;
  background-color: white;
  padding: 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.welcome-card img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
}

.welcome-card .user-info {
  flex-grow: 1;
  text-align: right;
}

.welcome-card .user-info h5 {
  margin-bottom: 0.25rem;
  font-size: 1rem;
  font-weight: 600;
}

.welcome-card .user-info span {
  font-size: 0.85rem;
  color: #6c757d;
}

/* Specific styling for the top info block */
.info-block {
  background-color: white;
  padding: 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  text-align: center;
}

.info-block .stat-icon {
  font-size: 1.5rem;
  color: #0d6efd;
  margin-bottom: 0.5rem;
}

.info-block h6 {
  font-size: 0.9rem;
  color: #6c757d;
  margin-bottom: 0.25rem;
}

.info-block .stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #212529;
}

/* Adjustments for dark mode if needed */
[data-theme="dark"] body,
[data-theme="dark"] .page-content-wrapper {
  background-color: #07090f !important;
}

[data-theme="dark"] .card,
[data-theme="dark"] .welcome-card,
[data-theme="dark"] .info-block {
  background-color: #181d2b !important;
  color: #e0e0e0 !important;
}

[data-theme="dark"] .welcome-card .user-info h5,
[data-theme="dark"] .info-block .stat-value {
  color: #ffffff !important;
}

[data-theme="dark"] .welcome-card .user-info span,
[data-theme="dark"] .info-block h6 {
  color: #adb5bd !important;
}

[data-theme="dark"] .action-grid .btn-secondary,
[data-theme="dark"] .action-grid .btn-light {
  background-color: #343a4a !important;
  border-color: #495057 !important;
  color: #ced4da !important;
}

/* Table styles */
.table {
  background-color: var(--card-bg-light);
  border-radius: 0.5rem;
  overflow: hidden;
}

.dark-mode .table {
  background-color: #181d2b;
  color: #e0e0e0;
}

.table th {
  background-color: rgba(0, 0, 0, 0.03);
  font-weight: 600;
}

.dark-mode .table th {
  background-color: #111520 !important;
  color: #e0e0e0;
}

/* Ensure better contrast for input fields */
.form-control {
  background-color: var(--card-bg-light);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.dark-mode .form-control {
  background-color: #111520;
  border-color: #181d2b;
  color: #e0e0e0;
}

/* --- END: Custom UI Overrides --- */

/* --- START: Common Filter Card & Search Components --- */

/* Filter Card Styling - Global component for search and filter bars */
.filter-card {
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 15px;
  overflow: hidden;
  border: none;
}

.filter-card .card-body {
  padding: 15px;
}

/* Filter form buttons */
.filter-btn {
  border-radius: 8px;
  font-weight: 500;
  padding: 8px 12px;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  transform: translateY(-1px);
}

/* Form controls within filter cards */
.filter-card .form-select,
.filter-card .form-control {
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid #dee2e6;
}

.filter-card .form-select:focus,
.filter-card .form-control:focus {
  box-shadow: 0 0 0 3px rgba(108, 91, 123, 0.1);
  border-color: #6c5b7b;
}

/* Layout for filter controls */
.filter-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

/* Mobile specific optimizations for filter cards */
@media screen and (max-width: 768px) {
  .filter-card .card-body {
    padding: 10px;
  }

  .filter-card .h6 {
    font-size: 0.9rem;
    margin-bottom: 10px;
  }

  .filter-card .form-select,
  .filter-card .form-control {
    font-size: 0.9rem;
    padding: 6px 10px;
    height: 38px;
  }

  .filter-btn {
    padding: 6px 10px;
    font-size: 0.9rem;
  }

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

  .filter-controls .form-select {
    margin-bottom: 8px;
  }
}

/* --- START: Pagination Styling --- */

/* Purple-themed Pagination Style - Global component */
.pagination {
  justify-content: center;
  margin: 0;
  gap: 8px;
}

.pagination .page-item .page-link {
  color: #6c5b7b;
  background-color: transparent;
  border: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  border-radius: 50%;
  transition: all 0.2s ease;
  box-shadow: none;
  z-index: auto !important;
  font-size: 0.95rem;
}

.pagination .page-item .page-link:hover {
  background-color: rgba(108, 91, 123, 0.1);
  color: #6c5b7b;
}

.pagination .page-item.active .page-link {
  color: white;
  background: linear-gradient(145deg, #6c5b7b, #d53f8c);
  box-shadow: 0 3px 6px rgba(108, 91, 123, 0.3);
}

.pagination .page-item.disabled .page-link {
  color: #ccc;
  background-color: transparent;
  box-shadow: none;
}

/* Arrow icons styling */
.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
  background: transparent;
  color: #6c5b7b;
  width: 38px;
}

.pagination .page-item:first-child .page-link:hover,
.pagination .page-item:last-child .page-link:hover {
  background-color: rgba(108, 91, 123, 0.1);
  color: #6c5b7b;
}

/* Handle disabled arrow buttons */
.pagination .page-item.disabled:first-child .page-link,
.pagination .page-item.disabled:last-child .page-link {
  background: transparent;
  color: #ccc;
}

.pagination .page-link svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

/* Override the chevron paths to make them larger */
.pagination .page-link svg path {
  transform: scale(1.5);
  transform-origin: center;
}

/* Ensure correct sizing on mobile */
@media (max-width: 576px) {
  .pagination {
    gap: 6px;
  }

  .pagination .page-item .page-link {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .pagination .page-item:first-child .page-link,
  .pagination .page-item:last-child .page-link {
    width: 38px;
    height: 38px;
  }

  .pagination .page-link svg {
    width: 18px;
    height: 18px;
  }
}

/* Dark mode compatibility */
[data-theme="dark"] .filter-card {
  background-color: #181d2b !important;
}

[data-theme="dark"] .filter-card .h6,
[data-theme="dark"] .pagination .page-item .page-link {
  color: #ccc !important;
}

[data-theme="dark"] .pagination .page-item.active .page-link {
  color: white !important;
}

[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control {
  background-color: #111520 !important;
  border-color: #181d2b !important;
  color: #e0e0e0 !important;
}

[data-theme="dark"] .filter-btn {
  background-color: #111520 !important;
  color: #e0e0e0 !important;
}

/* --- END: Pagination Styling --- */

/* --- START: Ticket List Styling --- */

/* Chat/Ticket User List Styling - Global component */
.chat-user-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chat-user-list li {
  position: relative;
  margin-bottom: 10px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  background-color: #fff;
}

.chat-user-list li:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.chat-user-list li a {
  padding: 15px 12px;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #333;
  flex-wrap: wrap;
}

/* Status colors for different tickets */
.chat-user-list li.bg-info-light {
  background-color: rgba(69, 130, 236, 0.25) !important;
  border-right: 5px solid #4582ec;
}

.chat-user-list li.bg-warning-light {
  background-color: rgba(247, 151, 30, 0.25) !important;
  border-right: 5px solid #f7971e;
}

/* Badge container positioning */
.badge-container {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 10;
}

/* Base badge style */
.status-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: white;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  animation: pulse 1.5s infinite;
}

/* Specific badge styles */
.badge-new {
  background-color: #4582ec; /* Blue */
}

.badge-updated {
  background-color: #f7971e; /* Orange */
  color: #fff;
}

/* Improved chat user info layout */
.chat-user-info {
  flex: 1;
  min-width: 0; /* Allow proper truncation */
  padding: 0 10px;
}

.chat-user-info h6 {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
  white-space: wrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-user-info .last-chat {
  color: #666;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Improved badge styling */
.chat-user-list .badge {
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin: 2px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-user-list .badge i {
  margin-right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ticket ID styling */
.ticket-id {
  font-size: 13px;
  font-weight: bold;
  color: #777;
  margin: 0 5px;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.05);
}

/* Pulse animation */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Responsive layout for ticket items */
@media (max-width: 768px) {
  .chat-user-list li a {
    flex-wrap: wrap;
    padding: 12px 10px;
  }

  .chat-user-info {
    width: 100%;
  }

  .badge-container {
    top: 5px;
    right: 5px;
  }

  .status-badge {
    width: 20px;
    height: 20px;
  }
}

/* Dark mode support for ticket items */
[data-theme="dark"] .chat-user-list li {
  background-color: #181d2b !important;
}

[data-theme="dark"] .chat-user-list li a {
  color: #e0e0e0 !important;
}

[data-theme="dark"] .chat-user-info h6 {
  color: #f0f0f0 !important;
}

[data-theme="dark"] .chat-user-info .last-chat {
  color: #adb5bd !important;
}

[data-theme="dark"] .ticket-id {
  color: #adb5bd !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .chat-user-list li.bg-info-light {
  background-color: rgba(69, 130, 236, 0.15) !important;
}

[data-theme="dark"] .chat-user-list li.bg-warning-light {
  background-color: rgba(247, 151, 30, 0.15) !important;
}

/* Title button styling for ticket forms */
#title-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px; /* Reduce spacing to make it more compact */
  justify-content: center;
}

/* General Button Styling */
.title-button {
  font-size: 12px; /* Slightly smaller text for compactness */
  padding: 6px 10px; /* Reduce padding for a smaller button */
  border: 1px solid #6c757d; /* Lighter border */
  border-radius: 12px; /* Slightly rounded but compact */
  background: #f8f9fa;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  white-space: nowrap;
}

/* Hover effect */
.title-button:hover {
  background: #6c757d;
  color: #fff;
}

/* Active (clicked) effect */
.title-button:active,
.title-button.active {
  background: #495057;
  color: #fff;
  border-color: #495057;
}

/* Special styling for custom title button */
.custom-title {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.custom-title:hover {
  background: #0056b3;
  border-color: #0056b3;
}

/* Dark mode compatibility for title buttons */
[data-theme="dark"] .title-button {
  background: #111520;
  color: #e0e0e0;
  border-color: #181d2b;
}

[data-theme="dark"] .title-button:hover {
  background: #181d2b;
  color: #fff;
}

[data-theme="dark"] .custom-title {
  background: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

[data-theme="dark"] .custom-title:hover {
  background: #0b5ed7;
  border-color: #0b5ed7;
}

/* Campaign and Group list text styling */
.chat-user-list .chat-user-info h6 {
  color: #212529 !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
}

.chat-user-list .chat-user-info .last-chat p {
  color: #6c757d !important;
  font-weight: 400 !important;
  font-size: 0.85rem !important;
}

[data-theme="dark"] .chat-user-list .chat-user-info h6 {
  color: #f8f9fa !important;
}

[data-theme="dark"] .chat-user-list .chat-user-info .last-chat p {
  color: #adb5bd !important;
}

/* --- END: Ticket List Styling --- */

[view-mode="rtl"] body .shop-pagination small {
  border-left: 0;
  padding-left: 0;
  margin-left: 0;
  border-right: 3px solid #0d5afd;
  border-right: 3px solid var(--secondary-color);
  padding-right: 0.5rem;
  margin-right: 0.25rem;
}

/* Dark mode specific overrides */
[data-theme="dark"] body,
[data-theme="dark"] .page-content-wrapper {
  background-color: #07090f !important;
}

[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu {
  background-color: #181d2b !important;
  border-color: #111520 !important;
}

[data-theme="dark"] .welcome-card,
[data-theme="dark"] .info-block {
  background-color: #181d2b !important;
}

body.dark-mode {
  background-color: #07090f;
  color: var(--text-dark);
}

.dark-mode .card {
  background-color: #181d2b;
}

.dark-mode .table {
  background-color: #181d2b;
  color: #e0e0e0;
}

.dark-mode .table th {
  background-color: #111520 !important;
  color: #e0e0e0;
}

.dark-mode .form-control {
  background-color: #111520;
  border-color: #181d2b;
  color: #e0e0e0;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-control {
  background-color: #111520 !important;
  border-color: #181d2b !important;
  color: #e0e0e0 !important;
}

[data-theme="dark"] .filter-card {
  background-color: #181d2b !important;
}

[data-theme="dark"] .filter-btn {
  background-color: #111520 !important;
}

[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control {
  background-color: #111520 !important;
  border-color: #181d2b !important;
}

[data-theme="dark"] .chat-user-list li {
  background-color: #181d2b;
}

[data-theme="dark"] .action-grid .btn-secondary,
[data-theme="dark"] .action-grid .btn-light {
  background-color: #111520 !important;
  border-color: #181d2b !important;
  color: #ced4da !important;
}

[data-theme="dark"] .pagination .page-item .page-link {
  color: #ccc !important;
  background-color: #111520;
}

[data-theme="dark"] .pagination .page-item.active .page-link {
  color: white !important;
  background: linear-gradient(145deg, #6c5b7b, #d53f8c);
}

/* Dark mode overrides for all modal and dropdown components */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu {
  background-color: #181d2b !important;
  color: #e0e0e0;
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: #111520 !important;
}

/* Special dark mode section backgrounds */
[data-theme="dark"] .section-bg {
  background-color: #111520 !important;
}
