/* ===== VARIABLES ===== */
:root {
  /* Brand palette - derived from the logo (navy blue -> near-black on
     white). Replaces flat black/grey with the logo's navy + blue so the
     UI feels warmer while keeping high contrast for readability. */
  --primary: #283655;
  --secondary: #ffffff;
  --accent: #4a6fa5;
  --accent-light: #eef2f8;
  --brand-gradient: linear-gradient(135deg, #4a6fa5 0%, #283655 55%, #0b0c10 100%);
  --light-gray: #f8f9fa;
  --medium-gray: #e9ecef;
  --dark-gray: #6c757d;
  --text-light: #6c757d;
  --success: #1e7e34;
  --warning: #cc8400;
  --error: #dc3545;
  --info: #17a2b8;
  --card-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ===== RESET & BASE STYLES ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--light-gray);
  color: var(--primary);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  padding: 20px;
}

.container {
  background: var(--secondary);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  margin: 0 auto;
  max-width: 1200px;
  overflow: hidden;
  padding: 0 20px;
  width: 100%;
}

/* ===== HEADER STYLES ===== */
.header {
  background: var(--secondary);
  border-bottom: 1px solid var(--medium-gray);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

/* The shared .container clips overflow for its rounded corners, which
   would hide the absolutely-positioned user menu dropdown. */
.header .container {
  overflow: visible;
}

.header-content {
  align-items: center;
  display: flex;
  height: 70px;
  justify-content: space-between;
  padding: 1rem 0;
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--brand-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(40, 54, 85, 0.35);
}

.logo h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
}

.user-menu {
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  position: relative;
  transition: var(--transition);
}

.user-menu:hover,
.user-menu.open {
  background: var(--light-gray);
}

.user-avatar {
  align-items: center;
  background: var(--primary);
  border-radius: 50%;
  color: var(--secondary);
  display: flex;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 600;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.user-menu-caret {
  font-size: 0.75rem;
  color: var(--text-light);
  transition: transform 0.2s ease;
}

.user-menu.open .user-menu-caret {
  transform: rotate(180deg);
}

/* Hide the username on small screens so the header has more breathing
   room - it's still shown inside the dropdown menu. */
@media (max-width: 480px) {
  .user-name {
    display: none;
  }
}

.user-menu-dropdown {
  background: var(--secondary);
  border: 1px solid var(--medium-gray);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  display: none;
  min-width: 160px;
  overflow: hidden;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 1100;
}

.user-menu-dropdown.show {
  display: block;
}

.user-menu-item {
  align-items: center;
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  font-size: 0.9rem;
  gap: 10px;
  padding: 0.75rem 1rem;
  text-align: left;
  transition: var(--transition);
  width: 100%;
}

.user-menu-item:hover {
  background: var(--light-gray);
}

.user-menu-item-danger {
  color: var(--error);
}

/* ===== NOTIFICATION DROPDOWN ===== */
.notification-menu {
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  height: 36px;
  justify-content: center;
  position: relative;
  transition: var(--transition);
  width: 36px;
}

.notification-menu:hover,
.notification-menu.open {
  background: var(--light-gray);
}

.notification-menu i {
  color: var(--primary);
  font-size: 1.1rem;
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
}

.notification-dropdown {
  background: var(--secondary);
  border: 1px solid var(--medium-gray);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  display: none;
  flex-direction: column;
  width: 320px;
  max-width: 90vw;
  max-height: 400px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 1100;
}

.notification-dropdown.show {
  display: flex;
}

.notification-dropdown-header {
  align-items: center;
  border-bottom: 1px solid var(--medium-gray);
  color: var(--primary);
  display: flex;
  font-weight: 600;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

.notification-mark-all {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
}

.notification-mark-all:hover {
  color: var(--primary);
}

.notification-list {
  overflow-y: auto;
}

.notification-item {
  align-items: flex-start;
  border-bottom: 1px solid var(--light-gray);
  cursor: pointer;
  display: flex;
  gap: 10px;
  padding: 0.75rem 1rem;
  transition: var(--transition);
}

.notification-item:hover {
  background: var(--light-gray);
}

.notification-item.unread {
  background: #f5f8ff;
}

.notification-item.unread::before {
  background: var(--primary);
  border-radius: 50%;
  content: '';
  flex-shrink: 0;
  height: 8px;
  margin-top: 6px;
  width: 8px;
}

.notification-item-icon {
  align-items: center;
  color: var(--primary);
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  width: 24px;
}

.notification-item-content {
  flex: 1;
  min-width: 0;
}

.notification-item-title {
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
}

.notification-item-message {
  color: var(--text-light);
  font-size: 0.8rem;
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-item-time {
  color: var(--text-light);
  font-size: 0.7rem;
  margin-top: 4px;
}

.notification-empty {
  color: var(--text-light);
  font-size: 0.85rem;
  padding: 1.5rem 1rem;
  text-align: center;
}

/* ===== NAVIGATION STYLES ===== */
.main-nav {
  background: var(--secondary);
  border-bottom: 1px solid var(--medium-gray);
  position: sticky;
  top: 70px;
  z-index: 999; /* Lower than header and dropdown */
}

.main-nav .container {
  position: relative;
}

.nav-tabs {
  display: flex;
  overflow-x: auto;
  padding: 0;
  gap: 0;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

/* Fade hints that appear when the tab bar has more tabs to scroll to,
   so swipeable navigation isn't hidden on small screens. */
.nav-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-light);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.nav-fade-left {
  left: 20px;
  justify-content: flex-start;
  background: linear-gradient(to right, var(--secondary) 50%, transparent);
}

.nav-fade-right {
  right: 20px;
  justify-content: flex-end;
  background: linear-gradient(to left, var(--secondary) 50%, transparent);
}

.nav-fade.is-visible {
  opacity: 1;
}

.nav-tab {
  align-items: center;
  background: none;
  border-bottom: 3px solid transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  font-size: 0.9rem;
  font-weight: 500;
  gap: 8px;
  padding: 1rem 1.2rem;
  position: relative;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--primary);
  background: var(--light-gray);
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--light-gray);
}

.nav-tab i {
  font-size: 1.2rem;
}

.nav-badge {
  background: var(--error);
  color: var(--secondary);
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  min-height: calc(100vh - 140px);
  padding: 2rem 0;
  background: var(--light-gray);
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}

.tab-content.active {
  display: block;
  opacity: 1;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== CARD STYLES ===== */
.card {
  background: var(--secondary);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--medium-gray);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--medium-gray);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--secondary);
}

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

