:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --surface-strong: #e2e8f0;
  --primary: #1e3a8a;
  --primary-strong: #1d4ed8;
  --secondary: #2563eb;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0891b2;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 4px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 32px 120px rgba(15, 23, 42, 0.12);
  --gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  --gradient-surface: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--gradient-surface);
  color: var(--text);
  font-family:
    "Noto Sans Arabic",
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.6;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body a {
  color: inherit;
  text-decoration: none;
}

main.container-xl {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

/* ===== Enhanced Navigation & Header Design ===== */

/* Improved navbar styling */
.navbar {
  background: var(--gradient-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 30px rgba(15, 23, 42, 0.1);
  padding: 1rem 0;
  transition: var(--transition-base);
}

.navbar.scrolled {
  padding: 0.5rem 0;
  box-shadow: 0 8px 40px rgba(15, 23, 42, 0.15);
}

/* Enhanced brand styling */
.navbar-brand {
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: var(--transition-base);
  position: relative;
}

.navbar-brand:hover {
  transform: scale(1.05);
  color: rgba(255, 255, 255, 0.9) !important;
}

.navbar-brand-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: var(--transition-base);
  font-weight: 700;
  font-size: 1.25rem;
}

.navbar-brand:hover .navbar-brand-icon {
  background-color: rgba(255, 255, 255, 0.25);
  transform: rotate(10deg);
}

/* Enhanced navigation links */
.navbar-nav .nav-link {
  transition: var(--transition-base);
  border-radius: 0.85rem;
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  position: relative;
  overflow: hidden;
  margin: 0 0.25rem;
}

.navbar-nav .nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s;
}

.navbar-nav .nav-link:hover::before {
  left: 100%;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Enhanced language toggle button */
.navbar-nav .lang-toggle {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  color: #ffffff;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  min-width: 100px;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.navbar-nav .lang-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.navbar-nav .lang-toggle:hover::before {
  left: 100%;
}

.navbar-nav .lang-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5) !important;
  transform: translateY(-2px);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Enhanced mobile navigation */
.navbar-toggler {
  border-color: rgba(255, 255, 255, 0.6);
  padding: 0.5rem 0.75rem;
  transition: var(--transition-base);
}

.navbar-toggler:hover {
  border-color: rgba(255, 255, 255, 0.8);
  background-color: rgba(255, 255, 255, 0.1);
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  transition: var(--transition-base);
}

/* Enhanced mobile menu */
.navbar-collapse {
  transition: var(--transition-base);
}

@media (max-width: 991.98px) {
  .navbar-collapse {
    background: rgba(30, 58, 138, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 1rem;
    margin-top: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
  }
  
  .navbar-nav {
    margin: 0 !important;
  }
  
  .navbar-nav .nav-item {
    margin-bottom: 0.5rem;
  }
  
  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
  }
}

/* Enhanced avatar styling */
.avatar-nav,
.avatar-placeholder {
  width: 38px;
  height: 38px;
  transition: var(--transition-base);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.avatar-nav:hover,
.avatar-placeholder:hover {
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.avatar-placeholder {
  background-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Enhanced notification dropdown */
#notificationsDropdownItem .dropdown-menu {
  min-width: 320px;
  max-height: 400px;
  overflow-y: auto;
  border: none;
  box-shadow: var(--shadow-lg);
  border-radius: 1rem;
  margin-top: 0.5rem;
  animation: fadeInDown 0.3s ease-out;
}

#notificationsDropdownItem .dropdown-item {
  padding: 1rem;
  border-radius: 0.75rem;
  margin: 0.25rem;
  transition: var(--transition-base);
  border-left: 3px solid transparent;
}

#notificationsDropdownItem .dropdown-item:hover {
  background: var(--surface-soft);
  transform: translateX(4px);
  border-left-color: var(--primary);
}

#notificationsDropdownItem .badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  animation: pulse 2s infinite;
}

/* Enhanced profile button */
.btn-outline-light {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
  background-color: rgba(255, 255, 255, 0.05);
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn-outline-light::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s;
}

.btn-outline-light:hover::before {
  left: 100%;
}

.btn-outline-light:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.8);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Enhanced search bar in navigation */
.navbar-search {
  position: relative;
  margin: 0 1rem;
}

.navbar-search .form-control {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: 2rem;
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  transition: var(--transition-base);
}

.navbar-search .form-control::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.navbar-search .form-control:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.navbar-search .btn {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  padding: 0.25rem 0.5rem;
  border-radius: 50%;
  transition: var(--transition-base);
}

