/* Profile Page Custom Styles */

:root {
  --primary-color: #df314d;
  --primary-hover: #c72642;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-bg: #f8f9fa;
  --border-color: #e8ecf1;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
  --transition: all 0.3s ease;
}

/* Profile Cover */
.profile-cover {
  position: relative;
  overflow: hidden;
}

.profile-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.edit-photo {
  position: absolute;
  bottom: 20px;
  right: 20px;
}

.edit-photo .file-btn {
  background: rgba(255, 255, 255, 0.95);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.edit-photo .file-btn:hover {
  background: white;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Profile Information */
.profile-information {
  display: flex;
  align-items: flex-end;
  margin-top: -80px;
  padding: 0 30px 20px;
  position: relative;
  z-index: 1;
}

.profile-pic img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border: 4px solid white;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

/* Responsive Profile Picture Styling */
@media (max-width: 992px) {
  .profile-pic img {
    width: 180px;
    height: 180px;
  }
}

@media (max-width: 768px) {
  .profile-pic img {
    width: 150px;
    height: 150px;
  }
}

@media (max-width: 576px) {
  .profile-pic img {
    width: 120px;
    height: 120px;
  }
}
/* 
#profilePicDrop {
  width: 220px;
  height: 220px;
  border-radius: 12px;
  overflow: hidden;
  border: 4px solid white;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
} */

#profilePicDrop:hover {
  box-shadow: var(--shadow-lg);
}

#profilePicImg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#fileBtn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(223, 49, 77, 0.9);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

#fileBtn:hover {
  background: var(--primary-color);
  transform: scale(1.1);
}

#fileBtn i {
  color: white;
  font-size: 24px;
}

#dragOverlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(223, 49, 77, 0.9);
  color: white;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  font-weight: 600;
  z-index: 10;
}

.profile-name h4 {
  margin: 0 0 8px 0;
  font-size: 2rem;
  font-weight: 700;
  color: #212529;
}

#userStatus {
  display: flex;
  align-items: center;
  margin: 0;
  color: #6c757d;
  font-size: 1rem;
}

#onlineIcon {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success-color);
  margin-right: 8px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Navigation Tabs */