.card-body {
  opacity: 1 !important;
  padding: 1.5rem;
}

/* ===== BUTTON STYLES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: var(--secondary);
  border: 1px solid var(--primary);
}

.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--medium-gray);
  color: var(--primary);
  border: 1px solid var(--medium-gray);
}

.btn-secondary:hover {
  background: var(--dark-gray);
  color: var(--secondary);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--secondary);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 0.5rem;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-light);
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--light-gray);
  color: var(--primary);
}

/* ===== FORM STYLES ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--primary);
  font-size: 0.9rem;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--medium-gray);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: var(--transition);
  background: var(--secondary);
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 1rem center;
  background-repeat: no-repeat;
  background-size: 16px;
}

/* ===== DASHBOARD STYLES ===== */
.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.tab-header h2 {
  align-items: center;
  display: flex;
  font-size: 1.8rem;
  font-weight: 700;
  gap: 10px;
  color: var(--primary);
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 30px;
  margin-bottom: 30px;
  min-height: 500px;
}

.stats-column, .calendar-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Welcome Card - FIXED TEXT COLOR */
.welcome-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: var(--secondary);
  border: none;
}

.welcome-card h3,
.welcome-card p,
.welcome-stat span,
.welcome-stat small {
  color: var(--secondary) !important;
}

.welcome-content h3 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.welcome-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.welcome-stat {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  min-width: 0;
}

.welcome-stat i {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.9;
  color: var(--secondary);
}