.navbar-search .btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Enhanced breadcrumb navigation */
.breadcrumb {
  background: var(--surface);
  border-radius: 0.75rem;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.breadcrumb-item {
  font-weight: 500;
  color: var(--muted);
}

.breadcrumb-item.active {
  color: var(--primary);
  font-weight: 600;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: var(--muted);
  font-weight: 600;
}

/* Enhanced pagination */
.pagination {
  margin-bottom: 0;
}

.page-link {
  border: none;
  margin: 0 0.125rem;
  border-radius: 0.5rem;
  color: var(--text);
  background: var(--surface);
  padding: 0.75rem 1rem;
  font-weight: 500;
  transition: var(--transition-base);
  border: 1px solid var(--border);
}

.page-link:hover {
  background: var(--gradient-primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.1);
}

.page-item.active .page-link {
  background: var(--gradient-primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Enhanced tabs */
.nav-tabs {
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
}

.nav-tabs .nav-link {
  border: none;
  color: var(--muted);
  font-weight: 500;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem 0.75rem 0 0;
  transition: var(--transition-base);
  position: relative;
}

.nav-tabs .nav-link:hover {
  color: var(--primary);
  background: var(--surface-soft);
}

.nav-tabs .nav-link.active {
  color: var(--primary);
  background: var(--surface);
  border-bottom: 3px solid var(--primary);
}

.nav-tabs .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 3px;
  background: var(--primary);
  transition: var(--transition-base);
  transform: translateX(-50%);
}

.nav-tabs .nav-link.active::after {
  width: 80%;
}

.btn,
button,
input[type="submit"] {
  transition: var(--transition-base);
  font-weight: 600;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
  border-radius: 0.75rem;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  transition: width 0.6s ease, height 0.6s ease;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 0;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover::after {
  width: 300px;
  height: 300px;
}

.btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 45px rgba(15, 23, 42, 0.2);
}

.btn:active {
  transform: translateY(-1px) scale(0.98);
  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.15);
  transition: all 0.1s ease;
}

.btn span,
.btn i,
.btn svg {
  position: relative;
  z-index: 2;
}

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 12px 25px rgba(30, 58, 138, 0.15);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn-outline-primary {
  color: var(--primary-strong);
  border-color: rgba(37, 99, 235, 0.28);
}

.btn-outline-primary:hover {
  background-color: rgba(37, 99, 235, 0.08);
}

.btn-danger {
  background-color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover,
.btn-danger:focus {
  background-color: #b91c1c;
  border-color: #b91c1c;
}

.btn-outline-light {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.75);
}

.btn-outline-light:hover {
  background-color: rgba(255, 255, 255, 0.16);
}

.card,
.card.shadow-sm {
  border: none;
  border-radius: 1.75rem;
  box-shadow: var(--shadow);
  transition: var(--transition-base);
  overflow: hidden;
  background: var(--surface);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-body {
  padding: 2rem;
}

.card .badge {
  border-radius: 999px;
  padding: 0.7rem 1rem;
  background-color: var(--surface-soft);
  color: var(--primary-strong);
  font-weight: 600;
}

.form-control,
.form-select,
textarea {
  border-radius: 1rem;
  border: 2px solid var(--border);
  background-color: var(--surface);
  padding: 1rem 1.25rem;
  transition: var(--transition-base);
  font-size: 0.95rem;
  position: relative;
  transform-style: preserve-3d;
}

.form-control:hover,
.form-select:hover,
textarea:hover {
  border-color: rgba(37, 99, 235, 0.3);
  background-color: rgba(248, 250, 252, 0.8);
}

.form-control:focus,
.form-select:focus,
textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
  background-color: var(--surface);
  transform: translateY(-2px);
  outline: none;
}

.form-control::placeholder {
  color: #94a3b8;
  transition: opacity 0.3s ease;
}

.form-control:focus::placeholder {
  opacity: 0.5;
}

label,
.form-label {
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.5rem;
  display: block;
  transition: color 0.3s ease;
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
  font-weight: 700;
}

/* Enhanced validation states */
.form-control.is-valid {
  border-color: var(--success);
  background-color: rgba(34, 197, 94, 0.05);
  padding-right: 3rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2322c55e' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
}

.form-control.is-invalid {
  border-color: var(--danger);
  background-color: rgba(220, 38, 38, 0.05);
  padding-right: 3rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc2626'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc2626' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
}

/* Floating label effect */
.form-floating {
  position: relative;
}

.form-floating label {
  position: absolute;
  top: 50%;
  left: 1.25rem;
  transform: translateY(-50%);
  transition: all 0.3s ease;
  color: #94a3b8;
  pointer-events: none;
  background: var(--surface);
  padding: 0 0.5rem;
  margin: 0;
}

.form-floating .form-control:focus ~ label,
.form-floating .form-control:not(:placeholder-shown) ~ label,
.form-floating .form-select ~ label {
  top: 0;
  transform: translateY(-50%) scale(0.85);
  color: var(--secondary);
  font-weight: 600;
}

/* Enhanced textarea styling */
textarea.form-control {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

textarea.form-control:focus {
  min-height: 140px;
}

/* Enhanced select styling */
.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
  padding-right: 3rem;
}

.form-select:focus {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%232563eb' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

/* Input groups */
.input-group {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.input-group .form-control {
  border-radius: 0;
  border-right: none;
}

.input-group .form-control:focus {
  border-color: var(--secondary);
  z-index: 3;
}

.input-group-text {
  background: var(--surface-soft);
  border: 2px solid var(--border);
  border-left: none;
  color: var(--muted);
  font-weight: 500;
}

.table-responsive {
  background: var(--surface);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, 0.95);
}

.table th,
.table td {
  vertical-align: middle;
  border-top: 1px solid rgba(226, 232, 240, 0.95);
}

.table-hover tbody tr:hover {
  background: rgba(37, 99, 235, 0.05);
}

.alert {
  border-radius: 1rem;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
}

.alert-success {
  background-color: #ecfdf5;
  color: #166534;
}

.alert-danger {
  background-color: #fef2f2;
  color: #b91c1c;
}

footer {
  padding: 2rem 0;
  background-color: #eff6ff;
}

footer p,
footer a {
  color: #475569;
}

footer a:hover {
  color: #1d4ed8;
}

.notification-toast-container {
  position: fixed;
  top: 4.75rem;
  inset-inline-end: 1rem;
  z-index: 1080;
  width: min(360px, calc(100vw - 1.5rem));
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.notification-toast-card {
  transform: translateY(-130%);
  opacity: 0;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
  pointer-events: auto;
}

.notification-toast-card.show {
  transform: translateY(0);
  opacity: 1;
}

.notification-toast-card .btn-close {
  filter: invert(1);
}
/* ===== Floating Chat ===== */

/* isolate chat buttons from global button styles */
.chat-fab,
.chat-send-btn,
.chat-panel-close {
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease !important;
}
.chat-fab:hover {
  transform: scale(1.1) translateY(-2px) !important;
}
.chat-send-btn:hover {
  transform: scale(1.08) !important;
}
.chat-panel-close:hover {
  transform: none !important;
}
.chat-sticky-button {
  position: fixed;
  bottom: 28px;
  inset-inline-end: 28px;
  z-index: 1050;
}

/* Tooltip */
.chat-sticky-button::before {
  content: "Chat with us";
  position: absolute;
  inset-inline-end: 68px;
  top: 50%;
  transform: translateY(-50%);
  background: #1e3a8a;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.25);
}
.chat-sticky-button::after {
  content: "";
  position: absolute;
  right: 62px;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: #1e3a8a;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.chat-sticky-button:hover::before,
.chat-sticky-button:hover::after {
  opacity: 1;
}

.chat-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  position: relative;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
  box-shadow:
    0 4px 15px rgba(30, 58, 138, 0.4),
    0 0 0 0 rgba(37, 99, 235, 0.4);
  animation: fab-pulse 3s ease-in-out infinite;
}
.chat-fab:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow:
    0 8px 28px rgba(30, 58, 138, 0.55),
    0 0 0 6px rgba(37, 99, 235, 0.12);
  animation: none;
}
.chat-fab:active {
  transform: scale(0.95);
  box-shadow: 0 2px 10px rgba(30, 58, 138, 0.35);
  animation: none;
}

@keyframes fab-pulse {
  0%,
  100% {
    box-shadow:
      0 4px 15px rgba(30, 58, 138, 0.4),
      0 0 0 0 rgba(37, 99, 235, 0.4);
  }
  50% {
    box-shadow:
      0 4px 15px rgba(30, 58, 138, 0.4),
      0 0 0 10px rgba(37, 99, 235, 0);
  }
}

/* Icon swap on open */
.chat-fab .icon-chat {
  display: flex;
}
.chat-fab .icon-close {
  display: none;
}
.chat-fab.is-open .icon-chat {
  display: none;
}
.chat-fab.is-open .icon-close {
  display: flex;
}

.chat-online-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 13px;
  height: 13px;
  background: #22c55e;
  border-radius: 50%;
  border: 2.5px solid white;
  animation: badge-ping 2.5s ease-in-out infinite;
}

@keyframes badge-ping {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  }
  60% {
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0);
  }
}