.profile-nav {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.nav-tabs {
  border: none;
  display: flex;
  flex-wrap: nowrap;
  padding: 0;
  margin: 0;
}

.nav-tabs::-webkit-scrollbar {
  height: 4px;
}

.nav-tabs::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.nav-link {
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  padding: 16px 24px;
  font-weight: 500;
  font-size: 15px;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link:hover {
  background: rgba(223, 49, 77, 0.05);
  color: var(--primary-color);
}

.nav-link.active {
  background: transparent;
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  font-weight: 600;
}

.nav-link i {
  font-size: 18px;
}

/* Card Sections */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  background: var(--light-bg);
  border: none;
  border-radius: 12px 12px 0 0;
  padding: 16px 20px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.card-header:hover {
  background: #e9ecef;
}

.card-header span {
  font-weight: 600;
  color: #212529;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Prevent edit button from triggering collapse */
.card-body .btn[data-bs-toggle="modal"] {
  z-index: 10;
}

.card-body {
  padding: 20px;
}

/* Show/hide edit button text on smaller screens */
.btn[data-bs-toggle="modal"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn[data-bs-toggle="modal"] i {
  font-size: 16px;
}

/* Make collapse transition smooth */
.collapse {
  transition: height 0.35s ease;
}

.collapsing {
  transition: height 0.35s ease;
}

/* Form Styling */
.form-label {
  font-weight: 500;
  color: #495057;
  margin-bottom: 8px;
}

.form-control,
.form-select {
  border-radius: 8px;
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(223, 49, 77, 0.15);
}

/* Profile-specific Buttons */
.profile-section .btn,
.profile-details .btn,
.card .btn,
.modal .btn {
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 500;
  transition: var(--transition);
}

.profile-section .btn-primary,
.profile-details .btn-primary,
.card .btn-primary,
.modal .btn-primary {
  background: var(--primary-color);
  border: none;
}

.profile-section .btn-primary:hover,
.profile-details .btn-primary:hover,
.card .btn-primary:hover,
.modal .btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.profile-section .btn-outline-primary,
.profile-details .btn-outline-primary,
.card .btn-outline-primary,
.modal .btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.profile-section .btn-outline-primary:hover,
.profile-details .btn-outline-primary:hover,
.card .btn-outline-primary:hover,
.modal .btn-outline-primary:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.profile-section .btn-sm,
.profile-details .btn-sm,
.card .btn-sm,
.modal .btn-sm {
  padding: 7px 16px;
  font-size: 0.95em;
}

/* Modal Enhancements for Bootstrap 5 */
.modal-content {
  border-radius: 12px;
  border: none;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 20px 24px;
  border-radius: 12px 12px 0 0;
}

.modal-header .btn-close {
  padding: 0;
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
  border: 0;
  opacity: 0.5;
  width: 1em;
  height: 1em;
  cursor: pointer;
}

.modal-header .btn-close:hover,
.modal-header .btn-close:focus {
  opacity: 0.75;
  outline: none;
  box-shadow: none;
}

.modal-title {
  font-weight: 600;
  color: #212529;
}

.modal-title i {
  color: var(--primary-color);
  font-size: 1.1em;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 16px 24px;
  border-radius: 0 0 12px 12px;
}

/* WhatsApp Requests */
.wa-requests-header h4 {
  font-weight: 600;
  color: #212529;
}

.table {
  border-collapse: separate;
  border-spacing: 0;
}

.table thead {
  background: var(--light-bg);
}

.table thead th {
  border: none;
  padding: 16px;
  font-weight: 600;
  color: #495057;
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 0.5px;
}

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background: var(--light-bg);
}

.table tbody td {
  padding: 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}

/* Search Widget */
.search-widget {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.search-widget .widget-title h5 {
  font-weight: 600;
  color: #212529;
  margin-bottom: 16px;
}

/* Progress Bar */
.progress {
  height: 24px;
  border-radius: 12px;
  background: var(--light-bg);
}

.progress-bar {
  border-radius: 12px;
  background: var(--success-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ensure body scroll is not stuck */
body {
  overflow-x: hidden;
}

body:not(.modal-open) {
  overflow-y: auto !important;
  padding-right: 0 !important;
}

html {
  overflow-y: auto !important;
}

/* Modal specific styles */
.modal-open {
  overflow: hidden !important;
}

.modal-backdrop {
  z-index: 1040;
}

.modal {
  z-index: 1050;
}

/* Dropdown Menu Fixes */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  cursor: pointer !important;
  user-select: none;
}

.dropdown-toggle::after {
  display: none; /* Hide default Bootstrap caret if needed */
}

.dropdown-menu {
  position: absolute !important;
  left: auto !important;
  right: 0 !important;
  z-index: 9999 !important;
  display: none;
  min-width: 280px;
  max-width: 350px;
  border: none;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
  padding: 12px 0;
  margin-top: 12px !important;
  background: white;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block !important;
  animation: dropdownFadeIn 0.2s ease-in-out;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 20px;
  width: 12px;
  height: 12px;
  background: white;
  transform: rotate(45deg);
  box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
}

.dropdown-item {
  padding: 12px 20px;
  transition: var(--transition);
  border-radius: 6px;
  margin: 2px 10px;
  font-size: 0.95em;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: normal;
  word-wrap: break-word;
}

.dropdown-item:hover {
  background: var(--light-bg) !important;
  color: var(--primary-color) !important;
  text-decoration: none;
}

.dropdown-item:active {
  background: rgba(223, 49, 77, 0.1) !important;
  color: var(--primary-color) !important;
}

.dropdown-item i {
  font-size: 1.2em;
  width: 20px;
  text-align: center;
}

.dropdown-divider {
  margin: 8px 0;
  border-top: 1px solid var(--border-color);
}

.dropdown-header {
  padding: 12px 20px;
  font-size: 0.85em;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Fix for notification bell icon */
/* .notification-icon,
.notifications-icon,
[data-bs-toggle="dropdown"] {
  position: relative;
  cursor: pointer !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-icon .badge,
.notifications-icon .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  padding: 3px 6px;
  font-size: 0.65em;
  border-radius: 10px;
  background: var(--primary-color);
  color: white;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
} */

/* Ensure dropdown works in header */
header .dropdown-menu {
  margin-top: 15px !important;
}

.header-section .dropdown-menu {
  margin-top: 15px !important;
}

/* Fix z-index conflicts */
.profile-cover,
.profile-information,
.profile-nav {
  z-index: 1;
}

.dropdown,
.dropdown-menu {
  z-index: 9999 !important;
}

/* Notification specific styles */
/* .notification-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
  cursor: pointer;
} */

/* .notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background: var(--light-bg);
}

.notification-item.unread {
  background: rgba(223, 49, 77, 0.05);
}

.notification-item .notification-time {
  font-size: 0.75em;
  color: #6c757d;
  margin-top: 4px;
} */

/* Responsive Design */
@media (max-width: 992px) {
  .profile-information {
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: -60px;
  }
  
  .profile-pic {
    margin-right: 0;
    margin-bottom: 16px;
  }
  
  #profilePicDrop {
    width: 180px;
    height: 180px;
  }
}

@media (max-width: 768px) {
  .profile-cover {
    height: 180px;
  }
  
  .profile-information {
    padding: 0 16px 16px;
  }
  
  #profilePicDrop {
    width: 150px;
    height: 150px;
  }
  
  .profile-name h4 {
    font-size: 1.5rem;
  }
  
  .nav-link {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .card-header,
  .card-body {
    padding: 16px;
  }

  /* Ensure the profile name and online/status text are visible on mobile */
  .profile-name h4,
  #userStatus,
  #userStatus * ,
  span#statusText {
    color: #212529 !important;
    text-shadow: none !important;
  }

  /* Make the nav tabs horizontally scrollable pill-style for small screens */
  .profile-nav {
    padding: 12px;
    background: white;
  }

  .profile-nav .nav-tabs {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin: 0;
    white-space: nowrap;
  }

  .profile-nav .nav-link {
    flex: 0 0 auto;
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 14px;
    color: #495057 !important;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .profile-nav .nav-link:hover {
    background: rgba(223,49,77,0.04);
    color: var(--primary-color) !important;
  }

  .profile-nav .nav-link.active {
    background: rgba(223,49,77,0.08);
    color: var(--primary-color) !important;
    border-color: rgba(223,49,77,0.12);
    box-shadow: none;
  }

  /* Improve visibility of icons inside tabs */
  .profile-nav .nav-link i {
    color: var(--primary-color);
    font-size: 1rem;
  }
}

@media (max-width: 576px) {
  .nav-tabs {
    flex-direction: column;
  }
  
  .nav-link {
    border-bottom: 1px solid var(--border-color);
    border-left: 3px solid transparent;
    padding: 14px 16px;
  }
  
  .nav-link.active {
    border-bottom: 1px solid var(--border-color);
    border-left-color: var(--primary-color);
  }
  
  .modal-body {
    padding: 16px;
  }
}

/* Loading Spinner */
.spinner-border {
  width: 3rem;
  height: 3rem;
}

/* Gallery Item */
.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.gallery-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

/* Select2 Enhancement */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  border-radius: 8px;
  border-color: var(--border-color);
  padding: 4px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-selection--focus .select2-selection--multiple {
  border-color: var(--primary-color);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Loader Overlay */
#appLoader {
  backdrop-filter: blur(4px);
}

/* Form Text */
.form-text {
  color: #6c757d;
  font-size: 0.875em;
  margin-top: 4px;
}

/* Info Section Styling */
.mb-2 {
  margin-bottom: 12px;
}

.fw-bold {
  font-weight: 600;
  color: #495057;
}

/* Alert Styling */
.alert {
  border-radius: 8px;
  border: none;
}

.alert-info {
  background: rgba(23, 162, 184, 0.1);
  color: #0c5460;
}

span#statusText {
  /* default to white on web/desktop; mobile override will force dark on small screens */
  color: black;
}

/* Mobile-specific fixes: ensure profile name + status are dark and make tabs a scrollable pill-row */
@media (max-width: 768px) {
  /* Ensure the profile name and online/status text are visible on mobile */
  .profile-name h4,
  #userStatus,
  #userStatus * ,
  span#statusText {
    color: black !important;
    text-shadow: none !important;
  }

  /* Make the nav tabs horizontally scrollable pill-style for small screens */
  .profile-nav {
    padding: 12px;
    background: white;
  }

  .profile-nav .nav-tabs {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin: 0;
    white-space: nowrap;
  }

  .profile-nav .nav-link {
    flex: 0 0 auto;
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 14px;
    color: #495057 !important;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .profile-nav .nav-link:hover {
    background: rgba(223,49,77,0.04);
    color: var(--primary-color) !important;
  }

  .profile-nav .nav-link.active {
    background: rgba(223,49,77,0.08);
    color: var(--primary-color) !important;
    border-color: rgba(223,49,77,0.12);
    box-shadow: none;
  }

  /* Improve visibility of icons inside tabs */
  .profile-nav .nav-link i {
    color: var(--primary-color);
    font-size: 1rem;
  }
}

/* Profile Page Specific Styles - Moved from profile.ejs */
.profile-nav {
  background-color: #f8f9fa;
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 20px;
}

.nav-tabs {
  border: none;
  justify-content: space-around;
  flex-wrap: nowrap;
}

.nav-tabs .nav-link {
  border: none;
  background: transparent;
  color: #6c757d;
  padding: 12px 8px;
  margin: 0 2px;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.nav-tabs .nav-link:hover {
  background-color: #e9ecef;
  color: #495057;
}

.nav-tabs .nav-link.active {
  background-color: white;
  color: #333;
}

.nav-tabs .nav-link:not(.active) i {
  color: #6c757d;
}

.nav-tabs .nav-link i {
  font-size: 24px;
  margin-bottom: 4px;
  display: block;
}

.nav-tabs .nav-link.active i {
  font-size: 28px;
}

.nav-tabs .tab-text {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

/* Mobile specific styles */
@media (max-width: 768px) {
  .nav-tabs .nav-link {
    min-height: 70px;
    padding: 16px 4px;
    margin: 0 1px;
  }

  .nav-tabs .nav-link i {
    font-size: 32px;
    margin-bottom: 0;
  }

  .nav-tabs .nav-link.active i {
    font-size: 36px;
  }

  .nav-tabs .tab-text {
    display: none !important;
  }

  .profile-nav {
    padding: 12px;
    margin-bottom: 24px;
  }
}

/* Large mobile and tablet styles */
@media (min-width: 576px) and (max-width: 768px) {
  .nav-tabs .nav-link i {
    font-size: 28px;
  }

  .nav-tabs .nav-link.active i {
    font-size: 32px;
  }

  .nav-tabs .tab-text {
    font-size: 11px;
  }
}