.welcome-stat span {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.welcome-stat small {
  opacity: 0.8;
  font-size: 0.8rem;
}

/* ===== STREAK MILESTONE BADGE ===== */
.welcome-stat .streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.welcome-stat .streak-badge i,
.welcome-stat .streak-badge span {
  display: inline;
  font-size: 0.7rem;
  font-weight: 700;
  margin: 0;
  opacity: 1;
}

.welcome-stat .streak-badge.streak-7 {
  background: rgba(255, 152, 0, 0.25);
  color: #ffb74d;
}

.welcome-stat .streak-badge.streak-30 {
  background: rgba(76, 175, 80, 0.25);
  color: #81c784;
}

.welcome-stat .streak-badge.streak-100 {
  background: rgba(255, 215, 0, 0.25);
  color: #ffd700;
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.4);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-card {
  align-items: center;
  border-radius: 8px;
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  transition: var(--transition);
  border-left: 4px solid transparent;
  min-width: 0;
}

.stat-info {
  min-width: 0;
}

.stat-card:hover {
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.stat-card.primary {
  background: var(--accent-light);
  border-left-color: var(--primary);
}

.stat-card.success {
  background: #e8f5e8;
  border-left-color: var(--success);
}

.stat-card.warning {
  background: #fff3e0;
  border-left-color: var(--warning);
}

.stat-card.info {
  background: #e3f2fd;
  border-left-color: var(--info);
}

.stat-icon {
  align-items: center;
  border-radius: 50%;
  color: var(--secondary);
  display: flex;
  font-size: 1.3rem;
  height: 50px;
  justify-content: center;
  width: 50px;
}

.stat-card.primary .stat-icon {
  background: var(--primary);
}

.stat-card.success .stat-icon {
  background: var(--success);
}

.stat-card.warning .stat-icon {
  background: var(--warning);
}

.stat-card.info .stat-icon {
  background: var(--info);
}

.stat-info h3 {
  color: var(--primary);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.stat-info p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.stat-info small {
  font-size: 0.8rem;
  font-weight: 500;
}

.stat-info small.positive {
  color: var(--success);
}

.stat-info small.negative {
  color: var(--error);
}

@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .tab-header {
    flex-direction: column;
    align-items: stretch;
  }

  .date-filter {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }

  .date-filter .form-select {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 0;
  }

  .date-filter #fastTypeFilter {
    flex: 1 1 100%;
  }
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.quick-action {
  align-items: center;
  background: var(--secondary);
  border-radius: 8px;
  border: 1px solid var(--medium-gray);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 1rem;
  text-align: center;
  transition: var(--transition);
}

.quick-action:hover {
  background: var(--light-gray);
  border-color: var(--primary);
  box-shadow: var(--card-shadow);
  transform: translateY(-2px);
}

.quick-action i {
  color: var(--primary);
  font-size: 1.5rem;
}

.quick-action span {
  font-weight: 500;
  font-size: 0.9rem;
}

/* Calendar Styles */
.calendar {
  background: var(--secondary);
  border-radius: 12px;
  border: 1px solid var(--medium-gray);
  overflow: hidden;
}

.calendar-header {
  background: var(--primary);
  color: var(--secondary);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-header div {
  font-size: 0.8rem;
  padding: 1rem 0.5rem;
  text-align: center;
  font-weight: 600;
}

.calendar-days {
  background: var(--medium-gray);
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
  align-items: center;
  aspect-ratio: 1;
  background: var(--secondary);
  border: 1px solid var(--light-gray);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.5rem;
  position: relative;
  transition: var(--transition);
}

.calendar-day:hover {
  background: var(--light-gray);
}

.calendar-day.fasting-day {
  background: var(--accent-light);
  color: var(--primary);
  font-weight: 600;
}

.calendar-day.prayer-day {
  background: #e8f5e8;
  color: var(--success);
}

.calendar-day.today {
  background: var(--primary);
  color: var(--secondary);
}

.calendar-day.empty {
  background: var(--light-gray);
  cursor: default;
}

.calendar-day.empty:hover {
  background: var(--light-gray);
}

.day-number {
  font-size: 0.9rem;
  font-weight: 500;
}

.day-events {
  position: absolute;
  bottom: 4px;
  display: flex;
  gap: 2px;
}

.event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.calendar-controls {
  display: flex;
  gap: 10px;
}

.calendar-controls button {
  background: var(--secondary);
  border-radius: 6px;
  border: 1px solid var(--medium-gray);
  cursor: pointer;
  padding: 5px 10px;
  transition: var(--transition);
}

.calendar-controls button:hover {
  background: var(--light-gray);
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.legend-item {
  align-items: center;
  color: var(--text-light);
  display: flex;
  font-size: 0.8rem;
  gap: 5px;
}

.legend-color {
  border-radius: 2px;
  height: 12px;
  width: 12px;
}

.legend-color.fasting-day {
  background: var(--accent-light);
}

.legend-color.prayer-day {
  background: #e8f5e8;
}

.legend-color.today {
  background: var(--primary);
}

/* ===== CHAT STYLES - COMPLETELY UPDATED FOR WHATSAPP ===== */
.chat-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  height: 70vh;
  min-height: 500px;
}

.chat-sidebar {
  background: var(--secondary);
  border: 1px solid var(--medium-gray);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-search {
  padding: 1rem;
  border-bottom: 1px solid var(--medium-gray);
}

.chat-search input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--medium-gray);
  border-radius: 6px;
  font-size: 0.9rem;
}

.chat-search input:focus {
  outline: none;
  border-color: var(--primary);
}

.groups-section {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 45%;
}

.online-users {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.groups-section h3, .online-users h4 {
  padding: 1rem;
  margin: 0;
  background: var(--light-gray);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 1px solid var(--medium-gray);
}

.groups-list {
  flex: 0 1 auto;
  overflow-y: auto;
  padding: 0.5rem;
}

.users-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  min-height: 0;
}

.group-item, .user-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 0;
}

.group-item:hover, .user-item:hover {
  background: #f5f5f5;
}

.group-item.active, .user-item.active {
  background: #e9edef;
}

.group-avatar, .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #dfe5e7;
  color: #54656f;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.group-item.active .group-avatar, 
.user-item.active .user-avatar {
  background: #00a884;
  color: white;
}

.user-avatar.online {
  position: relative;
}

.user-avatar.online::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #00a884;
  border: 2px solid white;
  border-radius: 50%;
}