/* ── Panel ── */
.chat-panel {
  position: fixed;
  bottom: 100px;
  inset-inline-end: 28px;
  width: 340px;
  z-index: 1049;
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(15, 23, 42, 0.15),
    0 4px 16px rgba(15, 23, 42, 0.08);
}
.chat-panel.open {
  display: flex;
  animation: chatSlideUp 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes chatSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Header ── */
.chat-panel-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: white;
  padding: 16px 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.chat-panel-header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0.08) 100%
  );
}
.chat-panel-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-panel-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.chat-panel-name {
  margin: 0 0 1px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.chat-panel-status {
  font-size: 11px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chat-status-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  animation: badge-ping 2.5s ease-in-out infinite;
}
.chat-panel-close {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s;
}
.chat-panel-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ── Body ── */
.chat-panel-body {
  height: 265px;
  overflow-y: auto;
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  scroll-behavior: smooth;
}
.chat-panel-body::-webkit-scrollbar {
  width: 4px;
}
.chat-panel-body::-webkit-scrollbar-track {
  background: transparent;
}
.chat-panel-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* ── Messages ── */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}
.chat-msg--bot {
  align-self: flex-start;
}
.chat-msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.chat-msg--bot .chat-bubble {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.chat-msg--user .chat-bubble {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25);
}
.chat-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  padding: 0 4px;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.chat-typing span {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing-dot 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.chat-typing span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes typing-dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ── Footer ── */
.chat-panel-footer {
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
.chat-panel-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  padding: 9px 16px;
  font-size: 13px;
  outline: none;
  background: #f8fafc;
  color: #1e293b;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.chat-panel-input:focus {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.chat-panel-input::placeholder {
  color: #94a3b8;
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.3);
}
.chat-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(30, 58, 138, 0.45);
}
.chat-send-btn:active {
  transform: scale(0.94);
}

