/**
 * Custom Styles for Help Desk System
 * 
 * This file contains custom styles that extend or override Bootstrap.
 * Keep this file minimal - use Bootstrap classes whenever possible.
 */


/* ============================================
   CSS VARIABLES (Theme)
   ============================================ */

:root {
  /* Brand Colors */
  --hd-primary: #0d6efd;
  --hd-primary-dark: #0b5ed7;
  
  /* Status Colors */
  --hd-status-open: #0d6efd;
  --hd-status-in-progress: #fd7e14;
  --hd-status-waiting: #6f42c1;
  --hd-status-resolved: #198754;
  --hd-status-closed: #6c757d;
  
  /* Priority Colors */
  --hd-priority-low: #6c757d;
  --hd-priority-normal: #0d6efd;
  --hd-priority-high: #fd7e14;
  --hd-priority-urgent: #dc3545;
  
  /* Layout */
  --hd-sidebar-width: 250px;
  --hd-navbar-height: 56px;
}


/* ============================================
   GLOBAL STYLES
   ============================================ */

body {
  min-height: 100vh;
  background-color: #f8f9fa;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Better focus outlines for accessibility */
:focus-visible {
  outline: 2px solid var(--hd-primary);
  outline-offset: 2px;
}


/* ============================================
   APP LOADER
   ============================================ */

.app-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  z-index: 9999;
}


/* ============================================
   LAYOUT: SIDEBAR
   ============================================ */

.layout-with-sidebar {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--hd-sidebar-width);
  height: 100vh;
  background-color: #212529;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  padding-top: var(--hd-navbar-height);
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav {
  padding: 1rem 0;
  padding-bottom: 2rem;
}

/* Sidebar scrollbar styling */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.sidebar-nav .nav-link {
  color: rgba(255, 255, 255, 0.8);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background-color 0.15s ease;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background-color: var(--hd-primary);
}

.sidebar-nav .nav-link i {
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
}

.sidebar-heading {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1rem 1.25rem 0.5rem;
  margin-top: 0.5rem;
}

.main-content-with-sidebar {
  margin-left: var(--hd-sidebar-width);
  padding: 1.5rem;
  padding-top: calc(var(--hd-navbar-height) + 1.5rem);
  width: calc(100% - var(--hd-sidebar-width));
}

/* Mobile sidebar */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .main-content-with-sidebar {
    margin-left: 0;
    width: 100%;
  }
}


/* ============================================
   LAYOUT: MAIN CONTENT (no sidebar)
   ============================================ */

.main-content {
  padding: 1.5rem;
  padding-top: calc(var(--hd-navbar-height) + 1.5rem);
  max-width: 1200px;
  margin: 0 auto;
}


/* ============================================
   NAVBAR
   ============================================ */

.navbar-brand img {
  height: 32px;
  width: auto;
}

.navbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}


/* ============================================
   TICKET CARDS
   ============================================ */

.ticket-card {
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  border: 1px solid rgba(0, 0, 0, 0.125);
}