.group-info, .user-info {
  flex: 1;
  min-width: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.group-info h4, .user-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-meta, .user-status {
  font-size: 0.75rem;
  color: var(--text-light);
}

.user-info .user-status.online {
  color: #00a884;
}

.unread-badge, .unread-indicator {
  background: var(--error);
  color: var(--secondary);
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

.unread-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: auto;
}

/* WhatsApp Main Chat Area */
.chat-main {
  background: #e5ddd5;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23000000' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
  border: 1px solid var(--medium-gray);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: #f0f0f0;
  border-bottom: 1px solid #e0e0e0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.chat-header-info {
  flex: 1;
  margin-left: 10px;
  min-width: 0;
}

.chat-header-info h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 2px 0;
  color: #303030;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-info .online-count,
.chat-header-info .user-status {
  font-size: 13px;
  color: #667781;
  margin: 0;
}

.user-status.online {
  color: #00a884;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #e5ddd5;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23000000' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* WhatsApp Message Styles - COMPLETELY REPLACED */
.message {
  display: flex;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
  align-items: flex-start;
  margin-bottom: 8px;
}

.own-message {
  align-self: flex-end;
  margin-left: auto;
  flex-direction: row-reverse;
}

.other-message {
  align-self: flex-start;
  margin-right: auto;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--medium-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 0.8rem;
  flex-shrink: 0;
  margin: 0 8px;
}

.own-message .message-avatar {
  background: var(--primary);
  color: var(--secondary);
  margin-left: 8px;
  margin-right: 0;
}

.message-content {
  display: flex;
  flex-direction: column;
  max-width: calc(100% - 44px);
  min-width: 0;
}

.message-text {
  border-radius: 7.5px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  max-width: 100%;
  min-width: 60px;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.other-message .message-text {
  background: #ffffff;
  color: #303030;
  border-radius: 7.5px 7.5px 7.5px 0;
}

.own-message .message-text {
  background: #dcf8c6;
  color: #303030;
  border-radius: 7.5px 7.5px 0 7.5px;
}

.message-time {
  font-size: 0.65rem;
  color: #667781;
  margin-top: 4px;
  display: block;
  align-self: flex-end;
}

.own-message .message-time {
  color: #8696a0;
  text-align: right;
}

/* @mentions inside messages */
.message-text .mention {
  background: rgba(0, 168, 132, 0.15);
  color: #00795f;
  border-radius: 4px;
  padding: 0 3px;
  font-weight: 600;
}

.own-message .message-text .mention {
  background: rgba(0, 0, 0, 0.08);
  color: #00795f;
}

/* Sticker messages - big emoji, no bubble */
.message-text.sticker-message {
  background: transparent !important;
  box-shadow: none;
  padding: 0;
  font-size: 2.5rem;
  line-height: 1;
}

/* Chat input - WhatsApp style */
.chat-input-container {
  background: #f0f0f0;
  padding: 10px 16px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  align-items: flex-end; /* Align items to bottom */
  gap: 10px;
  min-height: 62px; /* Ensure minimum height */
}

#messageInput {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 21px;
  padding: 9px 16px;
  font-size: 15px;
  flex: 1;
  resize: none; /* Prevent manual resizing */
  min-height: 42px; /* Minimum height */
  max-height: 84px; /* Maximum height for ~3 lines */
  line-height: 1.4;
  overflow-y: auto; /* Show scrollbar when needed */
  font-family: inherit;
}

#messageInput:focus {
  border-color: #00a884;
  box-shadow: 0 0 0 1px #00a884;
  outline: none;
}

#sendMessage {
  background: #00a884;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex !important; /* Force display */
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
  flex-shrink: 0; /* Prevent button from shrinking */
  visibility: visible !important; /* Force visibility */
  opacity: 1 !important; /* Force opacity */
}