/* ===== Staff Ticket Cards ===== */
.ticket-card {
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
  border-radius: 1.5rem;
}

.ticket-card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 28px 70px rgba(15, 23, 42, 0.12),
    0 8px 24px rgba(15, 23, 42, 0.08);
}

.ticket-card .card-title {
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.ticket-title-link {
  color: var(--primary);
  transition: color 0.2s ease;
}

.ticket-title-link:hover {
  color: var(--primary-strong);
}

/* Status badges */
.ticket-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
}

.status-open {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
}

.status-received {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  color: #3730a3;
}

.status-in_progress {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
}

.status-transferred {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  color: #0369a1;
}

.status-closed {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #475569;
}

/* Meta info */
.ticket-meta .meta-icon {
  width: 24px;
  text-align: center;
  margin-inline-end: 0.5rem;
  flex-shrink: 0;
}

.ticket-actions {
  border-color: rgba(226, 232, 240, 0.7) !important;
}

.ticket-actions .btn {
  border-radius: 0.75rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
}

/* ===== Enhanced Responsive Design ===== */

/* Mobile-first approach */
@media (max-width: 575.98px) {
  /* Enhanced mobile containers */
  .container-xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Enhanced mobile navigation */
  .navbar {
    padding: 0.75rem 0;
  }
  
  .navbar-brand {
    font-size: 1.25rem;
  }
  
  .navbar-brand-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  /* Enhanced mobile cards */
  .card {
    border-radius: 1.25rem;
    margin-bottom: 1.5rem;
  }
  
  .card-body {
    padding: 1.5rem;
  }
  
  /* Enhanced mobile forms */
  .form-control,
  .form-select,
  textarea {
    padding: 0.875rem 1rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  /* Enhanced mobile buttons */
  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    min-height: 44px; /* Touch-friendly */
  }
  
  /* Enhanced mobile tables */
  .table-responsive {
    border-radius: 1rem;
    margin: 0 -1rem;
    padding: 0 1rem;
  }
  
  /* Enhanced mobile chat */
  .chat-panel {
    width: calc(100vw - 2rem);
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
  }
  
  .chat-sticky-button {
    bottom: 1rem;
    right: 1rem;
  }
  
  .chat-fab {
    width: 56px;
    height: 56px;
  }
  
  /* Enhanced mobile animations */
  .card:hover {
    transform: translateY(-2px);
  }
  
  .btn:hover {
    transform: translateY(-1px);
  }
}

