/* Override primary color - Lime Green */
:root {
  --bs-primary: #a6ca47 !important;
  --bs-primary-rgb: 166, 202, 71 !important;
}

/* Apply primary color to Bootstrap components */
.btn-primary {
  background-color: #a6ca47 !important;
  border-color: #a6ca47 !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: #95b83e !important;
  border-color: #95b83e !important;
}

.badge.bg-primary {
  background-color: #a6ca47 !important;
}

.text-primary {
  color: #a6ca47 !important;
}

.bg-primary {
  background-color: #a6ca47 !important;
}

.border-primary {
  border-color: #a6ca47 !important;
}

a.text-primary:hover,
a.text-primary:focus {
  color: #95b83e !important;
}

/* Fix for React - override visibility hidden */
.main-wrapper {
  visibility: visible !important;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

/* Ensure content main_content displays correctly */
.content.main_content {
  display: flex;
  width: 100% !important;
  height: 100%;
}

/* Ensure sidebar-group has proper height for scrolling */
.sidebar-group {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Ensure tab-content and tab-pane take full height */
.sidebar-group .tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-group .tab-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Ensure sidebar-content can scroll */
.sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Fix inner slimscroll div to enable scrolling */
.sidebar-content .slimscroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

/* Ensure chat area takes proper space */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

/* Ensure chat inner container has proper height */
.chat > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

/* Fix chat body scrolling */
.chat-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Ensure messages container doesn't overflow */
.chat-body .messages {
  display: flex;
  flex-direction: column;
}

/* Active/Selected chat styling */
.chat-users-wrap .chat-user-list.active {
  box-shadow: 0px 0px 0px 2px rgb(166, 202, 71) inset !important;
  background-color: rgba(166, 202, 71, 0.05);
}

/* Hover states for chat items */
.chat-users-wrap .chat-user-list:hover {
  box-shadow: 0px 0px 0px 2px rgb(166, 202, 71) inset !important;
}

.chat-users-wrap .chat-list .chat-dropdown:hover .chat-user-list {
  box-shadow: 0px 0px 0px 2px rgb(166, 202, 71) inset !important;
}

.darkmode .sidebar-group .sidebar-content .sidebar-body .chat-users-wrap .chat-user-list:hover {
  box-shadow: 0px 0px 0px 2px rgb(166, 202, 71) inset !important;
}

/* Calendar Full Screen Layout */
.calendar-full-screen {
  flex: 1;
  overflow-y: auto;
  background-color: #f8f9fa;
  height: 100%;
  margin-left: 0;
  width: 100%;
  padding-left: 60px;
  box-sizing: border-box;
}

/* Calendar Styles - Consolidated and Fixed */
.calendar-container {
  width: 100%;
  max-width: 100%;
  padding: 0;
}

.calendar-grid {
  width: 100%;
  background: #fff;
  border-radius: 8px;
  overflow: visible;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
}

.calendar-day-names {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  width: 100%;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.calendar-day-name {
  padding: 1rem;
  text-align: center;
  font-weight: 600;
  color: #495057;
  border-right: 1px solid #e9ecef;
  box-sizing: border-box;
}

.calendar-day-name:last-child {
  border-right: 1px solid #e9ecef;
}

.calendar-days {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  grid-auto-rows: minmax(120px, auto) !important;
  gap: 0 !important;
  width: 100%;
}

/* Week view - larger cells for more events */
.calendar-days.week-view {
  grid-auto-rows: minmax(400px, auto) !important;
}

.calendar-day {
  min-height: 120px;
  padding: 0.5rem;
  border-right: 1px solid #e9ecef;
  border-bottom: 1px solid #e9ecef;
  background: #fff;
  transition: background-color 0.2s;
  cursor: pointer;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
}

/* Ensure proper border on last column */
.calendar-day:nth-child(7n) {
  border-right: 1px solid #e9ecef;
}

/* Remove border from last row */
.calendar-days > .calendar-day:nth-last-child(-n+7) {
  border-bottom: 1px solid #e9ecef;
}

/* Week view day styling */
.calendar-day.week-view-day {
  min-height: 400px;
}

.calendar-day:hover {
  background-color: #f8f9fa;
}

.calendar-day.other-month {
  background: #fafafa;
  opacity: 0.6;
}

.calendar-day.today {
  background: #eff6ff;
}

.calendar-day.today .day-number {
  background: #a6ca47;
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.day-number {
  font-weight: 600;
  color: #212529;
  margin-bottom: 0.5rem;
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.event-item {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.event-item:hover {
  opacity: 0.8;
}

.event-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-icon {
  font-size: 0.875rem;
  margin-left: 0.25rem;
}

.event-more {
  font-size: 0.7rem;
  color: #6c757d;
  padding: 0.25rem;
  text-align: center;
  transition: all 0.2s;
}

.event-more:hover {
  color: #a6ca47;
  background-color: rgba(166, 202, 71, 0.1);
  border-radius: 4px;
  font-weight: 600;
}

.calendar-legend {
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Left sidebar menu active/hover states */
.sidebar-menu .main-menu ul li a.active,
.sidebar-menu .main-menu ul li a:hover {
  background-color: #a6ca47 !important;
  color: #FFF !important;
}

/* Fix sidebar dropdown overflow */
.sidebar-menu {
  overflow: visible !important;
}

.sidebar-menu .bottom-menu {
  overflow: visible !important;
}

.sidebar-menu .bottom-menu .dropdown-menu {
  position: fixed !important;
  transform: translateX(0) !important;
}

/* Event Details Mobile Responsiveness */
@media (max-width: 767.98px) {
  /* Make cards more compact on mobile */
  .card-body {
    padding: 1rem !important;
  }

  /* Make badges and text responsive */
  .badge.fs-14 {
    font-size: 0.75rem !important;
    padding: 0.375rem 0.75rem !important;
  }

  /* Make heading and title text smaller */
  h3 {
    font-size: 1.25rem !important;
  }

  h5 {
    font-size: 1rem !important;
  }

  h6 {
    font-size: 0.875rem !important;
  }

  /* Make profile-list items stack better */
  .profile-list {
    flex-wrap: wrap;
  }

  /* Ensure action buttons wrap properly */
  .d-flex.gap-2 {
    gap: 0.5rem !important;
  }
}

/* Mobile Chat Responsiveness */
@media (max-width: 1199.98px) {
  /* Add right spacing to the main content area on mobile */
  .content.main_content {
    padding-right: 40px !important;
  }

  /* Ensure sidebar-group and chat take full available width on mobile */
  .sidebar-group,
  .chat {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Make back button more visible on mobile */
  .chat-header .chat-close {
    font-size: 1.25rem;
    padding: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .chat-header .chat-close i {
    font-size: 1.25rem;
  }

  /* Contact Details Mobile Responsiveness */
  /* Removed chat padding - now handled by Bootstrap responsive classes in components */

  /* Contact details back button styling */
  .chat .d-xl-none a {
    font-size: 1.25rem !important;
    padding: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .chat .d-xl-none a i {
    font-size: 1.25rem;
  }

  /* Calendar Mobile Responsiveness */
  .calendar-full-screen {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .calendar-full-screen > div {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    max-width: 100%;
  }

  .calendar-header-container h2 {
    font-size: 1.5rem;
  }

  /* Make calendar navigation buttons larger for mobile */
  .calendar-header .btn-sm {
    padding: 0.5rem 0.75rem;
  }

  .calendar-header .btn-sm i {
    font-size: 1.1rem;
  }

  /* Stack calendar header elements on mobile */
  .calendar-header-container .d-flex {
    gap: 0.75rem !important;
  }

  /* Adjust calendar grid for mobile */
  .calendar-day {
    min-height: 100px !important;
    font-size: 0.875rem;
  }

  /* Ensure grid stays proper on tablet */
  .calendar-days {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
  }

  .calendar-day-name {
    padding: 0.5rem 0.25rem;
    font-size: 0.7rem;
  }

  .day-number {
    font-size: 0.8rem;
  }

  .event-item {
    font-size: 0.65rem;
    padding: 0.2rem 0.3rem;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.3;
  }

  .event-item .event-details {
    display: block !important;
  }

  .event-item .event-details > div {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.2;
  }

  /* Adjust event legend for mobile */
  .calendar-legend {
    font-size: 0.875rem;
  }

  .calendar-legend h6 {
    font-size: 1rem;
  }

  .legend-item {
    font-size: 0.8rem;
  }

  .legend-color {
    width: 16px;
    height: 16px;
  }
}

/* Extra small mobile devices */
@media (max-width: 575.98px) {
  .calendar-full-screen {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .calendar-full-screen > div {
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
  }

  .calendar-header-container h2 {
    font-size: 1.25rem;
    width: 100%;
    margin-bottom: 0.5rem;
  }

  /* Make view tabs and add button full width on very small screens */
  .calendar-header-container .d-flex {
    width: 100%;
  }

  .calendar-header-container .nav-tabs {
    flex: 1;
  }

  /* Further reduce calendar cell sizes */
  .calendar-day {
    min-height: 85px !important;
    padding: 0.2rem !important;
  }

  .calendar-day-name {
    padding: 0.3rem 0.1rem;
    font-size: 0.6rem;
  }

  .day-number {
    font-size: 0.7rem;
    margin-bottom: 0.2rem !important;
  }

  .event-item {
    font-size: 0.55rem;
    padding: 0.15rem 0.2rem;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.2;
  }

  .event-more {
    font-size: 0.55rem;
  }

  /* Show event details with wrapping on very small screens */
  .event-item .event-details {
    display: block !important;
  }

  .event-item .event-details > div {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.2;
  }

  /* Adjust event icons and spacing for small screens */
  .event-item .event-details i {
    font-size: 0.5rem;
    margin-right: 0.1rem;
  }

  /* Adjust calendar navigation for very small screens */
  .calendar-header h5 {
    font-size: 0.95rem;
  }

  .calendar-header .btn-sm {
    padding: 0.375rem 0.5rem;
  }

  /* Make modals more mobile-friendly */
  .modal-dialog.modal-lg {
    max-width: 95%;
    margin: 0.5rem auto;
  }

  /* Adjust modal content padding on mobile */
  .modal-body {
    padding: 1rem;
  }

  /* Make modal badges and text responsive */
  .modal-body .badge {
    font-size: 0.65rem !important;
  }

  .modal-body small {
    font-size: 0.75rem;
  }

  /* Ensure calendar doesn't cause horizontal scroll */
  .calendar-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .calendar-days {
    min-width: 280px;
  }
}
