/* Common Base Styles - Shared between base.html and base_simple.html */

/* CSS Custom Properties for theming */
:root {
  --primary-color: #6c5b7b;
  --primary-light: #9f7aea;
  --primary-dark: #44337a;

  --secondary-color: #d53f8c;
  --secondary-light: #ed64a6;
  --secondary-dark: #97266d;
}

/* Force body element to use full viewport width */
html,
body {
  margin: 0 !important;
  padding: 0 !important;
  height: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

body {
  background-color: #f0f4f8 !important;
  height: 100% !important;
}

/* Ensure all direct children of body use full width */
body > * {
  box-sizing: border-box !important;
}

/* Common card styling */
.card {
  border-radius: 0.75rem !important;
  border: none !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
  margin-bottom: 1rem;
  overflow: visible;
}

tbody,
thead {
  vertical-align: middle !important;
  text-align: center !important;
}

.card:hover {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08) !important;
}

.card-body {
  padding: 1.25rem !important;
}

/* Button styling */
.btn {
  border-radius: 0.75rem !important;
  font-weight: 500 !important;
  transition: all 0.3s ease !important;
}

.btn-sm {
  padding: 0.25rem 0.75rem !important;
  font-size: 0.875rem !important;
}

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

/* Gradient button colors */
.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  ) !important;
  border: none !important;
  color: white !important;
}

.btn-secondary {
  background: linear-gradient(135deg, #4f46e5, #7f9cf5) !important;
  border: none !important;
  color: white !important;
}

.btn-info {
  background: linear-gradient(135deg, #0ea5e9, #38bdf8) !important;
  border: none !important;
  color: white !important;
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #fbbf24) !important;
  border: none !important;
  color: white !important;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #f87171) !important;
  border: none !important;
  color: white !important;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #34d399) !important;
  border: none !important;
  color: white !important;
}

.btn-dark {
  background: linear-gradient(135deg, #1e293b, #334155) !important;
  border: none !important;
  color: white !important;
}

/* Table styling */
.table {
  border-radius: 0.5rem !important;
  overflow: hidden !important;
}

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

/* Badge styling */
.badge {
  font-weight: 500 !important;
  padding: 0.35em 0.65em !important;
  text-wrap: auto;
}

/* Modal styling */
.modal-content {
  border-radius: 0.75rem !important;
  border: none !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* Dark Mode Compatibility Fixes */
[data-theme="dark"] .card {
  background-color: #181d2b !important;
  border-color: #111520 !important;
}

/* Dark mode background fixes */
[data-theme="dark"] .card-body {
  background-color: #181d2b !important;
  border-radius: 0.75rem;
}

/* Fix status colors in dark mode */
[data-theme="dark"] .text-primary {
  color: #90caf9 !important;
}
[data-theme="dark"] .text-success {
  color: #a5d6a7 !important;
}
[data-theme="dark"] .text-danger {
  color: #ef9a9a !important;
}
[data-theme="dark"] .text-warning {
  color: #ffe082 !important;
}
[data-theme="dark"] .text-info {
  color: #81d4fa !important;
}
[data-theme="dark"] .text-dark {
  color: #e0e0e0 !important;
}
[data-theme="dark"] .text-secondary {
  color: #b0bec5 !important;
}

/* Alert Styles */
.custom-alert-2 {
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
  direction: rtl;
  position: relative;
  border: none;
  display: flex;
  align-items: center;
}

.custom-alert-2 i {
  margin-left: 14px;
  font-size: 20px;
}

.alert-danger.custom-alert-2 {
  background-color: rgba(220, 53, 69, 0.15);
  color: #842029;
  border-left: 4px solid #dc3545;
}

.alert-warning.custom-alert-2 {
  background-color: rgba(255, 193, 7, 0.15);
  color: #664d03;
  border-left: 4px solid #ffc107;
}

.alert-success.custom-alert-2 {
  background-color: rgba(25, 135, 84, 0.15);
  color: #0f5132;
  border-left: 4px solid #198754;
}

.alert-info.custom-alert-2 {
  background-color: rgba(13, 202, 240, 0.15);
  color: #055160;
  border-left: 4px solid #0dcaf0;
}

.custom-alert-2 .btn-close {
  position: absolute;
  left: 14px;
  padding: 0.25rem;
  width: 24px;
  height: 24px;
  opacity: 0.6;
}

.custom-alert-2 .btn-close:hover {
  opacity: 1;
}

/* Select2 container fixes */
.input-group .select2-container,
.form-group .select2-container {
  position: relative !important;
  float: left !important;
  width: 100% !important;
  margin-bottom: 0 !important;
  display: table !important;
  table-layout: fixed !important;
}

/* Ensure Select2 dropdown is above the Bootstrap modal */
.select2-container--open {
  z-index: 1150 !important;
}

[data-theme="dark"] {
  background-color: #07090f;
}
[data-theme="dark"] body {
  background-color: #07090f;
}

/* Select2 Base Styling */
.select2-container--default .select2-selection--single {
  height: 28px !important;
  padding: 6px 12px !important;
  border-radius: 0.75rem !important;
  border: 1px solid #dee2e6 !important;
  display: flex !important;
  align-items: center !important;
  transition:
    border-color 0.15s ease-in-out,
    box-shadow 0.15s ease-in-out !important;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 0.2rem rgba(108, 91, 123, 0.25) !important;
}

/* Arrow styling */
.select2-container--default
  .select2-selection--single
  .select2-selection__arrow {
  height: 26px !important;
  width: 30px !important;
}

/* Dropdown styling */
.select2-dropdown {
  border-radius: 0.75rem !important;
  border: none !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15) !important;
  overflow: hidden !important;
}

/* Option styling */
.select2-container--default
  .select2-results__option--highlighted[aria-selected] {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  ) !important;
}

/* Search field styling */
.select2-search--dropdown .select2-search__field {
  padding: 8px 10px !important;
  border-radius: 0.5rem !important;
  border: 1px solid #dee2e6 !important;
}

.select2-search--dropdown .select2-search__field:focus {
  border-color: var(--primary-color) !important;
  outline: none !important;
}

/* Selection text styling */
.select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  line-height: 1.5 !important;
  color: #495057 !important;
  padding-right: 20px !important;
}

/* Selected state styling */
.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: rgba(108, 91, 123, 0.1) !important;
  color: white !important;
  font-weight: 500 !important;
}