/* Tablet styles */
@media (min-width: 576px) and (max-width: 991.98px) {
  /* Enhanced tablet layout */
  .container-xl {
    padding-left: 2rem;
    padding-right: 2rem;
  }
  
  /* Enhanced tablet cards */
  .card {
    margin-bottom: 2rem;
  }
  
  /* Enhanced tablet chat */
  .chat-panel {
    width: 380px;
  }
}

/* Desktop optimizations */
@media (min-width: 1400px) {
  /* Enhanced desktop containers */
  .container-xl {
    max-width: 1320px;
  }
  
  /* Enhanced desktop typography */
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.75rem; }
  
  /* Enhanced desktop spacing */
  .card-body {
    padding: 2.5rem;
  }
  
  /* Enhanced desktop animations */
  .card:hover {
    transform: translateY(-10px) rotateX(1deg);
  }
}

/* Ultra-wide screen support */
@media (min-width: 1920px) {
  .container-xl {
    max-width: 1440px;
  }
  
  main.container-xl {
    padding-top: 6rem;
    padding-bottom: 6rem;
  }
}

/* Enhanced accessibility for reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border: #000000;
    --text: #000000;
    --surface: #ffffff;
  }
  
  .btn {
    border-width: 2px;
  }
  
  .form-control,
  .form-select {
    border-width: 2px;
  }
}

/* Dark mode preparation (future enhancement) */
@media (prefers-color-scheme: dark) {
  /* Dark mode variables can be added here */
}

/* Enhanced print styles */
@media print {
  .navbar,
  .chat-sticky-button,
  .chat-panel,
  .btn,
  .pagination {
    display: none !important;
  }
  
  .card {
    border: 1px solid #000 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  
  body {
    background: #fff !important;
    color: #000 !important;
  }
}

/* Enhanced landscape mobile */
@media (max-width: 767.98px) and (orientation: landscape) {
  .chat-panel {
    height: 70vh;
    max-height: 400px;
  }
  
  .navbar {
    padding: 0.5rem 0;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn:hover {
    transform: none;
  }
  
  .card:hover {
    transform: none;
  }
  
  .btn:active {
    transform: scale(0.95);
  }
}

/* Enhanced responsive typography */
@media (max-width: 575.98px) {
  h1 { font-size: 1.75rem; line-height: 1.2; }
  h2 { font-size: 1.5rem; line-height: 1.3; }
  h3 { font-size: 1.25rem; line-height: 1.4; }
  h4 { font-size: 1.125rem; line-height: 1.4; }
  h5 { font-size: 1rem; line-height: 1.5; }
  h6 { font-size: 0.875rem; line-height: 1.5; }
  
  p {
    font-size: 0.95rem;
    line-height: 1.6;
  }
}

/* Responsive grid improvements */
@media (max-width: 768px) {
  .row.g-3 > * {
    margin-bottom: 1rem;
  }
  
  .col-md-6:last-child {
    margin-bottom: 0;
  }
}

/* Enhanced mobile ticket detail layout */
@media (max-width: 767.98px) {
  .ticket-detail-container {
    padding: 1rem;
  }
  
  .ticket-sidebar {
    margin-bottom: 2rem;
  }
  
  .ticket-actions .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  .ticket-actions .btn:last-child {
    margin-bottom: 0;
  }
}

/* Responsive tweaks */
@media (max-width: 767.98px) {
  .ticket-card {
    border-radius: 1.25rem;
  }
}

/* ===== Modern Animations & Micro-interactions ===== */

/* Smooth fade-in animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Apply animations to elements */
.card {
  animation: fadeInUp 0.6s ease-out;
}

.alert {
  animation: fadeInDown 0.5s ease-out;
}

/* Enhanced hover effects */
.navbar-nav .nav-link {
  position: relative;
  overflow: hidden;
}

.navbar-nav .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.8);
  transition: var(--transition-base);
  transform: translateX(-50%);
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
  width: 80%;
}

/* Loading animations */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

/* Pulse animation for important elements */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

.pulse {
  animation: pulse 2s infinite;
}

/* Bounce animation for notifications */
@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translate3d(0, 0, 0);
  }
  40%, 43% {
    transform: translate3d(0, -8px, 0);
  }
  70% {
    transform: translate3d(0, -4px, 0);
  }
  90% {
    transform: translate3d(0, -2px, 0);
  }
}

.bounce {
  animation: bounce 1s ease-in-out;
}

/* Enhanced table interactions */
.table-hover tbody tr {
  transition: var(--transition-base);
}

.table-hover tbody tr:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(37, 99, 235, 0.02) 100%);
  transform: scale(1.01);
}

/* Improved modal animations */
.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  transform: translate(0, -50px);
  opacity: 0;
}