.ticket-card:hover {
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.ticket-number {
  font-family: monospace;
  font-size: 0.9em;
}


/* ============================================
   STATUS BADGES
   ============================================ */

.badge-status-open {
  background-color: var(--hd-status-open);
}

.badge-status-in_progress {
  background-color: var(--hd-status-in-progress);
}

.badge-status-waiting {
  background-color: var(--hd-status-waiting);
}

.badge-status-resolved {
  background-color: var(--hd-status-resolved);
}

.badge-status-closed {
  background-color: var(--hd-status-closed);
}


/* ============================================
   PRIORITY INDICATORS
   ============================================ */

.priority-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.priority-urgent {
  color: var(--hd-priority-urgent);
  font-weight: 600;
}

.priority-high {
  color: var(--hd-priority-high);
  font-weight: 500;
}


/* ============================================
   CHAT / MESSAGES
   ============================================ */

.chat-container {
  display: flex;
  flex-direction: column;
  height: 400px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 0.375rem;
}

.chat-message {
  margin-bottom: 1rem;
  max-width: 80%;
}

.chat-message.sent {
  margin-left: auto;
}

.chat-message.received {
  margin-right: auto;
}

.chat-message .message-bubble {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  background-color: #e9ecef;
}

.chat-message.sent .message-bubble {
  background-color: var(--hd-primary);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.chat-message.received .message-bubble {
  border-bottom-left-radius: 0.25rem;
}

.chat-message .message-meta {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

.chat-message.sent .message-meta {
  text-align: right;
}

/* Internal Notes (Tech-only messages) */
.chat-message.internal .internal-badge {
  font-size: 0.7rem;
  color: #856404;
  margin-bottom: 0.25rem;
}

.chat-message.internal .message-bubble {
  background-color: #fff3cd !important;
  color: #856404 !important;
  border: 1px dashed #ffc107 !important;
}

.chat-message.sent.internal .message-bubble {
  background-color: #fff3cd !important;
  color: #856404 !important;
}

/* KB Links in messages */
.message-bubble .kb-link {
  color: inherit;
  text-decoration: underline;
  font-weight: 500;
}

.message-bubble .kb-link:hover {
  text-decoration: none;
  opacity: 0.8;
}

.chat-message.sent .message-bubble .kb-link {
  color: #fff;
}

.chat-message.received .message-bubble .kb-link {
  color: #0d6efd;
}

.chat-message.internal .message-bubble .kb-link {
  color: #856404;
}

/* Message actions */
.message-actions {
  opacity: 0;
  transition: opacity 0.2s;
}

.chat-message:hover .message-actions {
  opacity: 1;
}

.message-actions .btn-link {
  font-size: 0.75rem;
}

.message-actions .btn-link:hover {
  color: var(--bs-primary) !important;
}

.message-actions .btn-link:hover .bi-trash {
  color: var(--bs-danger) !important;
}

/* Edited indicator */
.edited-indicator {
  font-size: 0.7rem;
  opacity: 0.7;
  font-style: italic;
  margin-left: 0.5rem;
}

.chat-input-container {
  padding: 1rem;
  border-top: 1px solid #dee2e6;
  background-color: #fff;
}


/* ============================================
   FORMS
   ============================================ */

.form-label-required::after {
  content: ' *';
  color: var(--hd-priority-urgent);
}

/* File drop zone */
.file-drop-zone {
  border: 2px dashed #dee2e6;
  border-radius: 0.375rem;
  padding: 2rem;
  text-align: center;
  background-color: #f8f9fa;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  cursor: pointer;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
  border-color: var(--hd-primary);
  background-color: rgba(13, 110, 253, 0.05);
}

.file-drop-zone i {
  font-size: 2rem;
  color: #6c757d;
}


/* ============================================
   TABLES
   ============================================ */

.table-hover tbody tr {
  cursor: pointer;
}

/* Override for non-clickable tables */
.table-hover.table-static tbody tr {
  cursor: default;
}

/* Truncate long text in tables */
.table td {
  max-width: 300px;
}

.table td .fw-medium,
.table td h6 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: block;
}

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

/* Ticket subject truncation */
.text-truncate-subject {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: block;
}

/* Subject cell in tables - limit width */
.subject-cell {
  max-width: 300px;
}

/* Fix for flex containers - needed for truncation to work */
.min-width-0 {
  min-width: 0;
}

/* Ticket subject in list items */
.list-group-item h6,
.list-group-item .fw-medium {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}


/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #6c757d;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}


/* ============================================
   LOADING STATES
   ============================================ */

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 0.25rem;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}


/* ============================================
   LOGIN PAGE
   ============================================ */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
  background: #fff;
  border-radius: 1rem;
  padding: 3rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.login-logo {
  max-width: 250px;
  margin-bottom: 1.5rem;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: #6c757d;
  margin-bottom: 2rem;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: 1px solid #dadce0;
  border-radius: 0.375rem;
  background-color: #fff;
  color: #3c4043;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-google:hover {
  background-color: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-google img {
  width: 20px;
  height: 20px;
}


/* ============================================
   DASHBOARD STATS
   ============================================ */

.stat-card {
  text-align: center;
  padding: 1.5rem;
}

.stat-card .stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 0.5rem;
}


/* ============================================
   UTILITY CLASSES
   ============================================ */

.cursor-pointer {
  cursor: pointer;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hover-lift {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}


/* ============================================
   MOBILE RESPONSIVE IMPROVEMENTS
   ============================================ */

/* Mobile sidebar toggle button */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1050;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@media (max-width: 991.98px) {
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Sidebar overlay when open */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  
  .sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
  }
  
  /* Mobile table scrolling */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Stack ticket detail cards on mobile */
  .ticket-detail-layout {
    flex-direction: column;
  }
  
  .ticket-detail-sidebar {
    width: 100% !important;
    margin-top: 1rem;
  }
  
  /* Smaller padding on mobile */
  .main-content-with-sidebar,
  .main-content {
    padding: 1rem;
    padding-top: calc(var(--hd-navbar-height) + 1rem);
  }
  
  /* Full-width buttons on mobile */
  .btn-mobile-full {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  /* Reduce chat message width on mobile */
  .chat-message {
    max-width: 90%;
  }
  
  /* Stack form columns on mobile */
  .form-row-mobile .col-md-6,
  .form-row-mobile .col-md-4 {
    margin-bottom: 1rem;
  }
  
  /* Smaller headings on mobile */
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  /* Modal improvements for mobile */
  .modal-dialog {
    margin: 0.5rem;
  }
  
  .modal-body {
    max-height: 70vh;
    overflow-y: auto;
  }
}

/* Very small screens */
@media (max-width: 575.98px) {
  .main-content-with-sidebar,
  .main-content {
    padding: 0.75rem;
    padding-top: calc(var(--hd-navbar-height) + 0.75rem);
  }
  
  .card-body {
    padding: 1rem;
  }
  
  /* Hide less important columns on small screens */
  .table .d-none-xs {
    display: none !important;
  }
  
  /* Stack action buttons */
  .btn-group-mobile {
    flex-direction: column;
    width: 100%;
  }
  
  .btn-group-mobile .btn {
    width: 100%;
    margin-bottom: 0.25rem;
  }
  
  /* Smaller stat cards */
  .stat-card .stat-value {
    font-size: 2rem;
  }
  
  /* Login card mobile */
  .login-card {
    padding: 2rem 1.5rem;
    margin: 1rem;
    border-radius: 0.5rem;
  }
}


/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--hd-primary);
  color: white;
  padding: 8px 16px;
  z-index: 10000;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 0;
}

