/* Unified HRM Stylesheet - Custom Overrides */
/* Note: Sub-stylesheets are loaded in parallel via <link rel="stylesheet"> in index.html to improve performance. */

[hidden] {
  display: none !important;
}

.dashboard-empty {
  min-height: 320px !important;
  padding: 60px 40px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}

.dashboard-empty strong {
  font-size: 18px !important;
  color: var(--ink) !important;
  margin-bottom: 8px !important;
  display: block;
}

.dashboard-empty p {
  font-size: 14px !important;
  color: var(--muted) !important;
  margin: 0 !important;
}

.topbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: nowrap !important;
  min-height: 72px !important;
  gap: 16px !important;
}

.topbar-global-search:not([hidden]) {
  display: flex !important;
  flex: 0 1 480px !important;
  margin: 0 auto !important;
}

.topbar-filters-wrap {
  margin-left: auto !important;
}

.topbar-account-actions {
  flex-shrink: 0 !important;
}

/* --- CUSTOM CONTEXT MENU & TOASTS --- */
.messenger-context-menu {
  position: fixed;
  background: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  padding: 6px;
  min-width: 180px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: contextMenuFadeIn 0.15s ease-out;
}

@keyframes contextMenuFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

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

.context-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  font-size: 14px;
  color: #334155;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.context-item:hover {
  background: #f1f5f9;
}

.context-item.danger {
  color: #ef4444;
}

.context-item.danger:hover {
  background: #fef2f2;
}

.context-item .context-icon {
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
}

.context-divider {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 4px 0;
}

.messenger-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.messenger-toast {
  background: rgba(15, 23, 42, 0.9);
  color: white;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.messenger-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.message-recalled {
  color: #94a3b8;
  font-style: italic;
}

/* --- UI/UX UPGRADES PHASE 2 --- */
@keyframes highlightFlash {
  0% { background-color: rgba(253, 224, 71, 0.4); }
  100% { background-color: transparent; }
}
.message.highlight-flash,
.internal-chat-message.highlight-flash {
  animation: highlightFlash 2s ease-out;
  border-radius: 8px;
}

/* --- REPLY & QUOTE BAR STYLING --- */
.reply-quote-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border-left: 4px solid #0b75c9;
  padding: 6px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  border-left-width: 4px;
}
.reply-quote-content {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90%;
  text-align: left;
}
.reply-quote-content small {
  color: #64748d;
  font-size: 11px;
  display: block;
  margin-bottom: 2px;
}
.reply-quote-content p {
  margin: 0;
  font-size: 13px;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-quote-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #64748d;
  cursor: pointer;
  padding: 0 4px;
  font-weight: bold;
}
.reply-quote-close:hover {
  color: #ef4444;
}

/* Quoted message box inside message bubble */
.quoted-message-box {
  background: #f1f5f9;
  border-left: 3px solid #64748d;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  text-align: left;
  border: 1px solid #e2e8f0;
  border-left-width: 3px;
}
.internal-chat-message.is-mine .quoted-message-box,
.message.mine .quoted-message-box {
  background: rgba(0, 0, 0, 0.05);
  border-left: 3px solid var(--messenger-primary, #0b75c9);
  border-color: rgba(0, 0, 0, 0.05);
  color: #334155;
}
.quoted-sender {
  font-weight: bold;
  color: #475569;
  display: block;
  margin-bottom: 2px;
}
.internal-chat-message.is-mine .quoted-sender,
.message.mine .quoted-sender {
  color: #1e293b;
}
.quoted-body {
  margin: 0;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.internal-chat-message.is-mine .quoted-body,
.message.mine .quoted-body {
  color: #475569;
}

/* --- PINNED MESSAGE CARD & ACTIONS --- */
.pinned-message-bar {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 14px;
  margin: 10px 18px 2px 18px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  position: relative;
  transition: all 0.2s ease;
}

.pinned-message-bar:hover {
  border-color: #cbd5e1;
}

.pinned-icon-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e0f2fe;
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.pinned-message-content {
  display: grid;
  gap: 2px;
  min-width: 0;
  cursor: pointer;
}

.pinned-message-content small {
  color: #0284c7;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
}

.pinned-text-body {
  color: #334155;
  font-size: 13px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.pinned-more-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s ease, color 0.15s ease;
}

.pinned-more-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

/* Custom Dropdown for Pin Actions */
.pinned-context-menu {
  position: absolute;
  right: 18px;
  top: 48px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 100;
  min-width: 170px;
  padding: 4px 0;
  animation: scaleIn 0.12s ease-out;
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.pinned-context-menu button {
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pinned-context-menu button:hover {
  background: #f8fafc;
  color: #0f172a;
}

.pinned-context-menu button.danger {
  color: #ef4444;
}

.pinned-context-menu button.danger:hover {
  background: #fef2f2;
}

/* Pinned List Modal */
.pinned-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.pinned-modal-card {
  background: #ffffff;
  border-radius: 16px;
  width: 480px;
  max-width: 90%;
  max-height: 80vh;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease-out;
}

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

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

.pinned-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.pinned-modal-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
}

.pinned-modal-close-btn:hover {
  color: #64748b;
}

.pinned-modal-body {
  padding: 10px 20px;
  overflow-y: auto;
  display: grid;
  gap: 12px;
}

.pinned-modal-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  background: #f8fafc;
  transition: border-color 0.15s ease;
}

.pinned-modal-item:hover {
  border-color: #cbd5e1;
}

.pinned-item-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pinned-item-sender {
  font-weight: 700;
  font-size: 13px;
  color: #1e293b;
}

.pinned-item-text {
  font-size: 12.5px;
  color: #475569;
  margin: 2px 0 0 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

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

.pinned-item-actions button {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.pinned-item-actions button:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.pinned-item-actions button.unpin-item-btn {
  border-color: #fca5a5;
  color: #ef4444;
}

.pinned-item-actions button.unpin-item-btn:hover {
  background: #fef2f2;
  border-color: #f87171;
}

.pinned-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  background: #f8fafc;
}

.pinned-modal-footer button {
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pinned-modal-footer button:hover {
  background: #0369a1;
}

.pin-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  font-weight: bold;
  font-size: 10px;
  margin: 0;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1;
}

.pin-nav-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}