.modal.show .modal-dialog {
  transform: translate(0, 0);
  opacity: 1;
}

/* Enhanced badge animations */
.badge {
  transition: var(--transition-base);
}

.badge:hover {
  transform: scale(1.1);
  z-index: 10;
}

/* ===== HTMX Enhanced Styles ===== */

/* HTMX loading states */
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.htmx-request .htmx-indicator {
  opacity: 1;
}

/* Button loading states */
.htmx-request.btn {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.htmx-request.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.htmx-request.btn-primary::after {
  border-top-color: #ffffff;
}

.htmx-request.btn-outline-primary::after {
  border: 2px solid rgba(37, 99, 235, 0.3);
  border-top: 2px solid #2563eb;
}

.htmx-request.btn-danger::after {
  border-top-color: #ffffff;
}

.htmx-request.btn-outline-secondary::after {
  border: 2px solid rgba(107, 114, 128, 0.3);
  border-top: 2px solid #6b7280;
}

/* Spin animation for loading */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* HTMX swapping animations */
.htmx-swapping {
  animation: fadeOut 0.2s ease-out;
}

.htmx-settling {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.98); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* Enhanced ticket actions container */
#ticket-actions-container,
#customer-actions-container {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 44px;
}

#ticket-actions-container.htmx-request,
#customer-actions-container.htmx-request {
  opacity: 0.7;
  transform: scale(0.98);
}

/* ===== Support Tickets Grid ===== */
.support-tickets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 1rem 0;
}

.ticket-card {
  background-image: url("img/cards/3.png");
  background-size: cover;
  background-repeat: no-repeat;
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.ticket-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ticket-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.ticket-card:hover::before {
  opacity: 1;
}

.ticket-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.ticket-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ticket-card-badges .ticket-id {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-soft);
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
}