#sendMessage:hover {
  background: #008f70;
}

#sendMessage i {
  font-size: 18px;
}

/* Ensure the button is never hidden */
#sendMessage[style*="display: none"] {
  display: flex !important;
}

#sendMessage[style*="visibility: hidden"] {
  visibility: visible !important;
}

/* Make sure the chat input container doesn't hide elements */
.chat-input-container * {
  visibility: visible !important;
}

/* Emoji / sticker picker */
.emoji-picker-wrapper {
  position: relative;
  flex-shrink: 0;
}

.chat-icon-btn {
  background: transparent;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #54656f;
  font-size: 22px;
  cursor: pointer;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.chat-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.emoji-picker {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 280px;
  max-width: 90vw;
  background: var(--secondary);
  border: 1px solid var(--medium-gray);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  z-index: 50;
  overflow: hidden;
}

.emoji-picker.active {
  display: block;
}

.emoji-picker-tabs {
  display: flex;
  border-bottom: 1px solid var(--medium-gray);
}

.emoji-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.emoji-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.emoji-picker-body {
  max-height: 220px;
  overflow-y: auto;
  padding: 0.5rem;
}

.emoji-grid {
  display: none;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.emoji-grid.active {
  display: grid;
}

.emoji-grid button {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.emoji-grid button:hover {
  background: var(--light-gray);
}

.sticker-grid button {
  font-size: 1.8rem;
}

/* Message input + @mention dropdown */
.message-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
}

.mention-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  max-width: min(280px, 90vw);
  min-width: 200px;
  background: var(--secondary);
  border: 1px solid var(--medium-gray);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  max-height: 180px;
  overflow-y: auto;
  z-index: 50;
}

.mention-dropdown.active {
  display: block;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
}

.mention-item-avatar {
  color: var(--text-light);
}

.mention-item:hover,
.mention-item.highlighted {
  background: var(--light-gray);
}

.welcome-message, .no-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

.welcome-message i, .no-messages i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.welcome-message h3, .no-messages h3 {
  margin-bottom: 0.5rem;
  color: var(--primary);
  font-weight: 600;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .chat-container {
    grid-template-columns: 250px 1fr;
    height: 60vh;
  }
}

@media (max-width: 768px) {
  .chat-input-container {
    padding: 8px 12px;
  }
  
  #messageInput {
    min-height: 40px;
    max-height: 80px;
  }
  
  #sendMessage {
    width: 40px;
    height: 40px;
  }
  .chat-container {
    grid-template-columns: 1fr;
    height: 75vh;
    position: relative;
  }

  .chat-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: #ffffff;
    border-right: 1px solid var(--medium-gray);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 2000;
    overflow-y: auto;
  }

  .chat-sidebar.open {
    transform: translateX(0);
  }

  .chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: none;
    z-index: 1500;
  }

  .chat-overlay.active {
    display: block;
  }

  .mobile-only {
    display: inline-flex !important;
  }

  /* Keep toggle button visible in chat header */
  .chat-header .mobile-only {
    display: flex !important;
    background: transparent;
    border: none;
    color: #54656f;
    font-size: 18px;
    padding: 8px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
  }

  .chat-header .mobile-only:hover {
    background: rgba(0, 0, 0, 0.1);
  }

  /* Adjust message width for mobile */
  .message {
    max-width: 94%;
  }
}

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }

  .chat-overlay {
    display: none !important;
  }

  .message {
    max-width: 78%;
  }

  .message-avatar {
    width: 32px;
    height: 32px;
  }
}

/* PWA Install Modal */
.pwa-install-modal {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  max-width: 350px;
  background: var(--secondary, #fff);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  border: 1px solid var(--medium-gray, #ccc);
  animation: slideInUp 0.3s ease;
  font-family: inherit;
  overflow: hidden;
}

.pwa-install-modal .pwa-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--medium-gray, #ccc);
  background: var(--primary, #f8f9fa);
  color: #ffffff;
}

.pwa-install-modal .pwa-modal-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: bold;
}

.pwa-install-modal .pwa-close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--primary);
}

.pwa-install-modal .pwa-modal-body {
  padding: 1rem;
  font-size: 0.9rem;
}