/* Better focus states */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--hd-primary);
  outline-offset: 2px;
}

/* Remove default outline for mouse users */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .badge {
    border: 1px solid currentColor;
  }
  
  .btn-outline-primary,
  .btn-outline-secondary,
  .btn-outline-danger {
    border-width: 2px;
  }
  
  .card {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .skeleton {
    animation: none;
    background: #e0e0e0;
  }
}

/* Screen reader only class */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Visible focus for dropdown items */
.dropdown-item:focus {
  background-color: var(--hd-primary);
  color: white;
}

/* Better visibility for form validation */
.is-invalid {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.invalid-feedback {
  font-size: 0.875rem;
}

/* Toast accessibility - ensure enough contrast */
.toast {
  min-width: 300px;
}

.toast-success {
  background-color: #198754;
  color: white;
}

.toast-error {
  background-color: #dc3545;
  color: white;
}


/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .sidebar,
  .navbar,
  .sidebar-toggle,
  .btn,
  .toast-container {
    display: none !important;
  }
  
  .main-content-with-sidebar {
    margin-left: 0;
    width: 100%;
    padding: 0;
  }
  
  .card {
    border: 1px solid #ddd;
    box-shadow: none;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

/* Stat card hover and selection styles */
.stat-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.stat-card.border-primary,
.stat-card.border-warning,
.stat-card.border-info,
.stat-card.border-success {
  border-width: 2px !important;
}


/* ============================================
   KNOWLEDGE BASE STYLES
   ============================================ */

/* Category cards on browse page */
.kb-category-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid rgba(0, 0, 0, 0.125);
}

.kb-category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  text-decoration: none;
}