.ticket-card-checkbox {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ticket-card:hover .ticket-card-checkbox {
  opacity: 1;
}

.ticket-card-body {
  margin-bottom: 1rem;
}

.ticket-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.ticket-card-excerpt {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.ticket-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ticket-card-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ticket-card-user img,
.ticket-user-initial {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.ticket-user-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.ticket-card-info {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.ticket-card-info .ticket-category,
.ticket-card-info .ticket-time {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.ticket-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.ticket-replies {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.ticket-assignee {
  position: relative;
}

.ticket-assignee img,
.ticket-assignee .ticket-user-initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.ticket-assignee i {
  color: var(--muted);
  font-size: 1.125rem;
}

/* No tickets message */
.no-tickets-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

.no-tickets-message i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.no-tickets-message h4 {
  margin-bottom: 0.5rem;
  color: var(--text);
}

/* Responsive grid adjustments */
@media (max-width: 1200px) {
  .support-tickets-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .support-tickets-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .ticket-card {
    padding: 1rem;
  }
  
  .ticket-card-title {
    font-size: 1rem;
  }
  
  .ticket-card-excerpt {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .ticket-card-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .ticket-card-badges {
    width: 100%;
  }
  
  .ticket-card-checkbox {
    position: absolute;
    top: 1rem;
    right: 1rem;
    opacity: 1;
  }
}

/* Success/error feedback for HTMX actions */
.htmx-success {
  animation: successPulse 0.6s ease-out;
}

.htmx-error {
  animation: errorShake 0.6s ease-out;
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); background-color: rgba(34, 197, 94, 0.1); }
  100% { transform: scale(1); background-color: transparent; }
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Enhanced form validation feedback */
.form-control.is-invalid {
  border-color: var(--danger);
  background-image: none;
  animation: errorShake 0.3s ease-out;
}

.form-control.is-valid {
  border-color: var(--success);
  background-image: none;
  animation: successPulse 0.3s ease-out;
}

/* Loading skeleton for HTMX content */
.htmx-loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.5rem;
  height: 20px;
  margin: 0.5rem 0;
}

/* Enhanced button states for HTMX */
.btn.htmx-request {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1) !important;
}

/* Progress indicator for long-running HTMX requests */
.htmx-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 50%, var(--primary) 100%);
  background-size: 200% 100%;
  animation: progressShimmer 2s linear infinite;
  z-index: 9999;
  transition: width 0.3s ease;
}

@keyframes progressShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Enhanced notification styling for HTMX responses */
.alert.htmx-updated {
  animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== Enhanced Content Transitions ===== */

/* Smooth scroll behavior for better UX */
html {
  scroll-behavior: smooth;
}

/* Page transition effects */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Content fade-in animations */
.content-fade-in {
  animation: contentFadeIn 0.6s ease-out forwards;
}

@keyframes contentFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Staggered animations for lists */
.stagger-item {
  opacity: 0;
  animation: staggerFadeIn 0.5s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes staggerFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Enhanced card transitions */
.card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.card:hover {
  transform: translateY(-8px) rotateX(2deg);
  box-shadow: 
    0 35px 80px rgba(15, 23, 42, 0.15),
    0 15px 35px rgba(15, 23, 42, 0.1);
}

/* Smooth height transitions for dynamic content */
.smooth-height {
  transition: max-height 0.4s ease, opacity 0.4s ease;
  overflow: hidden;
}

/* Enhanced list transitions */
.list-group-item {
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.list-group-item:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(37, 99, 235, 0.02) 100%);
  border-left-color: var(--primary);
  transform: translateX(4px);
  padding-left: 1.5rem;
}

/* Enhanced focus states for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.5);
  outline-offset: 2px;
}

/* Enhanced modal transitions */
.modal {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-backdrop {
  background: rgba(15, 23, 42, 0.6);
  transition: opacity 0.3s ease;
}

.modal-dialog {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Enhanced dropdown transitions */
.dropdown-menu {
  animation: dropdownSlide 0.3s ease-out;
  transform-origin: top;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: scaleY(0.8) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scaleY(1) translateY(0);
  }
}

/* Enhanced tab transitions */
.tab-pane {
  animation: tabFadeIn 0.4s ease-out;
}

@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Loading content placeholders */
.content-loading {
  position: relative;
  overflow: hidden;
}

.content-loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: loadingShimmer 1.5s infinite;
  z-index: 1;
}

@keyframes loadingShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Enhanced alert transitions */
.alert {
  animation: alertSlideIn 0.4s ease-out;
  position: relative;
  overflow: hidden;
}

.alert::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: currentColor;
  opacity: 0.3;
}

@keyframes alertSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Enhanced badge transitions */
.badge {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge:hover {
  transform: scale(1.15) rotate(2deg);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

/* Enhanced pagination transitions */
.page-link {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.page-link::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.3) 0%, transparent 70%);
  transition: width 0.4s ease, height 0.4s ease;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.page-link:hover::before {
  width: 100px;
  height: 100px;
}

/* Loading spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--secondary);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

/* Progress bar animations */
.progress {
  overflow: hidden;
}

.progress-bar {
  transition: width 0.6s ease;
}

/* Enhanced dropdown animations */
.dropdown-menu {
  animation: fadeInDown 0.3s ease-out;
  border: none;
  box-shadow: var(--shadow-lg);
  border-radius: 1rem;
  margin-top: 0.5rem;
}

.dropdown-item {
  transition: var(--transition-base);
  border-radius: 0.5rem;
  margin: 0.125rem;
}

.dropdown-item:hover {
  background: var(--gradient-primary);
  color: white;
  transform: translateX(4px);
}

/* ===== Enhanced Typography & Spacing ===== */

/* Improved heading styles */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
  color: var(--text);
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

h4 {
  font-size: 1.25rem;
  font-weight: 600;
}

h5 {
  font-size: 1.125rem;
  font-weight: 600;
}

h6 {
  font-size: 1rem;
  font-weight: 600;
}

/* Improved paragraph spacing */
p {
  margin-bottom: 1.25rem;
  line-height: 1.7;
  color: var(--muted);
}

.lead {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text);
  opacity: 0.9;
}

/* Enhanced text utilities */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted {
  color: var(--muted) !important;
}

.text-primary {
  color: var(--primary) !important;
}

.text-secondary {
  color: var(--secondary) !important;
}

/* Improved list styling */
ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.list-group-item {
  border: none;
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem;
  border-radius: 0.75rem;
  background: var(--surface);
  transition: var(--transition-base);
}

.list-group-item:hover {
  background: var(--surface-soft);
  transform: translateX(4px);
}

/* Enhanced blockquotes */
blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--muted);
  background: var(--surface-soft);
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
}

/* Improved code styling */
code {
  background: var(--surface-soft);
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Enhanced spacing utilities */
.section-spacing {
  padding: 4rem 0;
}

.section-spacing-sm {
  padding: 2rem 0;
}

.section-spacing-lg {
  padding: 6rem 0;
}

.content-spacing {
  margin-bottom: 3rem;
}

.content-spacing-sm {
  margin-bottom: 1.5rem;
}

.content-spacing-lg {
  margin-bottom: 4.5rem;
}

/* Improved responsive typography */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.375rem; }
  h4 { font-size: 1.25rem; }
  h5 { font-size: 1.125rem; }
  
  .lead { font-size: 1.125rem; }
  .section-spacing { padding: 3rem 0; }
  .section-spacing-lg { padding: 4rem 0; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  
  .lead { font-size: 1rem; }
  .section-spacing { padding: 2rem 0; }
  .section-spacing-lg { padding: 3rem 0; }
}

