/* ========== ENHANCED TYPOGRAPHY ========== */
:root {
  /* Improved pastel color scheme */
  --bs-primary: #8bb8e8; /* More vibrant pastel blue */
  --bs-primary-rgb: 139, 184, 232;
  --bs-primary-text-emphasis: #2c3e50;
  --bs-primary-bg-subtle: #e1f0ff;

  --bs-secondary: #c8d6e5; /* Softer pastel gray */
  --bs-secondary-rgb: 200, 214, 229;

  --bs-success: #a8e6cf; /* Fresh pastel green */
  --bs-info: #b3e0ff; /* Lighter pastel blue */
  --bs-warning: #ffd3b6; /* Warmer pastel orange */
  --bs-danger: #ffaaa5; /* Softer pastel red */

  /* New accent colors */
  --accent-purple: #d4b8ff;
  --accent-yellow: #ffe8a1;

  /* Improved dark shades */
  --bs-dark: #6c757d;
  --bs-dark-rgb: 108, 117, 125;

  /* Better body colors */
  --bs-body-color: #4a4a4a;
  --bs-body-bg: #f5f7fa;

  /* New variables */
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --card-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.12);
  --transition-base: all 0.2s ease-in-out;
}
body {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.6;
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  color: var(--bs-primary-text-emphasis);
}
/* Reset default margin/padding & Account for fixed navbar */
html,
body {
  margin: 0;
  padding: 0;
  padding-top: 40px;
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  max-height: 90vh;
  position: relative;
  overflow-x: hidden;
}

/* --- Base styles (Desktop First) --- */

/* Base column styles */
.left-column,
.main-column,
.right-column,
.main-content {
  min-height: calc(100vh - 56px);
  overflow-y: auto;
}

/* Base left-column specific styles */
.left-column {
  background-color: #f8f9fa;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease; /* For mobile animation */
}

/* --- Page-Specific Layouts for Desktop --- */

/* === INDEX PAGE LAYOUT (.page-index) === */
/* Apply fixed positioning and manual widths ONLY on index page */
body.page-index {
  overflow-y: hidden; /* Prevent the main body scrollbar on the index page */
}

.page-index .left-column {
  flex: 0 0 20%;
  max-width: 20%;
  position: fixed;
  top: 56px;
  left: 0;
  height: calc(100vh - 56px);
  z-index: 100;
}

/* Main content area for index page (assuming 3-column fixed layout) */

.page-index .main-content {
  flex: 0 0 60%;
  max-width: 60%;
  margin-left: 20%;
  margin-right: 20%;

  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: 0 !important;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding-bottom: 70px;
}

/* Right column for index page (assuming 3-column fixed layout) */
.page-index .right-column {
  flex: 0 0 20%;
  max-width: 20%;
  background-color: #fff;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
  position: fixed;
  top: 56px;
  right: 0;
  height: calc(100vh - 56px);
  z-index: 100;
  padding: 1.5rem;
}

/* === GROUP PAGE LAYOUT (.page-group) === */

.page-group .container-fluid {
  margin-top: 0 !important; /* Ensure no extra margin below header */
  padding-top: 0 !important; /* Ensure no extra padding below header */
}
/* Ensure the row doesn't add space either */
.page-group .container-fluid > .row {
  margin-top: 0 !important;
}

.page-group .left-column {
  flex: 0 0 20%;
  max-width: 20%;
  background-color: #f8f9fa;
  max-height: 100vh;
  position: fixed;
  top: 56px;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.page-group .main-column {
  margin-left: 20%;
  width: 80%;
  padding: 1rem;
  margin-top: 0;
  padding-top: 0;
}

/* --- Shared Component Styles --- */

/* Profile picture styling */
.profile-pic {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
}

/* --- Left Column: Profile Section --- */
.profile-section {
  border-radius: 0 0 40px 0;
  background-color: #fff;
  padding: 1.5rem;
  margin-left: 0;
  margin-top: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}
.profile-pic-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}
.username-large {
  font-size: 1.5rem;
}