.pwa-install-modal .pwa-modal-body ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.pwa-install-modal .pwa-modal-footer {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid var(--medium-gray, #ccc);
}

/* Fasting Tab */
.fasting-intro {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.fasting-subtabs .btn {
  flex: 1;
}

@media (max-width: 576px) {
  .fasting-subtabs .btn {
    font-size: 0.85rem;
    padding: 0.5rem 0.25rem;
  }
}

.fasting-plans-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .fasting-plans-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== JOURNAL TAB ===== */
.journal-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.journal-editor {
  animation: editorExpand 0.35s ease;
}

@keyframes editorExpand {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Formatting toolbar (shared by journal, prayers, resources, fasting, groups) */
.richtext-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.4rem;
  background: var(--light-gray);
  border: 1px solid var(--medium-gray);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.toolbar-btn:hover {
  background: var(--medium-gray);
  color: var(--primary);
}

.toolbar-btn.active {
  background: var(--primary);
  color: var(--secondary);
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  margin: 0 0.25rem;
  background: var(--medium-gray);
}

/* Rich text content editor (shared by journal, prayers, resources, fasting, groups) */
.richtext-content {
  min-height: 180px;
  max-height: 360px;
  overflow-y: auto;
  border-radius: 0 0 8px 8px;
  line-height: 1.6;
  cursor: text;
}

.richtext-content:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.richtext-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-light);
  pointer-events: none;
}

.richtext-content ul,
.richtext-content ol {
  margin: 0.5rem 0 0.5rem 1.5rem;
}

#saveJournalEntry {
  margin-right: 0.75rem;
}

/* Entries / list section headers (journal, prayers, resources, etc.) */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.section-header h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-controls .form-select {
  width: auto;
}

.filter-controls .form-control {
  min-width: 180px;
  width: auto;
}

.search-filter-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.search-filter-container .form-control,
.search-filter-container .form-select {
  width: auto;
}

.search-filter-container .form-control {
  min-width: 200px;
}

.entries-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.entries-list .no-data-message {
  grid-column: 1 / -1;
}

.journal-entry .card-body {
  padding: 1.25rem 1.5rem;
}

.entry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.entry-header h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  word-break: break-word;
}

.entry-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--text-light);
  font-size: 0.8rem;
}

.entry-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.entry-content {
  color: var(--accent);
  line-height: 1.6;
  word-break: break-word;
}

.entry-content ul,
.entry-content ol {
  margin: 0.5rem 0 0.5rem 1.5rem;
}

.entry-content .content-full {
  display: none;
}

.entry-content.expanded .content-preview {
  display: none;
}

.entry-content.expanded .content-full {
  display: block;
}

.entry-footer {
  margin-top: 0.75rem;
}

.no-data-message {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-light);
}

.no-data-message > i {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

@media (max-width: 992px) {
  .filter-controls .form-control {
    flex: 1;
  }
}

@media (max-width: 768px) {
  .entries-list {
    grid-template-columns: 1fr;
  }
}

/* ===== PRAYERS TAB ===== */
.prayers-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.prayer-editor {
  animation: editorExpand 0.35s ease;
}

.prayers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.prayers-grid .no-data-message {
  grid-column: 1 / -1;
}

.prayer-item .card-body {
  padding: 1.25rem 1.5rem;
}

.prayer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.prayer-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

.prayer-title h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  word-break: break-word;
  margin: 0;
}

.prayer-title .prayer-category {
  text-transform: capitalize;
  background: var(--light-gray);
  color: var(--accent);
}

.prayer-status {
  flex-shrink: 0;
}

.status-badge {
  text-transform: capitalize;
  background: var(--medium-gray);
  color: var(--accent) !important;
}

.prayer-status.answered .status-badge {
  background: var(--success);
  color: var(--secondary) !important;
}

.prayer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--text-light);
  font-size: 0.8rem;
}

.prayer-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.answered-date {
  color: var(--success);
}

.prayer-description {
  color: var(--accent);
  line-height: 1.6;
  word-break: break-word;
  margin-bottom: 1rem;
}

.prayer-description ul,
.prayer-description ol {
  margin: 0.5rem 0 0.5rem 1.5rem;
}

.prayer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.answered-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .prayers-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== FAST DETAILS MODAL ===== */
.fast-details-modal .modal-header {
  border-bottom: 1px solid var(--medium-gray);
}

.fast-details-modal .modal-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--primary);
}

.fast-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.fast-detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  background: var(--light-gray);
  color: var(--accent);
}