.kb-category-card .card-title {
  color: #212529;
}

.kb-category-card .card-text {
  color: #6c757d;
}

/* Article content styling */
.kb-article-content {
  line-height: 1.8;
  font-size: 1.05rem;
}

.kb-article-content h1,
.kb-article-content h2,
.kb-article-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.75em;
  font-weight: 600;
}

.kb-article-content h1 {
  font-size: 1.75rem;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 0.5rem;
}

.kb-article-content h2 {
  font-size: 1.5rem;
}

.kb-article-content h3 {
  font-size: 1.25rem;
}

.kb-article-content p {
  margin-bottom: 1.25em;
}

.kb-article-content ul,
.kb-article-content ol {
  margin-bottom: 1.25em;
  padding-left: 2em;
}

.kb-article-content li {
  margin-bottom: 0.5em;
}

.kb-article-content code {
  background-color: #f8f9fa;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  color: #d63384;
}

.kb-article-content pre {
  background-color: #2d3748;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1.25em;
}

.kb-article-content pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
}

.kb-article-content a {
  color: var(--hd-primary);
  text-decoration: underline;
}

.kb-article-content a:hover {
  color: var(--hd-primary-dark);
}

.kb-article-content blockquote {
  border-left: 4px solid var(--hd-primary);
  padding-left: 1rem;
  margin-left: 0;
  color: #6c757d;
  font-style: italic;
}

.kb-article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1rem 0;
}

.kb-article-content table {
  width: 100%;
  margin-bottom: 1.25em;
  border-collapse: collapse;
}

.kb-article-content th,
.kb-article-content td {
  border: 1px solid #dee2e6;
  padding: 0.75rem;
  text-align: left;
}

.kb-article-content th {
  background-color: #f8f9fa;
  font-weight: 600;
}

/* KB Search input */
.kb-search-input {
  border-radius: 50px;
}

/* Article editor */
#article-content {
  min-height: 400px;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Definition list styling for article info */
.kb-article-content dl dt,
.card-body dl dt {
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.25rem;
}

.kb-article-content dl dd,
.card-body dl dd {
  margin-bottom: 1rem;
  margin-left: 0;
}

/* Feedback buttons */
.btn-group .btn-outline-success:hover,
.btn-group .btn-success {
  background-color: #198754;
  border-color: #198754;
  color: white;
}

.btn-group .btn-outline-danger:hover,
.btn-group .btn-danger {
  background-color: #dc3545;
  border-color: #dc3545;
  color: white;
}

/* ============================================
   FOOTER STYLES
   ============================================ */

.app-footer {
  background-color: #343a40;
  color: #adb5bd;
  padding: 1rem 0;
  margin-top: auto;
  font-size: 0.875rem;
}

.app-footer a {
  color: #adb5bd;
  text-decoration: none;
}

.app-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.app-footer .footer-brand {
  font-weight: 500;
  color: #fff;
}

/* Ensure footer stays at bottom */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--hd-navbar-height));
}

.page-wrapper .main-content,
.page-wrapper .main-content-with-sidebar {
  flex: 1;
}

/* Login page welcome text */
.login-welcome {
  color: #6c757d;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}


/* ============================================
   QUILL EDITOR STYLES
   ============================================ */

/* Editor container */
#quill-editor {
  background: #fff;
  border-radius: 0 0 0.375rem 0.375rem;
}

#quill-editor .ql-editor {
  min-height: 350px;
  font-size: 1rem;
  line-height: 1.6;
}

/* Toolbar styling - sticky on scroll */
.ql-toolbar.ql-snow {
  position: sticky;
  top: 56px; /* Below navbar */
  z-index: 100;
  border-radius: 0.375rem 0.375rem 0 0;
  background: #f8f9fa;
}

.ql-container.ql-snow {
  border-radius: 0 0 0.375rem 0.375rem;
}

/* Make color pickers more visible */
.ql-snow .ql-color-picker .ql-picker-label,
.ql-snow .ql-icon-picker .ql-picker-label {
  padding: 2px 4px;
}