/* --- Left Column: Groups Section --- */
.groups-section {
  border-radius: 0 40px 0 0;
  margin-top: 1rem;
  background-color: #fff;
  padding: 1.5rem;
  margin-left: 0;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 0;
}
/* Rounded Search Bar */
.groups-section .input-group.search-rounded input.form-control {
  border-top-left-radius: 1.25rem;
  border-bottom-left-radius: 1.25rem;
  border-right: none;
  padding: 0.4rem 0.8rem;
}
.groups-section .input-group.search-rounded button.btn {
  border-top-right-radius: 1.25rem;
  border-bottom-right-radius: 1.25rem;
  border-left-color: #ced4da;
  border-radius: 1.25rem;
}
.groups-section .input-group.search-rounded:focus-within {
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
  border-radius: 1.25rem;
}
/* Groups Header */
.groups-section .groups-header {
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--bs-secondary-bg-subtle);
  display: flex;
  align-items: center;
}
.groups-section .groups-header i.fa-users {
  font-size: 1.2rem;
  margin-right: 0.7rem;
  color: var(--bs-secondary-text-emphasis);
}
.groups-section .groups-header span {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--bs-body-color);
}
/* Groups List Container */
#groupsContainer {
  margin-top: 0;
  overflow-y: auto;
  padding-right: 5px; /* Space for scrollbar */
  min-height: 50px;
}
/* Individual Group Link/Item */
.group-link {
  display: block;
  margin-bottom: 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--bs-light-border-subtle);
  border-radius: 8px;
  transition: background-color 0.2s ease-in-out;
  text-decoration: none;
}
#groupsContainer .group-link:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.group-item {
  padding: 0.9rem 0.7rem;
  display: flex;
  align-items: center;
  line-height: 1.5;
}
.group-item i.fa-circle {
  font-size: 11px;
  margin-right: 0.9rem;
  color: var(--bs-secondary);
  flex-shrink: 0;
}
.group-item span {
  font-size: 1.1rem;
  word-break: break-word;
  color: var(--bs-body-color);
}
.group-link:hover {
  background-color: var(--bs-primary-bg-subtle);
  text-decoration: none;
}
/* Create Group button container */
.groups-section .mt-3 {
  /* Keep this selector if index.php uses <div class="mt-3"> */
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--bs-secondary-bg-subtle);
  flex-shrink: 0;
}
/* Create Group button styling */
.groups-section .mt-3 .btn.btn-primary {
  border-radius: 1.25rem;
  padding: 0.5rem 1rem;
  font-weight: 500;
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: var(--bs-primary-text-emphasis);
}
.groups-section .mt-3 .btn.btn-primary:hover {
  background-color: color-mix(in srgb, var(--bs-primary) 85%, black);
  border-color: color-mix(in srgb, var(--bs-primary) 80%, black);
  color: var(--bs-primary-text-emphasis);
}
/* --- End Groups Section Styles --- */

/* Dropdown styles */
.dropdown-menu {
  min-width: 200px;
}
#lessonFrame {
  border: none;
  background: #f8f9fa;
}
.btn-group {
  flex-grow: 1;
}
.dropdown-toggle::after {
  margin-left: 0.5em;
}

/* Card and banner styles */
.group-banner {
  height: 200px;
  object-fit: cover;
  width: 100%;
}
.module-card {
  transition: transform 0.2s;
}
.module-card:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* === Mobile Navigation & Layout === */

/* Mobile Nav Bar */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bs-primary-bg-subtle);
  padding: 10px 0;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}
.mobile-nav-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}
.mobile-nav a {
  color: var(--bs-primary-text-emphasis);
  text-decoration: none;
  padding: 10px 15px;
  transition: background-color 0.3s, border-radius 0.3s;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 14px;
}
.mobile-nav a i {
  font-size: 1.25rem;
  margin-bottom: 5px;
}
.mobile-nav a:hover {
  background-color: var(--bs-primary-border-subtle);
  border-radius: 10px;
}

/* Close button for mobile left column */
.close-left-column {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5rem;
  cursor: pointer;
  display: none; /* JS toggles */
  z-index: 1051;
  color: var(--bs-secondary-text-emphasis);
}

/* ========== RIGHT COLUMN - FRIENDS SECTION ========== */
.right-column {
  background-color: #fff;
  padding: 1.5rem;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bs-primary) transparent;
}

.right-column::-webkit-scrollbar {
  width: 6px;
}

.right-column::-webkit-scrollbar-thumb {
  background-color: var(--bs-primary);
  border-radius: 3px;
}

/* Right column header styles */
.header-container {
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--bs-primary);
  padding-bottom: 0.5rem;
}

