@font-face {
  font-family: 'flat-jooza';
  src: url('fonts/flat-jooza-regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary: #ffffff;
  --primary-2: #ffffff;
  --purple-dark: #4a148c;
  --bg: #f6f7fb;
  --card-radius: 16px;
  --text: #1d1f2c;
  --muted: #7b809a;
}

body {
  font-family: 'flat-jooza', sans-serif;
  background: radial-gradient(circle at 10% 20%, rgba(106, 17, 203, 0.08), transparent 35%),
    radial-gradient(circle at 90% 10%, rgba(143, 148, 251, 0.1), transparent 30%),
    linear-gradient(135deg, #f8f9ff 0%, #eef1ff 100%);
  color: var(--text);
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  font-family: 'flat-jooza', sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

input,
select,
textarea,
button {
  font-family: 'flat-jooza', sans-serif;
}

/* الاتجاه الافتراضي LTR، والتحويل لـ RTL عبر كلاس .rtl */
body {
  direction: ltr;
  text-align: left;
}

body.rtl {
  direction: rtl;
  text-align: right;
}

/* Sidebar layout for RTL: icon on the right, text on the left, tidy spacing */
body.rtl .sidebar .nav .nav-item .nav-link {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-end;
  /* start from the right edge */
  column-gap: 12px;
}

body.rtl .sidebar .nav .nav-item .nav-link .menu-title {
  margin: 0;
}

body.rtl .sidebar .nav .nav-item .nav-link .menu-icon {
  margin: 0;
}

.main-container {
  padding: 24px;
}

.navbar {
  border-radius: 16px;
  margin-top: 12px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.4px;
}

.navbar .navbar-brand-wrapper {
  justify-content: flex-start !important;
  padding-inline: 16px;
}

body.rtl .navbar .navbar-brand-wrapper {
  justify-content: flex-end !important;
}

.navbar .navbar-brand-wrapper .navbar-brand {
  width: auto !important;
  padding: 0 !important;
}

.navbar .navbar-brand-wrapper .navbar-brand img,
.navbar .navbar-brand-wrapper .navbar-brand.brand-logo-mini img {
  margin: 0 !important;
}

.card {
  border: none;
  border-radius: var(--card-radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  background: #fff;
  color: var(--text);
}

.card-header {
  background: #000;
  color: #fff;
  border: none;
  border-top-left-radius: var(--card-radius);
  border-top-right-radius: var(--card-radius);
}

.table {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.table thead {
  background: #eef0f7;
  color: var(--text);
}

.table td,
.table th {
  vertical-align: middle;
}

.form-control,
.form-select {
  border-radius: 10px;
  border: 1px solid #dfe4ec;
  background: #fff;
  color: var(--text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 0.15rem rgba(143, 148, 251, 0.25);
}

.assignee-picker {
  position: relative;
  border-radius: 10px;
  border: 1px solid #dfe4ec;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.assignee-picker__control {
  min-height: 52px;
  padding: 0.6rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.assignee-picker__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
}

.assignee-picker__placeholder {
  color: #7b809a;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.assignee-picker--has-selection .assignee-picker__placeholder {
  display: none;
}

.assignee-picker__control .mdi {
  font-size: 1.1rem;
  color: #7b809a;
}

.assignee-picker.open {
  border-color: #8f94fb;
  box-shadow: 0 0 0 0.2rem rgba(143, 148, 251, 0.25);
}

.assignee-picker__dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.4rem);
  border-radius: 12px;
  border: 1px solid #dfe4ec;
  background: #fff;
  box-shadow: 0 20px 40px rgba(15, 15, 30, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  z-index: 50;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.assignee-picker.open .assignee-picker__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.assignee-picker__search {
  padding: 0.75rem;
  border-bottom: 1px solid #edf0f6;
}

.assignee-picker__options {
  max-height: 220px;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.image-grouped {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.image-grouped img {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  margin-inline-start: -10px;
  transition: transform 0.2s ease;
}

.image-grouped img:first-child {
  margin-inline-start: 0;
}

.image-grouped img:hover {
  transform: translateY(-2px);
  z-index: 1;
}

.image-grouped img:focus-visible {
  outline: 2px solid #8f94fb;
  outline-offset: 2px;
}

.assignee-picker__option {
  position: relative;
  cursor: pointer;
}

.assignee-picker__option:hover .assignee-picker__option-body {
  background: #f1f4ff;
}

.assignee-picker__option-body {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

.assignee-picker__option-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.assignee-picker__option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.assignee-picker__option input:checked+.assignee-picker__option-body {
  background: #eef1ff;
  border-color: #8f94fb;
  box-shadow: 0 4px 10px rgba(143, 148, 251, 0.25);
}

.assignee-picker__option input:focus-visible+.assignee-picker__option-body {
  border-color: #8f94fb;
  box-shadow: 0 0 0 0.2rem rgba(143, 148, 251, 0.3);
}

.assignee-picker__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: #f3f4ff;
  color: #1d1f2c;
}

.assignee-picker__chip img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.assignee-picker__chip span {
  font-weight: 600;
  white-space: nowrap;
}

.assignee-picker__chip-remove {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.assignee-picker__chip-remove:focus-visible,
.assignee-picker__control:focus-visible {
  outline: 2px solid #8f94fb;
  outline-offset: 2px;
}

.assignee-descriptions-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.assignee-description-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.assignee-description-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

body:not(.rtl) .assignee-description-label {
  text-align: left;
}

.assignee-description-textarea {
  min-height: 44px;
  resize: vertical;
}

.assignee-description-textarea::placeholder {
  color: #9aa0b2;
}

.btn-primary,
.btn-primary:not(.btn-light),
.btn-gradient-primary,
.btn-outline-primary,
.btn-outline-info,
.btn-outline-danger,
.btn-secondary,
.btn-light,
.btn {
  background: #000 !important;
  border: 1px solid #000 !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  transition: all 0.3s ease !important;
}

.btn-primary:not(.btn-light),
.btn-check:checked+.btn-primary:not(.btn-light),
.btn-check:active+.btn-primary:not(.btn-light),
.btn-primary:not(.btn-light):active,
.btn-primary:not(.btn-light).active,
.show>.btn-primary:not(.btn-light).dropdown-toggle {
  background: #000 !important;
  border-color: #000 !important;
  color: #fff !important;
}

.btn-primary:hover,
.btn-gradient-primary:hover,
.btn-outline-primary:hover,
.btn-outline-info:hover,
.btn-outline-danger:hover,
.btn-secondary:hover,
.btn-light:hover,
.btn:hover {
  background: #1a1a1a !important;
  border-color: #000 !important;
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
}

.btn-primary:active,
.btn-gradient-primary:active,
.btn-outline-primary:active,
.btn-outline-info:active,
.btn-outline-danger:active,
.btn-secondary:active,
.btn-light:active,
.btn:active {
  background: #000 !important;
  border-color: #000 !important;
  color: #fff !important;
}

/* Override PurpleAdmin focus and active states */
html .btn-primary:focus,
html .btn-primary:not(.btn-light):focus,
html .btn-gradient-primary:focus,
html .btn-outline-primary:focus,
html .btn-outline-info:focus,
html .btn-outline-danger:focus,
html .btn-secondary:focus,
html .btn-light:focus,
html .btn:focus {
  background: #fff !important;
  border-color: #000 !important;
  color: #000 !important;
  box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25) !important;
}

html .btn-primary:active,
html .btn-primary:not(.btn-light):active,
html .btn-primary.active,
html .btn-check:checked+.btn-primary,
html .btn-check:active+.btn-primary,
html .show>.btn-primary.dropdown-toggle,
html .btn-gradient-primary:active,
html .btn-outline-primary:active,
html .btn-outline-info:active,
html .btn-outline-danger:active,
html .btn-secondary:active,
html .btn-light:active,
html .btn:active {
  background: #fff !important;
  border-color: #000 !important;
  color: #000 !important;
  box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25) !important;
}

html .btn-primary:focus:active,
html .btn-primary:not(.btn-light):focus:active,
html .btn-gradient-primary:focus:active,
html .btn-outline-primary:focus:active,
html .btn-outline-info:focus:active,
html .btn-outline-danger:focus:active,
html .btn-secondary:focus:active,
html .btn-light:focus:active,
html .btn:focus:active {
  background: #fff !important;
  border-color: #000 !important;
  color: #000 !important;
}

/* Override hover state from PurpleAdmin */
html .btn-primary:hover {
  background: #1a1a1a !important;
  border-color: #000 !important;
  color: #fff !important;
}

/* Additional specificity rules to override PurpleAdmin */
html body .btn-primary,
html body .btn-primary:not(.btn-light),
html body .btn-check:checked+.btn-primary:not(.btn-light),
html body .btn-check:active+.btn-primary:not(.btn-light),
html body .btn-primary:not(.btn-light).active {
  background: #000 !important;
  border-color: #000 !important;
  color: #fff !important;
}

html body .btn-primary:focus,
html body .btn-primary:not(.btn-light):focus,
html body .btn-primary.focus,
html body .btn-primary:not(.btn-light).focus {
  background: #fff !important;
  border-color: #000 !important;
  color: #000 !important;
  box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25) !important;
}

html body .btn-primary:active,
html body .btn-primary:not(.btn-light):active,
html body .btn-primary.active,
html body .btn-check:checked+.btn-primary,
html body .btn-check:active+.btn-primary,
html body .show>.btn-primary.dropdown-toggle {
  background: #fff !important;
  border-color: #000 !important;
  color: #000 !important;
  box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25) !important;
}

.btn-sm {
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
}

.alert {
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

/* metric cards */
.metric-card {
  color: #fff;
  border: none;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.15);
}

.metric-card .metric-label {
  margin: 0;
  opacity: 0.9;
}

.metric-card .metric-value {
  font-size: 2.4rem;
  font-weight: 700;
  margin: 4px 0 0;
}

.gradient-1 {
  background: linear-gradient(135deg, #6a11cb, #8f94fb);
}

.gradient-2 {
  background: linear-gradient(135deg, #9b51e0, #6a11cb);
}

.gradient-3 {
  background: linear-gradient(135deg, #5a8dee, #6a11cb);
}

.gradient-4 {
  background: linear-gradient(135deg, #ff6cab, #7367f0);
}

/* dark mode */
.dark-mode {
  background: #0c0d14;
  color: #f5f5f5;
}

.dark-mode .navbar,
.dark-mode .card,
.dark-mode .table {
  background: #161926;
  color: #f5f5f5;
  box-shadow: none;
}

.dark-mode .card-header {
  background: linear-gradient(135deg, #343a55, var(--primary));
}

.dark-mode .table thead {
  background: #1f2433;
}

.dark-mode .form-control,
.dark-mode .form-select {
  background-color: #131722;
  border-color: #2c3242;
  color: #e7e9ee;
}

.dark-mode .form-control:focus,
.dark-mode .form-select:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 0.15rem rgba(143, 148, 251, 0.25);
}

/* WhatsApp-like chat */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  background: linear-gradient(180deg, #f5f5f5 0%, #ffffff 100%);
  border-radius: 8px;
  padding: 16px;
}

.chat-bubble {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  animation: slideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  align-items: flex-end;
}

.chat-bubble.me {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.chat-bubble.other {
  flex-direction: row;
  justify-content: flex-start;
}

.chat-bubble-content {
  max-width: 72%;
  border-radius: 20px;
  padding: 12px 16px;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.chat-bubble.me .chat-bubble-content {
  background: linear-gradient(135deg, #25d366 0%, #1ebe5d 100%);
  color: #ffffff;
  border-bottom-right-radius: 6px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.chat-bubble.me .chat-bubble-content:hover {
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
  transform: translateY(-2px) scale(1.01);
}

.chat-bubble.other .chat-bubble-content {
  background: #ecf0f1;
  color: #2c3e50;
  border: none;
  border-bottom-left-radius: 6px;
}

.chat-bubble.other .chat-bubble-content:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  background: #dfe6ed;
  transform: translateY(-2px);
}

.chat-bubble .chat-meta {
  display: flex;
  flex-direction: column;
  font-size: 0.7rem;
  color: #999;
  opacity: 0.85;
  min-width: 50px;
  gap: 3px;
}

.chat-bubble.me .chat-meta {
  text-align: right;
  align-items: flex-end;
  padding-right: 6px;
}

.chat-bubble.other .chat-meta {
  text-align: left;
  align-items: flex-start;
  padding-left: 6px;
}

.chat-bubble .chat-user {
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: capitalize;
  letter-spacing: 0.1px;
}

.chat-bubble.me .chat-user {
  color: #1ebe5d;
  font-size: 0.7rem;
  opacity: 0.9;
}

.chat-bubble.other .chat-user {
  color: #5a6c7d;
  opacity: 0.9;
}

.chat-bubble .chat-time {
  font-size: 0.65rem;
  color: #b0b0b0;
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 400;
}

.chat-bubble .chat-text {
  margin: 0;
  white-space: normal;
  word-break: break-word;
  font-size: 0.95rem;
  line-height: 1.6;
  letter-spacing: 0.25px;
}

.chat-bubble .chat-attachment {
  margin-top: 12px;
  display: inline-block;
}

.chat-bubble .chat-attachment a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(0, 0, 0, 0.12);
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.8rem;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chat-bubble .chat-attachment a:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.chat-bubble.me .chat-attachment a {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  backdrop-filter: blur(10px);
}

.chat-bubble.me .chat-attachment a:hover {
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chat-bubble.other .chat-attachment a {
  color: #25d366;
  background: rgba(37, 211, 102, 0.15);
  border: 1px solid rgba(37, 211, 102, 0.25);
}

.chat-bubble.other .chat-attachment a:hover {
  background: rgba(37, 211, 102, 0.25);
  border-color: rgba(37, 211, 102, 0.4);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

/* Chat status indicators */
.chat-status {
  margin-left: 3px;
  font-size: 0.75rem;
  display: inline-block;
}

.chat-status.status-delivered {
  color: #bbb;
}

.chat-status.status-read {
  color: #25d366;
  font-weight: 600;
}

/* Chat Container - WhatsApp/Messenger style */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 600px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 40px rgba(0, 0, 0, 0.08);
  border: 1px solid #e8ecf1;
}

.chat-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #25d366 0%, #1ebe5d 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-header-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.chat-header-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.chat-header-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #999;
}

.chat-date-divider {
  text-align: center;
  color: #999;
  font-size: 0.85rem;
  margin: 12px 0;
  position: relative;
}

.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: #e0e0e0;
}

.chat-date-divider::before {
  left: 0;
}

.chat-date-divider::after {
  right: 0;
}

/* Dark mode */
.dark-mode .chat-thread {
  background: linear-gradient(180deg, #0d1419 0%, #161e27 100%);
}

.dark-mode .chat-bubble.me .chat-bubble-content {
  background: #056162;
  color: #e5e7eb;
}

.dark-mode .chat-bubble.other .chat-bubble-content {
  background: #262d35;
  color: #e5e7eb;
  border-color: #3a4149;
}

.dark-mode .chat-bubble .chat-meta {
  color: #aaa;
}

.dark-mode .chat-status.status-read {
  color: #4da6ff;
}

.dark-mode .chat-container {
  background: #1a1a1a;
  border-color: #333;
}

.dark-mode .chat-messages {
  background: #0d0d0d;
}

.dark-mode .chat-date-divider {
  color: #666;
}

.dark-mode .chat-date-divider::before,
.dark-mode .chat-date-divider::after {
  background: #333;
}

/* Chat button */
[data-chat-task] {
  transition: all 0.2s ease !important;
  border-radius: 8px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

[data-chat-task]:hover {
  background: #25d366 !important;
  color: white !important;
  border-color: #25d366 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3) !important;
}

/* WhatsApp-like input box */
.wa-input-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 30px;
  padding: 10px 14px;
  gap: 12px;
  width: 100%;
  border: 1px solid #e0e0e0;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wa-input-box:focus-within {
  border-color: #25d366;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.15), 0 0 0 3px rgba(37, 211, 102, 0.05);
}

.wa-attach {
  cursor: pointer;
  color: #666;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.wa-attach:hover {
  background: rgba(37, 211, 102, 0.08);
  color: #25d366;
}

.wa-attach:active {
  transform: scale(0.9);
}

.wa-textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: #222;
  font-size: 0.95rem;
  line-height: 1.4;
  max-height: 120px;
  padding: 8px 4px;
  font-family: inherit;
}

.wa-textarea::placeholder {
  color: #999;
}

.wa-send {
  background: #25d366;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.wa-send:hover {
  background: #1ebe5d;
  transform: scale(1.05);
}

.wa-send:active {
  transform: scale(0.95);
}

/* Dark mode */
.dark-mode .wa-input-box {
  background: #262d35;
  border-color: #3a4149;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.dark-mode .wa-input-box:focus-within {
  border-color: #31a24c;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(49, 162, 76, 0.15);
}

.dark-mode .wa-attach {
  color: #aaa;
}

.dark-mode .wa-attach:hover {
  background: rgba(49, 162, 76, 0.12);
  color: #31a24c;
}

.dark-mode .wa-textarea {
  color: #e5e7eb;
}

.dark-mode .wa-textarea::placeholder {
  color: #888;
}

.dark-mode .wa-send {
  background: #31a24c;
}

.dark-mode .wa-send:hover {
  background: #2a8f41;
}

/* kanban style */
.kanban-board {
  display: grid;
  gap: 16px;
}

@media (min-width: 992px) {
  .kanban-board {
    grid-template-columns: repeat(3, 1fr);
  }
}

.kanban-column {
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.kanban-column h5 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.kanban-task {
  border: 1px solid #eef0f7;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #f9f9ff;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.kanban-task.locked {
  opacity: 0.65;
  cursor: not-allowed;
}

.kanban-task:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.kanban-task .task-title {
  font-weight: 600;
  margin: 0;
}

.kanban-task .task-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.task-timer {
  display: grid;
  gap: 6px;
}

.task-timer-line {
  height: 6px;
  border-radius: 999px;
  background: #e9edf5;
  overflow: hidden;
  position: relative;
}

.task-timer-progress {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4caf50, #ffc107);
  transition: width 0.4s ease;
}

.task-timer.is-soon .task-timer-progress {
  background: linear-gradient(90deg, #f39c12, #e74c3c);
}

.task-timer.is-overdue .task-timer-line {
  background: #f8d7da;
}

.task-timer.is-overdue .task-timer-progress {
  background: repeating-linear-gradient(45deg,
      #dc3545,
      #dc3545 8px,
      #f5c2c7 8px,
      #f5c2c7 16px);
  animation: timerOverduePulse 1.2s linear infinite;
}

@keyframes timerOverduePulse {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 32px 0;
  }
}

.task-extension-summary {
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-extension-request,
.task-extension-rejected {
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-ended-at {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.task-extension-summary .extension-note {
  color: #6c757d;
}

.task-extension-request .request-note {
  color: #6c757d;
}

.task-extension-form .extension-due-input {
  max-width: 220px;
}

.kanban-details {
  display: none;
  margin-top: 10px;
  border-top: 1px solid #e6e8f0;
  padding-top: 10px;
}

.kanban-task.open .kanban-details {
  display: block;
}

.dark-mode .kanban-column {
  background: #161926;
  border: 1px solid #1f2433;
}

.dark-mode .kanban-task {
  background: #1f2433;
  border-color: #2c3242;
}

.modal-header.bg-success {
  background-color: #28a745 !important;
}

.modal-header.bg-danger {
  background-color: #dc3545 !important;
}

.modal-header.bg-primary {
  background-color: #0d6efd !important;
}

.modal-content {
  border-radius: 12px;
  border: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.modal-body {
  padding: 2rem;
  font-size: 1.05rem;
  line-height: 1.6;
}

.modal-body p {
  margin: 0;
}

.modal-footer {
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
}

.confirm-modal-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.95rem;
}

.confirm-modal-icon {
  font-size: 1.6rem;
  line-height: 1;
  color: #0d6efd;
}

.confirm-modal-text {
  font-weight: 500;
}

/* Chat animations and improvements */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(15px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-15px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.chat-bubble {
  animation: slideInLeft 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-bubble.me {
  animation: slideInRight 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Task chat layout */
.task-chat-container {
  margin-top: 12px;
  border: 1px solid #e6e8f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #f9fafb 0%, #ffffff 100%);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.task-chat-messages {
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: radial-gradient(circle at 10% 20%, rgba(37, 211, 102, 0.08), transparent 45%),
    linear-gradient(180deg, #f5f6f8 0%, #ffffff 100%);
}

.task-chat-form {
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #e8e8e8;
}

.task-chat-form .wa-input-box {
  width: 100%;
}

.task-chat-form .task-message-input {
  border: none !important;
  box-shadow: none !important;
  padding: 6px 4px !important;
  background: transparent !important;
}

.task-chat-form .task-message-input:focus {
  border-color: transparent !important;
  box-shadow: none !important;
  background: transparent !important;
}

.dark-mode .task-chat-container {
  background: #1a1a1a;
  border-color: #2c3242;
}

.dark-mode .task-chat-form {
  background: #161926;
  border-top-color: #2c3242;
}

.message-status.status-delivered {
  color: #b5b5b5;
}

.message-status.status-read {
  color: #34b7f1;
}

/* Task chat messages scrollbar */
.task-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.task-chat-messages::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 10px;
}

.task-chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #25d366, #1ebe5d);
  border-radius: 10px;
  box-shadow: 0 0 6px rgba(37, 211, 102, 0.2);
}

.task-chat-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #1ebe5d, #0da959);
  box-shadow: 0 0 8px rgba(37, 211, 102, 0.3);
}

/* Task message input improvements */
.task-message-input {
  border-radius: 20px !important;
  padding: 10px 16px !important;
  border: 1px solid #e0e0e0 !important;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 0.9rem !important;
  resize: none !important;
}

.task-message-input:focus {
  border-color: #25d366 !important;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1) !important;
  outline: none !important;
  background: #fafafa;
}

.task-message-input::placeholder {
  color: #bbb;
  opacity: 0.8;
}

/* Loading spinner animation */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.mdi-spin {
  animation: spin 1s linear infinite;
}

/* Improved response form styling */
.response-form {
  background: #f9f9ff;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #e6e8f0;
}

.response-form label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #4a5568;
  margin-bottom: 6px;
}

.response-form .form-control,
.response-form .form-select {
  border-radius: 8px;
  border: 1px solid #dfe4ec;
  font-size: 0.95rem;
}

.response-form button {
  transition: all 0.3s ease;
  font-weight: 500;
}

.response-form button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.response-form button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Chat attachment button improvements */
.chat-attachment a {
  display: inline-block !important;
  padding: 6px 10px !important;
  border-radius: 6px !important;
  background: rgba(0, 0, 0, 0.05) !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  font-size: 0.9rem !important;
}

.chat-attachment a:hover {
  background: rgba(0, 0, 0, 0.1) !important;
  transform: translateY(-2px);
}

/* Dark mode improvements */
.dark-mode .response-form {
  background: #1f2433;
  border-color: #2c3242;
}

.dark-mode .response-form label {
  color: #a0aec0;
}

.dark-mode .chat-attachment a {
  background: rgba(255, 255, 255, 0.1) !important;
}

.dark-mode .chat-attachment a:hover {
  background: rgba(255, 255, 255, 0.15) !important;
}

@keyframes slideInComment {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-new-comment {
  animation: slideInComment 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* WhatsApp-style messaging */
.whatsapp-message {
  display: flex;
  margin-bottom: 4px;
  padding: 0 8px;
  animation: slideInComment 0.3s ease-out;
}

.whatsapp-message.sent {
  justify-content: flex-end;
  animation: slideInRight 0.3s ease-out;
}

.whatsapp-message.received {
  justify-content: flex-start;
  animation: slideInLeft 0.3s ease-out;
}

.message-bubble {
  display: flex;
  flex-direction: column;
  max-width: 60%;
  padding: 8px 12px;
  border-radius: 18px;
  word-wrap: break-word;
  line-height: 1.5;
}

.whatsapp-message.sent .message-bubble {
  background-color: #dcf8c6;
  color: #000;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.whatsapp-message.received .message-bubble {
  background-color: #fff;
  color: #000;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.dark-mode .whatsapp-message.received .message-bubble {
  background-color: #1f3a5c;
  color: #e0e0e0;
}

.dark-mode .whatsapp-message.sent .message-bubble {
  background-color: #056162;
  color: #e0e0e0;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.whatsapp-text {
  font-size: 14px;
  word-break: break-word;
  white-space: normal;
}

.whatsapp-media {
  margin: -8px -12px -8px -12px;
  margin-bottom: 4px;
}

.whatsapp-image {
  max-width: 100%;
  max-height: 280px;
  border-radius: 12px;
  display: block;
  object-fit: cover;
}

.whatsapp-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  margin: 4px 0;
}

.file-icon {
  font-size: 32px;
  color: #007AFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  word-break: break-word;
}

.file-download {
  font-size: 12px;
  color: #007AFF;
  text-decoration: none;
  font-weight: 600;
}

.file-download:hover {
  text-decoration: underline;
}

.message-time {
  font-size: 11px;
  margin-top: 4px;
  color: #999;
  align-self: flex-end;
}

.whatsapp-message.sent .message-time {
  color: #777;
}

.message-status {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: #34b7f1;
  font-size: 14px;
}

.message-status i {
  font-size: 14px;
}

.task-chat-messages {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.task-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.task-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.task-chat-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.task-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #999;
}

.task-chat-container {
  animation: fadeInUp 0.3s ease-out;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.task-chat-form {
  animation: fadeInUp 0.3s ease-out 0.1s both;
}

.task-message-input {
  transition: all 0.2s;
}

.task-message-input:focus {
  border-color: #007AFF !important;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1) !important;
}

.dark-mode .task-chat-messages {
  background: linear-gradient(180deg, #1e1e1e 0%, #2a2a2a 100%) !important;
}

.dark-mode .task-message-input {
  background-color: #2a2a2a;
  border-color: #3a3a3a;
  color: #e0e0e0;
}

.dark-mode .task-message-input::placeholder {
  color: #999;
}

.task-chat-messages .card {
  transition: all 0.2s ease;
}

.task-chat-messages .card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-sound-toggle] {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  transition: all 0.2s ease;
  color: #4a148c;
}

[data-sound-toggle]:hover {
  background-color: rgba(106, 17, 203, 0.1);
  transform: scale(1.1);
}

[data-sound-toggle].muted {
  color: #d32f2f;
}

[data-sound-toggle] i {
  font-size: 1.3rem;
}

.dark-mode [data-sound-toggle] {
  color: #a0aec0;
}

.dark-mode [data-sound-toggle]:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.dark-mode [data-sound-toggle].muted {
  color: #ff7043;
}

.popup-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.popup-modal.active {
  opacity: 1;
}

.popup-modal.fade-out {
  opacity: 0;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.modal-content {
  position: relative;
  z-index: 10;
  background-color: #fff;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

.modal-content.fade-out {
  animation: modalSlideOut 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes modalSlideOut {
  from {
    transform: scale(1);
    opacity: 1;
  }

  to {
    transform: scale(0.9);
    opacity: 0;
  }
}

.modal-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-image {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
}

.popup-modal.image-only .modal-content {
  background: transparent;
  box-shadow: none;
  max-width: 95vw;
  max-height: 95vh;
  overflow: visible;
}

.popup-modal.image-only .modal-image-container {
  padding: 0;
}

.popup-modal.image-only .modal-image {
  max-width: 95vw;
  max-height: 95vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.popup-modal.image-only .modal-close-btn {
  background-color: rgba(0, 0, 0, 0.6);
  color: #fff;
}

.popup-modal.image-only .modal-close-btn:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.modal-file-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  min-width: 350px;
}

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

.modal-file-header i {
  font-size: 64px;
  color: #007AFF;
  flex-shrink: 0;
}

.modal-file-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-file-name {
  font-size: 16px;
  font-weight: 600;
  color: #000;
  word-break: break-word;
}

.modal-file-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background-color: #007AFF;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  transition: background-color 0.2s ease;
  width: fit-content;
}

.modal-file-download-btn:hover {
  background-color: #0051d5;
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background-color: rgba(0, 0, 0, 0.3);
  color: #fff;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 11;
}

.modal-close-btn:hover {
  background-color: rgba(0, 0, 0, 0.5);
  transform: scale(1.1);
}

.dark-mode .modal-content {
  background-color: #1e1e1e;
}

.dark-mode .modal-file-name {
  color: #e0e0e0;
}

.dark-mode .modal-file-header i {
  color: #66b3ff;
}

.dark-mode .modal-file-download-btn {
  background-color: #0066cc;
}

.dark-mode .modal-file-download-btn:hover {
  background-color: #004499;
}

.messages-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  min-height: 100vh;
  height: 100dvh;
  padding: 20px;
  background: #f6f7fb;
}

.dark-mode .messages-container {
  background: #121212;
}

/* WhatsApp-style messaging page */
.messages-container {
  background: linear-gradient(135deg, #f0f2f5 0%, #e7f2ea 100%);
}

.messages-container .chat-sidebar,
.messages-container .chat-main {
  border: 1px solid #e6e8f0;
}

.messages-container .chat-header {
  background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
  border-bottom: none;
}

.messages-container .chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
  flex: 1;
}

.rtl .messages-container .chat-header-info {
  flex-direction: row-reverse;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.messages-container .chat-header-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.messages-container .chat-header-info h3,
.messages-container .chat-subtitle {
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-container .btn-icon {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.mobile-only {
  display: none;
}

.messages-container .btn-icon:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.25);
}

.messages-container .btn-new-chat {
  color: #25d366;
}

.messages-container .btn-new-chat:hover {
  color: #1ebe5d;
}

.messages-container .conversation-item.active {
  background: #e7f7ee;
  border-left: 4px solid #25d366;
  padding-left: 6px;
}

body.rtl .messages-container .conversation-item.active {
  border-left: none;
  border-right: 4px solid #25d366;
  padding-left: 10px;
  padding-right: 6px;
}

.messages-container .conv-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.messages-container .conv-time {
  font-size: 11px;
  color: #8a8f98;
  white-space: nowrap;
}

.messages-container .conversation-item .badge {
  background: #25d366 !important;
  color: #ffffff !important;
  font-weight: 600;
}

.messages-container .conv-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.messages-container .chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 10px;
}

.messages-container .chat-avatar-placeholder {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

body.rtl .messages-container .chat-avatar {
  margin-right: 0;
  margin-left: 10px;
}

.messages-container .messages-area {
  background: radial-gradient(circle at 10% 15%, rgba(37, 211, 102, 0.08), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(18, 140, 126, 0.08), transparent 45%),
    #efeae2;
  gap: 6px;
}

.messages-container .message-bubble {
  max-width: 70%;
}

.messages-container .chat-input-area {
  background: #f0f2f5;
  border-top: 1px solid #e2e5e9;
}

.messages-container .wa-input-box {
  background: #ffffff;
}

.messages-container .message-input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 15px 10px 30px 0px !important;
}

.messages-container .wa-textarea {
  font-size: 0.95rem;
}

.dark-mode .messages-container .chat-header {
  background: #202c33;
}

.dark-mode .messages-container .chat-subtitle {
  color: #cbd5e1;
}

.dark-mode .messages-container .conversation-item.active {
  background: #1f2c33;
  border-color: #2aa64a;
}

.dark-mode .messages-container .messages-area {
  background: #0b141a;
}

.dark-mode .messages-container .chat-input-area {
  background: #1f2428;
}

.chat-sidebar {
  background: white;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.dark-mode .chat-sidebar {
  background: #1e1e1e;
}

.sidebar-header {
  padding: 15px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dark-mode .sidebar-header {
  border-bottom-color: #333;
}

.sidebar-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.dark-mode .sidebar-header h3 {
  color: #e0e0e0;
}

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

.btn-new-chat {
  background: none;
  border: none;
  font-size: 20px;
  color: #007AFF;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.btn-new-chat:hover {
  transform: scale(1.1);
}

.search-box {
  padding: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.dark-mode .search-box {
  border-bottom-color: #333;
}

.search-box .form-control {
  border-radius: 20px;
  border: 1px solid #e0e0e0;
  padding: 8px 15px;
  font-size: 14px;
}

.dark-mode .search-box .form-control {
  background: #2a2a2a;
  border-color: #444;
  color: #e0e0e0;
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #999;
  text-align: center;
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 10px;
  opacity: 0.5;
}

.conversation-item {
  display: flex;
  gap: 12px;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  align-items: center;
}

.conversation-item:hover,
.conversation-item.active {
  background: #f0f0f0;
}

.dark-mode .conversation-item:hover,
.dark-mode .conversation-item.active {
  background: #2a2a2a;
}

.conv-avatar {
  flex-shrink: 0;
}

.avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #007AFF, #00D4FF);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

.conv-info {
  flex: 1;
  min-width: 0;
}

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

.conv-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dark-mode .conv-title {
  color: #e0e0e0;
}

.conv-preview {
  margin: 0;
  font-size: 12px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dark-mode .conv-preview {
  color: #888;
}

.chat-main {
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.dark-mode .chat-main {
  background: #1e1e1e;
}

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: #999;
  text-align: center;
}

.chat-empty-state i {
  font-size: 64px;
  margin-bottom: 15px;
  opacity: 0.3;
}

.chat-window {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.dark-mode .chat-header {
  border-bottom-color: #333;
}

.chat-header-info h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.dark-mode .chat-header-info h3 {
  color: #e0e0e0;
}

.chat-subtitle {
  font-size: 12px;
  color: #999;
}

.dark-mode .chat-subtitle {
  color: #888;
}

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

.btn-icon {
  background: none;
  border: none;
  padding: 6px 8px;
  color: #007AFF;
  cursor: pointer;
  font-size: 18px;
  transition: opacity 0.2s;
}

.btn-icon:hover {
  opacity: 0.7;
}

.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  margin-bottom: 8px;
}

.message-own {
  justify-content: flex-end;
}



.message-other .message-content {
  background: #e5e5ea;
  color: #000;
}

.dark-mode .message-other .message-content {
  background: #2a2a2a;
  color: #e0e0e0;
}

.message-own .message-content {
  background: #007AFF;
  color: white;
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-bottom: 4px;
}

.dark-mode .message-sender {
  color: #aaa;
}

.message-text {
  margin-bottom: 4px;
}

.message-time {
  font-size: 11px;
  opacity: 0.6;
  margin-top: 4px;
}

.message-attachment {
  margin-top: 8px;
}

.message-attachment img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  cursor: pointer;
}

.message-attachment-file {
  margin-top: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.message-attachment-file a {
  color: inherit;
  text-decoration: none;
}

.message-attachment-file a:hover {
  text-decoration: underline;
}

.chat-input-area {
  padding: 15px 20px;
  border-top: 1px solid #e0e0e0;
  background: white;
}

.dark-mode .chat-input-area {
  border-top-color: #333;
  background: #1e1e1e;
}

.message-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.message-input {
  flex: 1;
  border-radius: 20px !important;
  border: 1px solid #e0e0e0 !important;
  padding: 10px 15px !important;
}

.dark-mode .message-input {
  background: #2a2a2a !important;
  border-color: #444 !important;
  color: #e0e0e0 !important;
}

.btn-attach {
  cursor: pointer;
  color: #007AFF;
  font-size: 18px;
  padding: 6px 8px;
  transition: opacity 0.2s;
}

.btn-attach:hover {
  opacity: 0.7;
}

.btn-send {
  background: #007AFF;
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}

.btn-send:hover {
  background: #0051d5;
}

.selected-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}

.file-item {
  background: #f0f0f0;
  padding: 6px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.dark-mode .file-item {
  background: #2a2a2a;
}

.user-search-results,
.members-search-results {
  max-height: 300px;
  overflow-y: auto;
}

.search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #666;
  font-size: 14px;
}

.dark-mode .search-loading {
  color: #aaa;
}

.search-loading .spinner-border {
  width: 18px;
  height: 18px;
  border-width: 2px;
  color: #007AFF;
}

.user-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  animation: slideInFromLeft 0.3s ease forwards;
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.user-search-item:hover,
.user-search-item.highlighted {
  background: #f0f0f0;
  border-left-color: #007AFF;
  transform: translateX(2px);
}

.dark-mode .user-search-item:hover,
.dark-mode .user-search-item.highlighted {
  background: #2a2a2a;
  border-left-color: #66b3ff;
}

.user-search-item.highlighted {
  background: #e3f2fd;
}

.dark-mode .user-search-item.highlighted {
  background: #1a3a52;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #007AFF, #00D4FF);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin-bottom: 2px;
}

.dark-mode .user-name {
  color: #e0e0e0;
}

.user-email {
  font-size: 12px;
  color: #999;
}

.dark-mode .user-email {
  color: #888;
}

.btn-user-select {
  background: #007AFF;
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 122, 255, 0.3);
}

.btn-user-select:hover {
  background: #0051d5;
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 122, 255, 0.4);
}

.btn-user-select:active {
  transform: scale(0.95);
}

.selected-user,
.selected-members {
  padding: 10px 0;
}

.selected-members-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.member-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 8px;
  background: linear-gradient(135deg, #007AFF, #00D4FF);
  color: white;
  border-radius: 20px;
  font-size: 13px;
  animation: memberBadgeIn 0.3s ease;
}

@keyframes memberBadgeIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.member-badge i {
  font-size: 16px;
}

.btn-remove-member {
  background: rgba(255, 255, 255, 0.3);
  border: none;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  margin-left: 4px;
}

.btn-remove-member:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(1.15);
}

.dark-mode .member-badge {
  background: linear-gradient(135deg, #0066cc, #0099ff);
}

@media (max-width: 768px) {
  .navbar {
    margin-top: 0;
    border-radius: 0;
  }

  .navbar .navbar-brand-wrapper {
    width: auto;
    padding: 0 10px;
  }

  .navbar .navbar-brand img,
  .navbar .navbar-brand.brand-logo-mini img {
    max-height: 36px;
  }

  .navbar .navbar-menu-wrapper {
    padding: 0 8px;
  }

  .navbar .navbar-nav-right {
    gap: 4px;
  }

  .navbar .nav-profile-text {
    display: none;
  }

  .navbar .nav-profile-img img {
    width: 32px;
    height: 32px;
  }

  .navbar .nav-link {
    padding: 6px 8px !important;
  }

  .messages-container {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }

  .chat-sidebar {
    display: flex;
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .chat-main {
    display: none;
    border-radius: 0;
    height: 100%;
  }

  .messages-container.show-chat .chat-sidebar {
    display: none;
  }

  .messages-container.show-chat .chat-main {
    display: flex;
  }

  .mobile-only {
    display: inline-flex;
  }

  .chat-header {
    padding: 12px 14px;
  }

  .chat-header-actions {
    gap: 6px;
  }

  .messages-area {
    padding: 12px;
  }

  .chat-input-area {
    padding: 10px 12px;
  }

  .sidebar-header {
    padding: 12px;
  }

  .search-box {
    padding: 10px 12px;
  }

  .conversations-list {
    padding: 8px;
  }

  .message-content {
    max-width: 85%;
  }
}

@media (max-width: 480px) {
  .navbar .nav-link {
    padding: 4px 6px !important;
  }

  .messages-container .btn-icon {
    width: 30px;
    height: 30px;
  }

  .messages-container .chat-header-info h3 {
    font-size: 15px;
  }

  .messages-container .chat-subtitle {
    display: none;
  }
}

body.rtl .back-to-chats i {
  transform: scaleX(-1);
}

.sender-name {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
  display: block;
}

.whatsapp-message.received .sender-name {
  color: #333;
}

.whatsapp-message.sent .sender-name {
  display: none;
}

.btn-emoji {
  background: none;
  border: none;
  color: #007AFF;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 8px;
  transition: all 0.2s;
}

.btn-emoji:hover {
  opacity: 0.7;
  transform: scale(1.1);
}

.emoji-picker {
  position: absolute;
  bottom: 60px;
  left: 0;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-width: 350px;
  animation: slideInUp 0.2s ease-out;
}

.dark-mode .emoji-picker {
  background: #1e1e1e;
  border-color: #333;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.emoji-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.1s;
}

.emoji-btn:hover {
  background: #f0f0f0;
  transform: scale(1.2);
}

.dark-mode .emoji-btn:hover {
  background: #2a2a2a;
}

.empty-messages-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  text-align: center;
}

.empty-messages-state i {
  font-size: 64px;
  margin-bottom: 15px;
  opacity: 0.3;
}

.profile-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

.profile-modal-content {
  background: white;
  border-radius: 12px;
  max-width: 450px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  position: relative;
  animation: slideUp 0.3s ease-out;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}

.profile-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.06);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.profile-close-btn:hover {
  background: rgba(0, 0, 0, 0.12);
}

body.rtl .profile-close-btn {
  right: auto;
  left: 12px;
}

.profile-avatar-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
}

.profile-avatar-placeholder {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #e6e9ef;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  border: 3px solid #007AFF;
}

.dark-mode .profile-modal-content {
  background: #1e1e1e;
  color: #e0e0e0;
}

.dark-mode .profile-close-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
}

.dark-mode .profile-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.dark-mode .profile-avatar-placeholder {
  background: #2b2f36;
  color: #a0aec0;
  border-color: #66b3ff;
}

.profile-header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #007AFF;
  display: block;
  margin: 0 auto;
}

.profile-status-badge {
  position: absolute;
  bottom: 10px;
  right: 50%;
  transform: translateX(35px);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #31a24c;
  border: 3px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dark-mode .profile-status-badge {
  border-color: #1e1e1e;
}

.profile-info {
  text-align: center;
  margin-bottom: 20px;
}

.profile-info h2 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
}

.profile-email {
  margin: 0;
  font-size: 13px;
  color: #999;
}

.dark-mode .profile-email {
  color: #aaa;
}

.profile-status {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: #999;
}

.dark-mode .profile-status {
  color: #888;
}

.profile-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #f0f2f5;
}

.profile-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #666;
}

.dark-mode .profile-section-title {
  color: #cbd5e1;
}

.profile-modal-content {
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
  padding: 24px;
  max-width: 520px;
}

.profile-header {
  margin-bottom: 8px;
}

.profile-info h2 {
  font-size: 18px;
  font-weight: 700;
}

.profile-email {
  color: #8b96a4;
  font-size: 13px;
}

.profile-status {
  font-size: 12px;
  color: #9aa4b5;
}

.profile-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}

.profile-media-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #f5f6f7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.profile-media-item img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}

.profile-file-list,
.profile-link-list,
.profile-search-results {
  max-height: 180px;
  overflow-y: auto;
}

.profile-file-item,
.profile-link-item,
.search-hit {
  padding: 8px 0;
  border-bottom: 1px solid #f0f2f5;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-file-item:last-child,
.profile-link-item:last-child,
.search-hit:last-child {
  border-bottom: none;
}

.profile-file-item a,
.profile-link-item a {
  color: #0b5ed7;
  text-decoration: none;
  word-break: break-all;
}

.profile-file-item a:hover,
.profile-link-item a:hover {
  text-decoration: underline;
}

.profile-search-results .search-hit .text-muted {
  color: #8c959f !important;
}

.profile-search-results .search-hit div:last-child {
  color: #111;
}

.profile-tabs {
  display: flex;
  justify-content: space-evenly;
  border-bottom: 1px solid #f0f2f5;
  margin: 10px 0 6px 0;
}

.profile-tab {
  padding: 8px 12px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.profile-tab.active {
  color: #0b5ed7;
}

.profile-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 3px;
  background: #0b5ed7;
  border-radius: 999px;
}

.dark-mode .profile-modal-content {
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.dark-mode .profile-section {
  border-top-color: #2c3138;
}

.dark-mode .profile-file-item,
.dark-mode .profile-link-item,
.dark-mode .search-hit {
  border-bottom-color: #2c3138;
}

.dark-mode .profile-media-item {
  background: #2c3138;
}

.dark-mode .profile-search-results .search-hit div:last-child {
  color: #e0e0e0;
}

.profile-member-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: #f7f7f7;
}

.profile-member-info {
  display: flex;
  flex-direction: column;
}

.dark-mode .profile-member {
  background: #262d35;
}

.profile-member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.profile-member-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #dfe4ec;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.dark-mode .profile-member-placeholder {
  background: #2b2f36;
  color: #a0aec0;
}

.profile-member-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.dark-mode .profile-member-name {
  color: #e0e0e0;
}

.profile-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.btn-action {
  flex: 1;
  padding: 10px 16px;
  background: #007AFF;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-action:hover {
  background: #0051d5;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 122, 255, 0.3);
}

.media-gallery {
  border-top: 1px solid #e0e0e0;
  padding-top: 20px;
}

.dark-mode .media-gallery {
  border-top-color: #333;
}

.gallery-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 8px;
}

.dark-mode .gallery-tabs {
  border-bottom-color: #333;
}

.gallery-tab {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -8px;
}

.gallery-tab:hover {
  color: #007AFF;
}

.gallery-tab.active {
  color: #007AFF;
  border-bottom-color: #007AFF;
}

.dark-mode .gallery-tab.active {
  color: #66b3ff;
  border-bottom-color: #66b3ff;
}

.gallery-content {
  min-height: 100px;
}

.gallery-pane {
  display: none;
}

.gallery-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

.gallery-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #999;
  padding: 20px;
  font-size: 13px;
}

.dark-mode .gallery-empty {
  color: #888;
}

.gallery-thumb {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.gallery-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gallery-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #f5f5f5;
  border-radius: 6px;
  font-size: 12px;
}

.dark-mode .gallery-file {
  background: #2a2a2a;
}

.gallery-file i {
  font-size: 18px;
  color: #007AFF;
}

.gallery-file a {
  color: #007AFF;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.gallery-file a:hover {
  text-decoration: underline;
}

.gallery-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #f5f5f5;
  border-radius: 6px;
  font-size: 12px;
}

.dark-mode .gallery-link {
  background: #2a2a2a;
}

.gallery-link i {
  font-size: 16px;
  color: #007AFF;
}

.gallery-link a {
  color: #007AFF;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.gallery-link a:hover {
  text-decoration: underline;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.typing-indicator {
  display: flex;
  align-items: center;
  padding: 12px 8px;
  margin: 8px 0;
  color: #999;
  font-size: 13px;
  font-style: italic;
}

.typing-indicator span::after {
  content: '';
  animation: typingBlink 0.6s infinite;
}

@keyframes typingBlink {

  0%,
  60%,
  100% {
    opacity: 0;
  }

  30% {
    opacity: 1;
  }
}

.message-status {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  font-size: 12px;
}

.message-status.sending {
  color: #999;
}

.message-status.sent {
  color: #999;
}

.message-status.delivered {
  color: #34b7f1;
}

.message-status.read {
  color: #34b7f1;
  font-weight: bold;
}

.notification-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #25d366;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  animation: slideInRight 0.3s ease-out;
  z-index: 9999;
  max-width: 300px;
}

.dark-mode .notification-toast {
  background: #1f8346;
}

.notification-toast.error {
  background: #f14242;
}

.dark-mode .notification-toast.error {
  background: #c42828;
}

.unread-badge {
  position: absolute;
  top: -5px;
  right: -10px;
  background: #f14242;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.message-bubble .message-content {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* Calendar */
.full-calendar {
  min-height: 650px;
}

.fc button .fc-icon-right-single-arrow:after,
.fc button .fc-icon-left-single-arrow:after {
  color: #a8b2b9;
  font: normal normal normal 20px/1 "Material Design Icons";
}

.fc button .fc-icon-right-single-arrow:after {
  content: "\f0142";
}

.fc button .fc-icon-left-single-arrow:after {
  content: "\f0141";
}

.fc .fc-button-group .fc-button {
  background-color: #ffffff;
  margin: 0;
}

.fc .fc-button-group .fc-button.fc-state-active {
  color: #fe7c96;
}

.fc .fc-header-toolbar {
  margin-top: 1.5rem;
}

.fc .fc-header-toolbar .fc-center h2,
.fc .fc-header-toolbar .fc-center .h2 {
  font-size: 1rem;
}

.fc .fc-widget-header {
  border: 0;
}

.fc .fc-widget-header table tr th {
  border-width: 0 0 1px 0;
  text-align: left;
  padding: 1rem;
}

body.rtl .fc .fc-widget-header table tr th {
  text-align: right;
}

.fc .fc-widget-header table tr th span {
  font-size: 10px;
  text-transform: uppercase;
  color: #a8b2b9;
  letter-spacing: 1px;
}

.fc .fc-content-skeleton table tr td {
  padding: 0.5rem;
  font-size: 0.875rem;
}

.fc .fc-event {
  border: 0;
  color: #ffffff;
  padding: 0.5rem;
  border-radius: 4px;
}

.fc-external-events .fc-event {
  background: #ffffff;
  color: #000000;
  border-width: 0 0 0 4px;
  padding: 16px;
  border-radius: 0;
  margin-bottom: 10px;
}

.fc-external-events .fc-event:nth-child(1) {
  border-color: #b66dff;
}

.fc-external-events .fc-event:nth-child(2) {
  border-color: #fe7c96;
}

.fc-external-events .fc-event:nth-child(3) {
  border-color: #1bcfb4;
}

.fc-external-events .fc-event:nth-child(4) {
  border-color: #198ae3;
}

.fc-external-events .fc-event:nth-child(5) {
  border-color: #fed713;
}

/* Meeting minutes editor */
.minutes-editor {
  background: #f9faff;
  border: 1px solid #e6eaf2;
  border-radius: 12px;
  padding: 12px;
}

.minutes-quill .ql-toolbar.ql-snow {
  border-radius: 10px 10px 0 0;
  border-color: #e6eaf2;
  background: #ffffff;
}

.minutes-quill .ql-container.ql-snow {
  border-radius: 0 0 10px 10px;
  border-color: #e6eaf2;
  background: #ffffff;
}

.minutes-quill .ql-editor {
  min-height: 220px;
  font-family: inherit;
}

.minutes-quill .ql-toolbar .ql-formats {
  margin-right: 8px;
}

.minutes-quill .ql-toolbar button {
  transition: color 0.2s ease, background-color 0.2s ease;
}

.minutes-quill .ql-toolbar button:hover {
  color: #000;
}

.minutes-quill .ql-editor.ql-blank::before {
  color: #9aa3b2;
  font-style: normal;
}

body.rtl .minutes-quill .ql-editor {
  direction: rtl;
  text-align: right;
}

.meeting-minutes img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 6px 0;
  border-radius: 8px;
}

.meeting-minutes .ql-align-center {
  text-align: center;
}

.meeting-minutes .ql-align-right {
  text-align: right;
}

.meeting-minutes .ql-align-left {
  text-align: left;
}

.meeting-minutes .ql-align-justify {
  text-align: justify;
}

.meeting-minutes p {
  margin-bottom: 0.5rem;
}

.meeting-minutes p:last-child {
  margin-bottom: 0;
}

.minutes-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.minutes-editor-meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.minutes-count {
  background: #ffffff;
  border: 1px solid #e6eaf2;
  border-radius: 999px;
  padding: 2px 8px;
}

.minutes-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.minutes-toolbar .btn {
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 4px 10px;
}

.minutes-textarea {
  background: #ffffff;
  border-radius: 10px;
}

.minutes-hint {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.minutes-attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.minutes-dropzone {
  border: 2px dashed #dfe4ec;
  border-radius: 12px;
  background: #ffffff;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.minutes-dropzone.is-dragover {
  border-color: #000000;
  background: #f1f3ff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.minutes-dropzone-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  color: #68708a;
}

.minutes-dropzone-icon {
  font-size: 26px;
  color: #000000;
}

.minutes-dropzone-title {
  font-weight: 600;
  color: #1d1f2c;
}

.minutes-dropzone-hint {
  font-size: 0.75rem;
}

.minutes-attachments-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.minutes-attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e6eaf2;
  border-radius: 10px;
  background: #ffffff;
}

.minutes-attachment-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #f2f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #57606a;
  flex-shrink: 0;
}

.minutes-attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.minutes-attachment-meta {
  flex: 1;
  min-width: 0;
}

.minutes-attachment-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.minutes-attachment-size {
  font-size: 0.75rem;
  color: var(--muted);
}

.minutes-attachment-remove {
  border-radius: 8px;
}

.minutes-existing {
  margin-top: 8px;
}

.minutes-existing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.minutes-existing-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid #e6eaf2;
  border-radius: 10px;
  background: #ffffff;
  transition: all 0.2s ease;
}

.minutes-existing-item.is-removed {
  opacity: 0.6;
  border-style: dashed;
  background: #f7f8fb;
}

.minutes-existing-thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #f2f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #57606a;
}

.minutes-existing-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.minutes-existing-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.minutes-existing-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.meeting-attachments {
  margin-top: 8px;
}

.meeting-attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.meeting-attachment {
  border: 1px solid #e6eaf2;
  border-radius: 10px;
  background: #ffffff;
  padding: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.meeting-attachment:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.meeting-attachment img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
}

.meeting-attachment-icon {
  height: 110px;
  border-radius: 8px;
  background: #f2f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #57606a;
}

.meeting-attachment-name {
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1d1f2c;
  word-break: break-word;
}

/* SweetAlert popups */
.swal2-container {
  z-index: 20000;
}

.swal2-popup {
  font-family: inherit;
}

.swal2-toast {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* KPI colors aligned with charts (Chart.js) */
:root {
  --kpi-completed: #1bcfb4;
  --kpi-in-progress: #198ae3;
  --kpi-not-done: #fe7c96;
  --kpi-late: #ffab2d;

  --kpi-productivity: #b66dff;
  --kpi-quality: #ffab2d;
  --kpi-attendance: #1bcfb4;
  --kpi-completion: #fe7c96;
  --kpi-organization: #198ae3;
  --kpi-followup: #047edf;
}

.badge.kpi-badge {
  border-radius: 999px;
  font-weight: 700;
  padding: 0.35rem 0.6rem;
  color: #fff;
}

.kpi-text-dark {
  color: #111 !important;
}

.kpi-bg-completed {
  background-color: var(--kpi-completed) !important;
}

.kpi-bg-in-progress {
  background-color: var(--kpi-in-progress) !important;
}

.kpi-bg-not-done {
  background-color: var(--kpi-not-done) !important;
}

.kpi-bg-late {
  background-color: var(--kpi-late) !important;
}

.kpi-bg-attendance {
  background-color: var(--kpi-attendance) !important;
}

.kpi-bg-quality {
  background-color: var(--kpi-quality) !important;
}

.kpi-bg-completion {
  background-color: var(--kpi-completion) !important;
}

.badge.kpi-point-badge {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  font-weight: 700;
  padding-inline-start: 1.5rem;
  position: relative;
}

.badge.kpi-point-badge::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--kpi-point-color, var(--muted));
  position: absolute;
  inset-inline-start: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
}