/* Enhanced readability */
.readability-improved {
  max-width: 65ch;
  line-height: 1.7;
  margin: 0 auto;
}

/* Text selection styling */
::selection {
  background: rgba(37, 99, 235, 0.2);
  color: var(--primary);
}

::-moz-selection {
  background: rgba(37, 99, 235, 0.2);
  color: var(--primary);
}

/* Enhanced link styling */
a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-base);
  position: relative;
}

a:hover {
  color: var(--primary-strong);
  text-decoration: underline;
  text-decoration-color: rgba(37, 99, 235, 0.3);
  text-underline-offset: 4px;
}

a:focus {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* ===== Enhanced Form Styling & Interactions ===== */

/* Floating labels */
.form-floating {
  position: relative;
}

.form-floating > .form-control,
.form-floating > .form-select {
  height: calc(3.5rem + 2px);
  line-height: 1.25;
  padding: 1rem 0.75rem;
}

.form-floating > label {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  padding: 1rem 0.75rem;
  pointer-events: none;
  border: 1px solid transparent;
  transform-origin: 0 0;
  transition: var(--transition-base);
  color: var(--muted);
  font-weight: 500;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
  transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
  color: var(--primary);
  font-weight: 600;
}

/* Enhanced input groups */
.input-group {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
}

.input-group:focus-within {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.input-group .form-control {
  border: none;
  box-shadow: none;
}

.input-group .input-group-text {
  background: var(--surface-soft);
  border: none;
  color: var(--muted);
  font-weight: 500;
}

/* Enhanced validation states */
.form-control.is-valid {
  border-color: var(--success);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2316a34a' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid {
  border-color: var(--danger);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc2626'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc2626' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.valid-feedback,
.invalid-feedback {
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
}

.valid-feedback {
  color: var(--success);
  background: rgba(22, 163, 74, 0.1);
}

.invalid-feedback {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.1);
}

/* Enhanced checkboxes and radio buttons */
.form-check {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  transition: var(--transition-base);
}

.form-check:hover {
  background: var(--surface-soft);
}

.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
  border: 2px solid var(--border);
  transition: var(--transition-base);
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.form-check-input:focus {
  border-color: var(--secondary);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-check-label {
  font-weight: 500;
  color: var(--text);
  margin-left: 0.5rem;
  cursor: pointer;
}

/* Enhanced file inputs */
.form-control[type="file"] {
  padding: 0.75rem 1rem;
  border: 2px dashed var(--border);
  background: var(--surface-soft);
  cursor: pointer;
  transition: var(--transition-base);
}

.form-control[type="file"]:hover {
  border-color: var(--secondary);
  background: var(--surface);
}

/* Enhanced range inputs */
.form-range {
  height: 0.5rem;
  background: var(--surface-soft);
  border-radius: 0.25rem;
}

.form-range::-webkit-slider-thumb {
  width: 1.25rem;
  height: 1.25rem;
  background: var(--primary);
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.1);
}

/* Enhanced form layouts */
.form-row {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-row-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.form-row-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
  .form-row-cols-2,
  .form-row-cols-3 {
    grid-template-columns: 1fr;
  }
}

/* Enhanced form sections */
.form-section {
  background: var(--surface);
  border-radius: 1.5rem;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.form-section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

/* Enhanced form actions */
.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.form-actions .btn {
  min-width: 120px;
}

/* Loading states for forms */
.form-loading .form-control,
.form-loading .btn {
  opacity: 0.7;
  pointer-events: none;
}

.form-loading .btn::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  margin: auto;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
}

/* Enhanced help text */
.form-text {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.5rem;
  font-weight: 400;
  line-height: 1.5;
}

/* Enhanced select styling */
.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  padding-right: 2.5rem;
}

/* Enhanced textarea styling */
textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

textarea.form-control:focus {
  transform: translateY(-1px);
}

/* Enhanced search inputs */
.search-input {
  position: relative;
}

.search-input .form-control {
  padding-left: 3rem;
  border-radius: 2rem;
}

.search-input::before {
  content: "🔍";
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  z-index: 10;
}

/* Enhanced form fieldsets */
fieldset {
  border: 2px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  margin-bottom: 2rem;
}

legend {
  font-weight: 600;
  color: var(--text);
  padding: 0 1rem;
  font-size: 1.125rem;
}