.header-container h5 {
  margin: 0;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
}

.header-container h5 i {
  margin-right: 0.5rem;
}

/* Close button styles */
.close-right-column {
  background: none;
  border: none;
  color: var(--bs-secondary);
  font-size: 1.2rem;
  padding: 0;
  margin-left: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.close-right-column:hover {
  color: var(--bs-primary);
}

/* Tab navigation */
.friend-tabs {
  display: flex;
  border-bottom: 1px solid var(--bs-light-border-subtle);
  margin-bottom: 1.25rem;
}

.friend-tab {
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 500;
  color: var(--bs-secondary-text-emphasis);
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.friend-tab.active {
  color: var(--bs-primary);
  border-bottom-color: var(--bs-primary);
}

.friend-tab:hover:not(.active) {
  color: var(--bs-primary-text-emphasis);
  background-color: var(--bs-primary-bg-subtle);
}

.friend-tab-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: var(--bs-danger);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Search container */
.friend-search-container {
  margin-bottom: 1.5rem;
  position: relative;
}

.friend-search-container .form-control {
  border-radius: 1.25rem;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border: 1px solid var(--bs-light-border-subtle);
  box-shadow: none;
  transition: all 0.2s ease;
}

.friend-search-container .form-control:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.friend-search-container::before {
  content: "\f002";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bs-secondary);
  z-index: 1;
}

/* Friends list container */
.friends-list-container {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--bs-primary) transparent;
}

.friends-list-container::-webkit-scrollbar {
  width: 4px;
}

.friends-list-container::-webkit-scrollbar-thumb {
  background-color: var(--bs-primary);
  border-radius: 2px;
}

/* Friend item */
.friend-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  margin-bottom: 0.5rem;
  position: relative;
}

.friend-item:hover {
  background-color: var(--bs-primary-bg-subtle);
  transform: translateX(3px);
}

.friend-item:last-child {
  margin-bottom: 0;
}

.friend-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 0.75rem;
  border: 2px solid var(--bs-primary);
  flex-shrink: 0;
}

.friend-info {
  flex-grow: 1;
  min-width: 0;
}