/* Blot Formatter (image resize/align) */
.blot-formatter__overlay {
  border: 2px dashed #0d6efd;
  background: rgba(13, 110, 253, 0.05);
}

.blot-formatter__resize-handle {
  width: 12px;
  height: 12px;
  background: #0d6efd;
  border: 2px solid #fff;
  border-radius: 50%;
}

.blot-formatter__toolbar {
  background: #212529;
  border-radius: 4px;
  padding: 4px;
}

.blot-formatter__toolbar button {
  color: #fff;
  background: transparent;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
}

.blot-formatter__toolbar button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}


/* ============================================
   KB ARTICLE CONTENT STYLES
   ============================================ */

.kb-article-content {
  line-height: 1.8;
  font-size: 1rem;
}

.kb-article-content h1 {
  font-size: 1.75rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.kb-article-content h2 {
  font-size: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.kb-article-content h3 {
  font-size: 1.25rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.kb-article-content p {
  margin-bottom: 1rem;
}

.kb-article-content ul,
.kb-article-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.kb-article-content li {
  margin-bottom: 0.5rem;
}

.kb-article-content blockquote {
  border-left: 4px solid #0d6efd;
  padding-left: 1rem;
  margin: 1rem 0;
  color: #6c757d;
  font-style: italic;
}

.kb-article-content pre {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 1rem;
  overflow-x: auto;
}

.kb-article-content code {
  background: #f8f9fa;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.kb-article-content pre code {
  background: none;
  padding: 0;
}

.kb-article-content a {
  color: #0d6efd;
  text-decoration: none;
}

.kb-article-content a:hover {
  text-decoration: underline;
}

/* Embedded images */
.kb-article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.375rem;
  margin: 1rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Embedded videos/iframes */
.kb-article-content iframe {
  max-width: 100%;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0.375rem;
  margin: 1rem 0;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Google Docs/Sheets embeds (taller aspect ratio) */
.kb-article-content iframe[src*="docs.google.com"],
.kb-article-content iframe[src*="drive.google.com/file"] {
  aspect-ratio: 4 / 3;
  min-height: 500px;
}

/* Tables in KB articles */
.kb-article-content table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
}

.kb-article-content th,
.kb-article-content td {
  padding: 0.75rem;
  border: 1px solid #dee2e6;
}

.kb-article-content th {
  background: #f8f9fa;
  font-weight: 600;
}

.kb-article-content tr:nth-child(even) td {
  background: #f8f9fa;
}

/* Force consistent table styling in editor and display (override pasted styles) */
.ql-editor table,
.kb-article-content table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 1rem 0;
  background: #fff !important;
  table-layout: auto !important;
}

.ql-editor th,
.ql-editor td,
.kb-article-content th,
.kb-article-content td {
  padding: 0.75rem !important;
  border: 1px solid #dee2e6 !important;
  vertical-align: top;
  background: transparent !important;
  color: #212529 !important;
  font-size: 1rem !important;
}

/* Style first row as header */
.ql-editor tr:first-child td,
.ql-editor th,
.kb-article-content tr:first-child td,
.kb-article-content th {
  background: #e9ecef !important;
  font-weight: 600 !important;
}

/* Zebra striping for readability (skip first row) */
.ql-editor tr:nth-child(even):not(:first-child) td,
.kb-article-content tr:nth-child(even):not(:first-child) td {
  background: #f8f9fa !important;
}

/* Ensure odd rows (except header) are white */
.ql-editor tr:nth-child(odd):not(:first-child) td,
.kb-article-content tr:nth-child(odd):not(:first-child) td {
  background: #fff !important;
}


/* ============================================
   MESSAGE COLOR CODING
   ============================================ */

/* Requester messages - light blue (matches email #e7f3ff) */
.bg-requester {
  background-color: #e7f3ff !important;
}

/* Tech/IT staff messages - light green (matches email #d4edda) */
.bg-tech {
  background-color: #d4edda !important;
}

/* Internal notes - yellow (matches email #fff3cd) */
.bg-internal {
  background-color: #fff3cd !important;
}