.fast-detail-badge.difficulty-beginner { background: rgba(40, 167, 69, 0.12); color: var(--success); }
.fast-detail-badge.difficulty-intermediate { background: rgba(255, 193, 7, 0.18); color: #997404; }
.fast-detail-badge.difficulty-advanced { background: rgba(220, 53, 69, 0.12); color: var(--error); }

.fast-detail-badge.status-active { background: rgba(40, 167, 69, 0.12); color: var(--success); }
.fast-detail-badge.status-completed { background: var(--primary); color: var(--secondary); }
.fast-detail-badge.status-paused { background: rgba(255, 193, 7, 0.18); color: #997404; }
.fast-detail-badge.status-cancelled { background: var(--medium-gray); color: var(--text-light); }

.fast-progress-wrap {
  margin-bottom: 1.5rem;
}

.fast-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.fast-progress-bar {
  height: 8px;
  background: var(--medium-gray);
  border-radius: 4px;
  overflow: hidden;
}

.fast-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.fast-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.fast-detail-stat {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem;
  background: var(--light-gray);
  border-radius: 8px;
}

.fast-detail-stat i {
  font-size: 1.1rem;
  color: var(--accent);
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.fast-detail-stat .stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fast-detail-stat .stat-value {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

.fast-detail-section {
  margin-top: 1.5rem;
}

.fast-detail-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.fast-detail-content {
  background: var(--light-gray);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  color: var(--accent);
  line-height: 1.6;
}

.linked-entries-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.linked-entry-card {
  background: var(--light-gray);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.linked-entry-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.linked-entry-content {
  font-size: 0.85rem;
  color: var(--accent);
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

.linked-entry-content ul,
.linked-entry-content ol {
  margin: 0.4rem 0 0.4rem 1.5rem;
}

.linked-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-light);
}

.linked-entry-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.linked-entry-answered {
  color: var(--success);
  font-weight: 600;
}

.fast-detail-empty {
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
  padding: 1rem 0;
}

/* ===== RESOURCES TAB ===== */
.resources-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.resources-grid .no-data-message {
  grid-column: 1 / -1;
}

.resource-item .card-body {
  padding: 1.25rem 1.5rem;
}

.resource-card-header {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.resource-author h6 {
  font-weight: 600;
  color: var(--primary);
}

.resource-author-avatar {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

.resource-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  word-break: break-word;
}

.resource-description {
  color: var(--accent);
  line-height: 1.6;
  word-break: break-word;
  margin-bottom: 0.75rem;
}

.resource-description ul,
.resource-description ol {
  margin: 0.5rem 0 0.5rem 1.5rem;
}

.resource-category-badge {
  text-transform: capitalize;
  background: var(--accent-light);
  color: var(--primary) !important;
  font-weight: 500;
}

.resource-card-footer {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.media-preview .document-placeholder {
  background: var(--accent-light) !important;
  border: 1px solid var(--medium-gray) !important;
}

.media-preview .document-placeholder i {
  color: var(--accent);
}

.like-btn.liked {
  background-color: var(--error);
  color: var(--secondary);
  border-color: var(--error);
}

@media (max-width: 768px) {
  .resources-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== PROFILE TAB ===== */
.profile-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.profile-header .card-body {
  background: var(--brand-gradient);
  color: var(--secondary);
  border-radius: 12px;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.profile-avatar {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}

.profile-avatar-img,
.profile-avatar-initials {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.6);
}

.profile-avatar-img {
  display: none;
  object-fit: cover;
}

/* Hidden file input for avatar upload. The tab-switcher in app.js clears
   inline display styles on every element when a tab activates, so the
   hiding rule must live in the stylesheet (not an inline style) to survive
   the reset. */
.visually-hidden-input {
  display: none;
}

.profile-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  color: var(--secondary);
  font-size: 2.5rem;
  font-weight: 700;
}

.profile-details {
  flex: 1;
  min-width: 0;
}

.profile-details h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--secondary);
  word-break: break-word;
}

.profile-details p {
  margin-bottom: 0.75rem;
  opacity: 0.9;
  word-break: break-word;
}

.profile-subscription-badge {
  text-transform: capitalize;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.profile-header .btn-outline {
  border-color: rgba(255, 255, 255, 0.6);
  color: var(--secondary);
}

.profile-header .btn-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--secondary);
  color: var(--secondary);
}

.profile-sections {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .profile-info {
    flex-direction: column;
    text-align: center;
  }

  .profile-sections {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .fast-detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== TAB HEADING / SUBTITLE (shared) ===== */
.tab-heading {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tab-subtitle {
  margin: 0;
  color: var(--text-light);
  font-size: 0.95rem;
}

/* ===== BIBLE TAB ===== */
.bible-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.bible-controls .card-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--primary);
}

.bible-content {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.1rem;
  line-height: 1.9;
  color: var(--primary);
}

.bible-content .welcome-message i,
.bible-content .loading-message i {
  color: var(--accent);
}

.chapter-header h3 {
  color: var(--primary);
  font-weight: 700;
}

.chapter-navigation .btn {
  min-height: 42px;
  font-weight: 600;
}

.verse-item {
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
}

.verse-text {
  user-select: text;
}

.verse-number {
  display: inline-block;
  min-width: 1.7em;
  margin-right: 0.4rem;
  font-weight: 700;
  font-size: 0.8em;
  color: var(--accent);
  vertical-align: super;
}

.highlight-hint {
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.highlight-hint i {
  color: var(--accent);
  margin-right: 0.3rem;
}

/* Highlighted text spans - soft tones chosen to keep the verse text
   (var(--primary)) easily readable on top. */
.text-highlight {
  border-radius: 3px;
  cursor: pointer;
  padding: 0.05em 0;
}

.text-highlight.highlight-yellow {
  background: #fff3b0;
}

.text-highlight.highlight-green {
  background: #c8e6c9;
}

.text-highlight.highlight-blue {
  background: #bbdefb;
}

.text-highlight.highlight-pink {
  background: #f8c9dc;
}

.text-highlight:hover {
  filter: brightness(0.97);
}

/* Highlight color picker popup - positioned via inline style (JS) in
   document coordinates so it scrolls with the page and always renders
   above surrounding verses regardless of stacking context. */
.highlight-menu {
  position: absolute;
  z-index: 1060;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--secondary);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  cursor: default;
}

.highlight-menu-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.highlight-swatches {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.highlight-swatch {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.highlight-swatch:hover {
  transform: scale(1.1);
}

.highlight-swatch.active {
  border-color: var(--primary);
}

.highlight-swatch-yellow {
  background: #fff3b0;
}

.highlight-swatch-green {
  background: #c8e6c9;
}

.highlight-swatch-blue {
  background: #bbdefb;
}

.highlight-swatch-pink {
  background: #f8c9dc;
}

.highlight-swatch-remove {
  background: var(--accent-light);
  color: var(--primary);
  font-size: 0.85rem;
}

/* ===== BIBLE: READ / MY HIGHLIGHTS VIEW SWITCH ===== */
.bible-view-switch {
  display: flex;
  gap: 0.5rem;
}

/* A highlight in the "My Highlights" list flashes briefly when jumped to
   from "Read in context", so the reader can find it among the verses. */
.verse-flash {
  animation: verse-flash-fade 2s ease-out;
}

@keyframes verse-flash-fade {
  from {
    background: var(--accent-light);
  }
  to {
    background: transparent;
  }
}

/* ===== BIBLE: MY HIGHLIGHTS LIST ===== */
.highlight-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.highlight-card-body {
  flex: 1;
  min-width: 0;
}

.highlight-reference {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.highlight-snippet {
  margin: 0;
  color: var(--text-light);
  line-height: 1.7;
}

.highlight-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .bible-content {
    font-size: 1.05rem;
    line-height: 1.85;
  }

  .chapter-header .d-flex {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem;
  }

  .chapter-navigation {
    display: flex;
    gap: 0.5rem;
  }

  .chapter-navigation .btn {
    flex: 1;
  }

  .highlight-menu {
    flex-wrap: wrap;
    max-width: calc(100vw - 3rem);
  }

  .highlight-swatch {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .highlight-card {
    flex-direction: column;
    align-items: stretch;
  }

  .highlight-card-actions {
    flex-direction: row;
  }

  .highlight-card-actions .btn {
    flex: 1;
  }

  .pending-request,
  .member-management-item {
    flex-direction: column;
    align-items: stretch !important;
  }

  .request-actions,
  .member-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
  }

  .request-actions .btn,
  .member-actions .btn {
    flex: 1;
  }
}

/* ===== SUBSCRIPTION GATE MODALS ===== */
/* Sit above any other floating UI (e.g. the PWA install prompt at z-index
   10000) so the gate truly blocks all interaction with the app. */
#trialExpiredModal,
#checkoutModal {
  z-index: 10600;
}

#trialExpiredModal .modal-body i.fa-hourglass-end {
  color: #ffb74d;
}

#checkoutModal .modal-body i.fa-credit-card {
  color: var(--primary-color, #4caf50);
}

#trialExpiredModal .d-grid .btn {
  white-space: normal;
}