.friend-name {
  font-weight: 500;
  color: var(--bs-body-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-id {
  font-size: 0.75rem;
  color: var(--bs-secondary-text-emphasis);
}

.friend-status {
  margin-left: 0.5rem;
  font-size: 0.9rem;
}

.friend-status .online {
  color: var(--bs-success);
}

.friend-status .offline {
  color: var(--bs-secondary);
}

/* Friend request actions */
.friend-request-actions {
  display: flex;
  gap: 0.5rem;
}

.friend-request-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.friend-request-btn.accept {
  background-color: var(--bs-success);
  color: white;
}

.friend-request-btn.reject {
  background-color: var(--bs-danger);
  color: white;
}

.friend-request-btn:hover {
  transform: scale(1.1);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 1.5rem;
  color: var(--bs-secondary-text-emphasis);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--bs-secondary);
}

.empty-state p {
  margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .right-column {
    padding: 1rem;
  }

  .friend-item {
    padding: 0.5rem;
  }

  .friend-avatar {
    width: 36px;
    height: 36px;
  }

  .close-right-column.show {
    display: flex !important;
  }
}

@media (max-width: 576px) {
  .friend-tabs {
    justify-content: space-between;
  }

  .friend-tab {
    flex-grow: 1;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
  }
}

/* === Mobile Layout Adjustments (768px and DOWN) === */
@media (max-width: 768px) {
  /* Apply adjustments ONLY to the index page */
  .page-index .left-column {
    flex: 0 0 30% !important;
    max-width: 30% !important;
  }

  .page-index .main-content {
    flex: 0 0 70% !important;
    max-width: 70% !important;
    width: 70% !important;
    margin-left: 30% !important;
    margin-right: 0 !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Right Column Slide-out Menu */
  .right-column,
  .page-index .right-column {
    visibility: hidden; /* Use visibility instead of display none */
    position: fixed !important;
    top: 0 !important;
    padding-top: 56px !important;
    right: -300px !important;
    width: 40% !important;
    height: 100vh !important;
    z-index: 1050 !important;
    transition: all 0.3s ease !important;
    overflow-y: auto !important;
    background-color: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    /* Add flex and max-width overrides with !important */
    flex: 0 0 40% !important;
    max-width: 40% !important;
  }

  .right-column.mobile-visible,
  .page-index .right-column.mobile-visible {
    visibility: visible;
    right: 0 !important;
  }

  /* Close button for right column */
  .close-right-column {
    position: fixed !important; /* Changed from static to fixed */
    top: 54px !important;
    right: 20px !important;
    font-size: 1.5rem !important;
    line-height: 1 !important;
    cursor: pointer !important;
    color: var(--bs-secondary-text-emphasis) !important;
    display: none !important;
  }

  .close-right-column.show {
    display: block !important;
  }

  /* Adjust Friends title (h5) in right column for tablet */
  .right-column .header-container h5,
  .page-index .right-column .header-container h5 {
    /* width: 100% is inherited from general .header-container h5 */
    padding-right: 50px !important; /* Space for the X button */
    box-sizing: border-box !important;
  }

  /* Body overlay when right column is open */
  body.right-column-open::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1045;
  }

  /* Ensure group page layout is NOT affected by index tablet styles */
  .page-group .left-column {
    flex: 0 0 30%;
    max-width: 30%;
  }
  .page-group .main-column {
    margin-left: 30%;
    width: 70%;
  }
}

/* === Mobile Layout Adjustments (425px and DOWN) === */
@media (max-width: 425px) {
  /* Main Content Area (Full Width) */
  .main-content,
  .page-index .main-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 1rem !important;
    padding-bottom: 80px !important; /* Space for mobile nav */
    flex: 0 0 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow-x: hidden !important;
  }

  /* Mobile Navigation Bar */
  .mobile-nav {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1040;
    padding: 10px 0;
  }

  .mobile-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
    padding: 0 10px;
  }

  .mobile-nav a {
    color: var(--bs-secondary-text-emphasis);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8rem;
    padding: 5px 10px;
  }

  .mobile-nav a i {
    font-size: 1.2rem;
    margin-bottom: 4px;
  }

  .mobile-nav a:hover {
    color: var(--bs-primary);
  }

  .mobile-nav a.active {
    color: var(--bs-primary);
  }

  /* Body Adjustments for Mobile Nav */
  body {
    padding-bottom: 70px !important; /* Space for mobile nav */
    padding-top: 56px; /* Space for top navbar */
    overflow-x: hidden !important;
    width: 100% !important;
  }

  /* Container adjustments */
  .container-fluid {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Right column specific mobile adjustments */
  .right-column,
  .page-index .right-column {
    position: fixed !important;
    top: 0 !important;
    padding-top: 56px !important;
    width: 70% !important;
    height: 100vh !important;
    right: -70% !important;
    transform: translateX(0) !important;
    transition: right 0.3s ease !important;
    z-index: 1050 !important;
    background-color: #fff !important;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    overflow-y: auto !important;
    padding: 1rem !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 0 0 70% !important;
    max-width: 70% !important;
  }

  .right-column.mobile-visible,
  .page-index .right-column.mobile-visible {
    right: 0 !important;
  }

  /* Right column content styles */
  .right-column h5,
  .page-index .right-column h5 {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: var(--bs-primary-text-emphasis) !important;
    margin-bottom: 1.5rem !important;
    padding-bottom: 0.75rem !important;
    border-bottom: 2px solid var(--bs-primary-bg-subtle) !important;
    display: flex !important;
    align-items: center !important; /* Keep items vertically centered */
    justify-content: flex-start !important; /* Align icon and text to the left */
    position: relative !important;
  }

  .right-column .friend-tabs,
  .page-index .right-column .friend-tabs {
    display: flex !important;
    border-bottom: 1px solid var(--bs-light-border-subtle) !important;
    margin-bottom: 1.25rem !important;
  }

  .right-column .friend-tab,
  .page-index .right-column .friend-tab {
    padding: 0.5rem 1rem !important;
    cursor: pointer !important;
    font-weight: 500 !important;
    color: var(--bs-secondary-text-emphasis) !important;
    border-bottom: 3px solid transparent !important;
    transition: all 0.2s ease !important;
    position: relative !important;
  }

  .right-column .friend-item,
  .page-index .right-column .friend-item {
    display: flex !important;
    align-items: center !important;
    padding: 0.75rem !important;
    border-radius: 0.5rem !important;
    transition: all 0.2s ease !important;
    margin-bottom: 0.5rem !important;
    background-color: var(--bs-light) !important;
  }

  .right-column.mobile-visible,
  .page-index .right-column.mobile-visible {
    right: 0 !important;
  }

  /* Empty state styles */
  .right-column .empty-state,
  .page-index .right-column .empty-state {
    text-align: center !important;
    padding: 1.5rem !important;
    color: var(--bs-secondary-text-emphasis) !important;
    background-color: var(--bs-light) !important;
    border-radius: 0.5rem !important;
    margin: 1rem 0 !important;
  }

  .right-column .empty-state i,
  .page-index .right-column .empty-state i {
    font-size: 2rem !important;
    margin-bottom: 1rem !important;
    color: var(--bs-secondary) !important;
    display: block !important;
  }

  /* Friend search container */
  .right-column .friend-search-container,
  .page-index .right-column .friend-search-container {
    margin-bottom: 1.5rem !important;
    position: relative !important;
    display: block !important;
  }

  .right-column .friend-search-container input,
  .page-index .right-column .friend-search-container input {
    width: 100% !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.25rem !important;
    border: 1px solid var(--bs-border-color) !important;
  }

  /* Friends list container visibility fix */
  .right-column .friends-list-container.d-none,
  .page-index .right-column .friends-list-container.d-none {
    display: none !important;
    visibility: hidden !important;
  }

  .right-column .friends-list-container,
  .page-index .right-column .friends-list-container {
    overflow-y: auto !important;
    max-height: calc(100vh - 250px) !important;
    padding-right: 5px !important;
    display: block !important;
    visibility: visible !important;
    background-color: #fff !important;
  }

  /* Friend search container visibility fix */
  .right-column .friend-search-container.d-none,
  .page-index .right-column .friend-search-container.d-none {
    display: none !important;
    visibility: hidden !important;
  }

  /* Left Column Handling */
  .left-column,
  .page-index .left-column {
    position: fixed !important;
    top: 0 !important;
    padding-top: 56px;
    left: 0 !important;
    width: 85% !important;
    max-width: 300px !important;
    height: 100vh !important;
    z-index: 1050 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s ease !important;
    overflow-y: auto !important;
    background-color: #fff;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    border-radius: 0;
  }

  .left-column.mobile-visible,
  .page-index .left-column.mobile-visible {
    transform: translateX(0) !important;
  }

  /* Close button styling */
  .close-left-column {
    display: block !important;
    position: absolute;

    right: 15px;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    z-index: 1051;
    color: var(--bs-secondary-text-emphasis);
  }

  /* Ensure no horizontal scroll */
  html,
  body {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* Close button for right column */
  .close-right-column {
    position: fixed !important;
    top: 52px !important;
    right: 20px !important;
    font-size: 1.8rem !important;
    line-height: 1 !important;
    cursor: pointer !important;
    z-index: 1051 !important;
    color: var(--bs-secondary-text-emphasis) !important;
    display: none !important;
  }

  .close-right-column.show {
    display: block !important;
  }

  /* Overlay when right column is open */
  body.right-column-open::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1045;
  }

  /* Active tab styling */
  .right-column .friend-tab.active,
  .page-index .right-column .friend-tab.active {
    color: var(--bs-primary) !important;
    border-bottom-color: var(--bs-primary) !important;
  }

  /* Friend item hover effect */
  .right-column .friend-item:hover,
  .page-index .right-column .friend-item:hover {
    background-color: var(--bs-primary-bg-subtle) !important;
    transform: translateX(3px) !important;
  }

  /* Header container styles */
  .header-container {
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1030;
  }

  .header-container h5 {
    font-size: 1rem;
  }

  .close-right-column {
    padding: 4px;
    margin-left: 8px;
  }

  .page-group .left-column {
    flex: 0 0 30%;
    max-width: 30%;
  }
  .page-group .main-column {
    margin-left: 0%;
    width: 100%;
  }
}