/* Dark mode support */
[data-theme="dark"] .select2-container--default .select2-selection--single {
  background-color: #111520 !important;
  border-color: #181d2b !important;
}

[data-theme="dark"]
  .select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  color: #e0e0e0 !important;
}

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

[data-theme="dark"] .select2-container--default .select2-results__option {
  color: #e0e0e0 !important;
}

[data-theme="dark"]
  .select2-container--default
  .select2-results__option[aria-selected="true"] {
  background-color: rgba(153, 105, 199, 0.2) !important;
  color: #c1b3d1 !important;
}

[data-theme="dark"] .select2-search--dropdown .select2-search__field {
  background-color: #07090f !important;
  border-color: #181d2b !important;
  color: #e0e0e0 !important;
}

[data-theme="dark"] .btn-dark {
  background: linear-gradient(135deg, #111520, #181d2b) !important;
  border: none !important;
  color: white !important;
}

/* Style for the edit badge on the avatar */
.edit-pen-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  color: #0d5afd;
  background-color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* The border helps the badge stand out from the avatar */
  border: 2px solid #0d5afd;
}

/* This ensures the user-profile link can be a positioning parent */
.user-profile a {
  position: relative;
  display: inline-block; /* Makes the <a> tag wrap the image */
}

.chat-user-list {
  box-shadow: none;
}

/* Ensure HTML and Body can naturally scroll */
html,
body {
  height: 100%; /* Important for some layouts to make body fill viewport */
  min-height: 100%; /* Ensures body takes at least 100% height */
  overflow-x: hidden; /* Prevent horizontal scrollbars if not needed */
  /* Remove any explicit overflow-y: hidden; or overflow: hidden; from here */
  /* if you find them in your existing CSS */
}

body {
  display: flex;
  flex-direction: column;
}

.page-content-wrapper {
  flex-grow: 1; /* Allows this content to expand and push footer down */
  overflow-y: auto; /* IMPORTANT: This makes the *main content area* scrollable if needed */
  -webkit-overflow-scrolling: touch; /* For smoother scrolling on iOS */
  /* Remove min-height: 100vh; if it's currently set on this element */
  /* Consider adding padding-bottom equal to footer height if footer is fixed */
  padding-bottom: 70px; /* Adjust based on your footer's height to prevent content from going under it */
}

/* Adjustments for fixed header/footer if they overlap content */
.page-content-wrapper {
  /* If your header and footer are fixed and have heights, you might need padding */
  /* For example, if header is 50px and footer is 60px */
  padding-top: 50px; /* Adjust this to the height of your fixed header */
  padding-bottom: 70px; /* Adjust this to the height of your fixed footer */
  box-sizing: border-box; /* Ensures padding is included in element's total height */
}

/* Fixed position for the progress bar */
.scroll-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px; /* Height of the progress bar */
  z-index: 1000; /* Ensure it stays on top */
  border-radius: 0 0 4px 4px; /* Rounded bottom corners */
  overflow: hidden; /* Hide overflow for the inner bar */
}
.scroll-bar {
  height: 100%;
  width: 0%; /* Initial width */
  background-color: #0d9488; /* Teal color for the progress */
  transition: width 0.1s ease-out; /* Smooth transition for width changes */
  border-radius: 0 4px 4px 0; /* Rounded right corners */
}
#baguetteBox-overlay .full-image img {
  object-fit: contain !important;
}