/* === Navbar styles === */
.navbar-custom {
  background-color: var(--bs-primary-bg-subtle);
  padding-left: 5%;
  padding-right: 5%;
  padding-top: 10px;
  padding-bottom: 10px;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1040; /* Above fixed columns, below modal backdrops */
  border-bottom: 1px solid var(--bs-primary-border-subtle);
  font-size: 1.1rem;
  height: auto;
}
.navbar-brand {
  font-size: 1.6rem !important;
  font-weight: 600;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  line-height: 1.2;
  color: var(--bs-primary-text-emphasis);
}
.navbar-brand:hover {
  color: color-mix(in srgb, var(--bs-primary-text-emphasis) 80%, black);
}
.nav-left {
  flex: 1;
  min-width: 30%;
  display: flex;
  align-items: center;
}
.nav-middle {
  flex: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}
.nav-middle a {
  color: var(--bs-primary-text-emphasis);
  text-decoration: none;
  padding: 10px 15px;
  transition: background-color 0.3s, border-radius 0.3s;
}
.nav-middle a:hover {
  background-color: var(--bs-primary-border-subtle);
  border-radius: 10px;
}
.nav-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.navbar-custom .nav-right .nav-link,
.navbar-custom .nav-right .dropdown-toggle {
  padding: 0.5rem 0.8rem;
  color: var(--bs-primary-text-emphasis);
}
.navbar-custom .nav-right .nav-link:hover,
.navbar-custom .nav-right .dropdown-toggle:hover {
  color: color-mix(in srgb, var(--bs-primary-text-emphasis) 80%, black);
}
.navbar-custom .nav-right .btn {
  white-space: nowrap; /* Prevent icon and text from wrapping onto separate lines */
}

.notification-icon {
  font-size: 1.25rem;
  margin-right: 15px;
  color: var(--bs-primary-text-emphasis);
}
.notification-icon:hover {
  color: color-mix(in srgb, var(--bs-primary-text-emphasis) 80%, black);
}
/* === End of Navbar styles === */

/* --- Modal Styles & Overrides --- */
.modal-footer .btn-primary {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: var(--bs-primary-text-emphasis);
  border-radius: 1rem;
}
.modal-footer .btn-primary:hover {
  background-color: color-mix(in srgb, var(--bs-primary) 85%, black);
  border-color: color-mix(in srgb, var(--bs-primary) 80%, black);
}
.modal-footer .btn-secondary {
  background-color: var(--bs-secondary);
  border-color: var(--bs-secondary);
  color: var(--bs-secondary-text-emphasis);
  border-radius: 1rem;
}
.modal-footer .btn-secondary:hover {
  background-color: color-mix(in srgb, var(--bs-secondary) 85%, black);
  border-color: color-mix(in srgb, var(--bs-secondary) 80%, black);
}

/* --- Post/Card Specific Styles (If used on index.php) --- */
.card .badge.bg-success {
  background-color: var(--bs-success) !important;
  color: var(--bs-success-text-emphasis) !important;
}
.card .badge.bg-secondary {
  background-color: var(--bs-secondary) !important;
  color: var(--bs-secondary-text-emphasis) !important;
}
.card .btn-light {
  color: var(--bs-secondary-text-emphasis);
  background-color: var(--bs-light-bg-subtle);
  border-color: var(--bs-light-border-subtle);
  border-radius: 0.5rem;
}
.card .btn-light:hover {
  background-color: var(--bs-secondary-bg-subtle);
  border-color: var(--bs-secondary-border-subtle);
}
.card .btn-light .text-danger {
  color: var(--bs-danger) !important;
}
.card .btn-light .text-secondary {
  color: var(--bs-secondary-text-emphasis) !important;
}

/* Fixed size for post images */
.post-image-fixed {
  width: 300px;
  height: 200px;
  object-fit: cover;
  border-radius: 0.375rem; /* same as rounded corners */
  margin-bottom: 1rem;
}

.toast {
  visibility: hidden;
  min-width: 200px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 5px;
  padding: 12px 20px;
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.5s, visibility 0.5s;
}

.toast.show {
  visibility: visible;
  opacity: 1;
}

/* Tablet view adjustments */
@media (min-width: 426px) and (max-width: 768px) {
  .right-column,
  .page-index .right-column {
    position: fixed !important;
    top: 0 !important;
    padding-top: 56px !important;
    width: 40% !important;
    height: 100vh !important;
    right: -300px !important;
    transform: translateX(0) !important;
    transition: right 0.3s ease !important;
    z-index: 1050 !important;
    background-color: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    overflow-y: auto !important;
  }

  .right-column.mobile-visible,
  .page-index .right-column.mobile-visible {
    right: 0 !important;
  }
}
