/* ========================================
   BOYFANZ UNLEASHED - UI/UX ENHANCEMENTS
   v1.0 - Advanced styling & animations
   ======================================== */

/* --- Global Improvements --- */
:root {
  --bf-primary: #7e0000;
  --bf-primary-light: #a50000;
  --bf-primary-dark: #5a0000;
  --bf-gradient: linear-gradient(135deg, #7e0000 0%, #c80000 100%);
  --bf-gradient-subtle: linear-gradient(135deg, rgba(126,0,0,0.05) 0%, rgba(200,0,0,0.08) 100%);
  --bf-shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --bf-shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --bf-shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
  --bf-shadow-hover: 0 8px 25px rgba(126,0,0,0.2);
  --bf-radius: 12px;
  --bf-radius-lg: 16px;
  --bf-radius-xl: 24px;
  --bf-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --bf-transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Smooth page transitions */
.wrap-post, .container {
  animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* --- Card & Post Enhancements --- */
.card, .card-post {
  border: none !important;
  border-radius: var(--bf-radius) !important;
  box-shadow: var(--bf-shadow-sm);
  transition: var(--bf-transition);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--bf-shadow-md);
  transform: translateY(-2px);
}

.card-cover, .card-img-top {
  border-radius: var(--bf-radius) var(--bf-radius) 0 0 !important;
}

/* Post cards in feed */
.updates .card-post,
.wrap-post .card {
  margin-bottom: 20px;
  border-radius: var(--bf-radius-lg) !important;
}

/* --- Button Enhancements --- */
.btn {
  border-radius: 8px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: var(--bf-transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--bf-gradient) !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(126,0,0,0.3);
}

.btn-primary:hover {
  box-shadow: var(--bf-shadow-hover);
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

/* Ripple effect on buttons */
.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
}

.btn:active::after {
  width: 200px;
  height: 200px;
  opacity: 1;
  transition: 0s;
}

/* Follow/Subscribe buttons */
.btn-subscribe, .btn-follow {
  border-radius: 25px;
  padding: 8px 24px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

/* --- Navigation Enhancements --- */
.navbar {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(255,255,255,0.85) !important;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: var(--bf-transition);
}

[data-bs-theme='dark'] .navbar {
  background: rgba(30,30,30,0.85) !important;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.navbar.scrolled {
  box-shadow: var(--bf-shadow-sm);
}

/* --- Avatar Enhancements --- */
.avatar-user, .user-avatar, img.rounded-circle {
  border: 3px solid #fff;
  box-shadow: var(--bf-shadow-sm);
  transition: var(--bf-transition);
}

.avatar-user:hover, .user-avatar:hover {
  transform: scale(1.08);
  box-shadow: var(--bf-shadow-md);
}

/* Online indicator */
.avatar-wrap {
  position: relative;
}

/* --- Video Player Enhancements --- */
.plyr {
  border-radius: var(--bf-radius) !important;
  overflow: hidden;
  box-shadow: var(--bf-shadow-md);
}

.plyr__control--overlaid {
  background: var(--bf-gradient) !important;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  opacity: 0.9;
  transition: var(--bf-transition);
  backdrop-filter: blur(8px);
}

.plyr__control--overlaid:hover {
  opacity: 1;
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(126,0,0,0.4);
}

.plyr__control--overlaid svg {
  width: 20px;
  height: 20px;
}

.plyr--video .plyr__controls {
  background: linear-gradient(transparent, rgba(0,0,0,0.75)) !important;
  padding: 40px 12px 12px !important;
}

.plyr__progress input[type=range] {
  color: var(--bf-primary-light) !important;
}

.plyr--full-ui input[type=range] {
  color: var(--bf-primary-light) !important;
}

/* Video loading skeleton */
.video-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--bf-radius);
  aspect-ratio: 16/9;
}

/* --- Image Enhancements --- */
.img-post, .post-image {
  border-radius: var(--bf-radius);
  transition: var(--bf-transition);
}

.img-post:hover {
  filter: brightness(1.02);
}

/* Image gallery grid */
.media-gallery {
  gap: 4px;
}

.media-gallery img {
  object-fit: cover;
  border-radius: 8px;
  transition: var(--bf-transition);
  cursor: pointer;
}

.media-gallery img:hover {
  transform: scale(1.02);
  z-index: 1;
}

/* --- Lightbox overlay --- */
.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

/* --- Stories Enhancement --- */
.storiesWrapper {
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 8px 0 !important;
}

.storiesWrapper::-webkit-scrollbar {
  display: none;
}

.storiesWrapper .item-add-story,
#stories .story {
  transition: var(--bf-transition);
}

.storiesWrapper .item-add-story:hover,
#stories .story:hover {
  transform: scale(1.05);
}

#stories .story .img-circle {
  border: 3px solid var(--bf-primary);
  padding: 2px;
}

/* --- Like/Interaction Animations --- */
.btn-like-post.active i,
.btn-like.active i {
  animation: pulse 0.4s ease;
  color: #e74c3c;
}

.like-heart-animation {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 80px;
  color: #e74c3c;
  pointer-events: none;
  z-index: 100;
  animation: heartBurst 0.8s ease forwards;
}

@keyframes heartBurst {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* --- Comment Section --- */
.comments-section {
  border-top: 1px solid rgba(0,0,0,0.06);
  padding-top: 12px;
}

.comment-item {
  animation: slideInRight 0.3s ease;
  padding: 8px 0;
  border-radius: 8px;
}

.comment-item:hover {
  background: rgba(0,0,0,0.02);
}

/* --- Sidebar Enhancements --- */
.menu-sidebar-home .nav-link,
.sidebar .list-group-item {
  border-radius: 10px !important;
  margin: 2px 0;
  transition: var(--bf-transition-fast);
  border: none !important;
}

.menu-sidebar-home .nav-link:hover,
.sidebar .list-group-item:hover {
  background: var(--bf-gradient-subtle);
  transform: translateX(4px);
}

.menu-sidebar-home .nav-link.active {
  background: var(--bf-gradient) !important;
  color: #fff !important;
  box-shadow: 0 2px 10px rgba(126,0,0,0.3);
}

/* --- User Profile Card Enhancement --- */
.cover-user {
  border-radius: 0 0 var(--bf-radius-xl) var(--bf-radius-xl);
  overflow: hidden;
}

.cover-user img {
  transition: var(--bf-transition);
}

.cover-user:hover img {
  transform: scale(1.02);
}

.user-profile-stats {
  display: flex;
  gap: 24px;
}

.stat-item {
  text-align: center;
}

.stat-item .stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--bf-primary);
}

/* --- Explore/Discover Grid --- */
.card-explore {
  border-radius: var(--bf-radius-lg) !important;
  overflow: hidden;
  transition: var(--bf-transition);
}

.card-explore:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--bf-shadow-lg);
}

.card-explore .card-img-top {
  aspect-ratio: 1;
  object-fit: cover;
  transition: var(--bf-transition);
}

.card-explore:hover .card-img-top {
  transform: scale(1.05);
}

/* --- Modal Enhancements --- */
.modal-content {
  border: none;
  border-radius: var(--bf-radius-lg);
  box-shadow: var(--bf-shadow-lg);
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 16px 24px;
}

.modal-body {
  padding: 24px;
}

.modal.fade .modal-dialog {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  transform: translateY(30px) scale(0.95);
}

.modal.show .modal-dialog {
  transform: translateY(0) scale(1);
}

/* --- Form Enhancements --- */
.form-control, .form-select {
  border-radius: 10px;
  border: 2px solid rgba(0,0,0,0.08);
  padding: 10px 16px;
  transition: var(--bf-transition);
}

.form-control:focus, .form-select:focus {
  border-color: var(--bf-primary);
  box-shadow: 0 0 0 3px rgba(126,0,0,0.1);
}

/* --- Notification Badge --- */
.badge-notify {
  animation: pulse 2s infinite;
}

/* --- Tooltip Enhancement --- */
.tooltip-inner {
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  backdrop-filter: blur(10px);
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(126,0,0,0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(126,0,0,0.4);
}

/* --- Floating Action Button --- */
.fab-create-post {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bf-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(126,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  transition: var(--bf-transition);
  z-index: 1000;
}

.fab-create-post:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 24px rgba(126,0,0,0.5);
}

/* --- Mobile Optimizations --- */
@media (max-width: 768px) {
  .card, .card-post {
    border-radius: var(--bf-radius) !important;
    margin-left: -4px;
    margin-right: -4px;
  }

  .navbar {
    padding: 8px 12px;
  }

  .btn {
    min-height: 44px; /* Touch target */
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Bottom navigation bar enhancement */
  .navbar-collapse {
    border-radius: var(--bf-radius-xl) var(--bf-radius-xl) 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  }

  /* Swipeable post cards */
  .wrap-post {
    scroll-snap-type: y proximity;
  }

  .wrap-post .card {
    scroll-snap-align: start;
  }

  /* Full-width images on mobile */
  .img-post {
    border-radius: 0 !important;
    margin: 0 -12px;
    width: calc(100% + 24px) !important;
  }

  .plyr {
    border-radius: 0 !important;
    margin: 0 -12px;
    width: calc(100% + 24px) !important;
  }
}

/* --- Dark Mode Enhancements --- */
[data-bs-theme='dark'] {
  --bf-shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --bf-shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --bf-gradient-subtle: linear-gradient(135deg, rgba(126,0,0,0.15) 0%, rgba(200,0,0,0.1) 100%);
}

[data-bs-theme='dark'] .card {
  background: rgba(40,40,40,0.9);
  border: 1px solid rgba(255,255,255,0.06) !important;
}

[data-bs-theme='dark'] .navbar {
  background: rgba(20,20,20,0.9) !important;
}

[data-bs-theme='dark'] .form-control,
[data-bs-theme='dark'] .form-select {
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
}

[data-bs-theme='dark'] ::-webkit-scrollbar-thumb {
  background: rgba(200,0,0,0.3);
}

/* --- Skeleton Loading States --- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

[data-bs-theme='dark'] .skeleton {
  background: linear-gradient(90deg, #333 25%, #3a3a3a 50%, #333 75%);
  background-size: 200% 100%;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-text {
  height: 14px;
  margin: 8px 0;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-image {
  aspect-ratio: 16/9;
  width: 100%;
}

/* --- Reels Enhancement --- */
.reels-container {
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  height: 100vh;
  scrollbar-width: none;
}

.reels-container::-webkit-scrollbar {
  display: none;
}

.reel-item {
  scroll-snap-align: start;
  height: 100vh;
  position: relative;
}

.reel-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel-actions {
  position: absolute;
  right: 12px;
  bottom: 100px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 10;
}

.reel-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: var(--bf-transition);
}

.reel-action-btn:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.1);
}

/* --- Pricing/Subscription Cards --- */
.pricing-card {
  border-radius: var(--bf-radius-lg);
  padding: 24px;
  text-align: center;
  transition: var(--bf-transition);
  position: relative;
  overflow: hidden;
}

.pricing-card.featured {
  border: 2px solid var(--bf-primary);
  transform: scale(1.05);
}

.pricing-card.featured::before {
  content: 'POPULAR';
  position: absolute;
  top: 12px;
  right: -30px;
  background: var(--bf-gradient);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 40px;
  transform: rotate(45deg);
  letter-spacing: 0.1em;
}

/* --- Toast Notifications --- */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 0.9rem;
  z-index: 10000;
  box-shadow: var(--bf-shadow-lg);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
}

/* --- Pull-to-Refresh Indicator --- */
.ptr-indicator {
  text-align: center;
  padding: 16px;
  color: var(--bf-primary);
  font-size: 0.85rem;
  transition: var(--bf-transition);
}

.ptr-indicator .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(126,0,0,0.2);
  border-top-color: var(--bf-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Improved Typography --- */
.post-text, .update-text {
  line-height: 1.7;
  word-break: break-word;
}

.post-text a {
  color: var(--bf-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: var(--bf-transition-fast);
}

.post-text a:hover {
  border-bottom-color: var(--bf-primary);
}

/* --- Verified Badge --- */
.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--bf-gradient);
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ===== BACK TO TOP BUTTON ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-primary, #6366f1);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
  z-index: 9999;
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent-secondary, #8b5cf6);
  transform: translateY(-2px);
}

/* ===== ENHANCED VIDEO CONTROLS ===== */
.plyr--video .plyr__controls {
  background: linear-gradient(transparent, rgba(0,0,0,0.75)) !important;
  padding: 30px 12px 12px !important;
}

.plyr--video .plyr__control--overlaid {
  background: rgba(99, 102, 241, 0.85) !important;
  border-radius: 50%;
  padding: 18px !important;
  transition: transform 0.2s ease, background 0.2s ease;
}

.plyr--video .plyr__control--overlaid:hover {
  background: rgba(99, 102, 241, 1) !important;
  transform: scale(1.1);
}

.plyr__menu__container {
  border-radius: 10px !important;
  backdrop-filter: blur(10px);
  background: rgba(30, 30, 40, 0.95) !important;
}

/* PiP indicator */
video:picture-in-picture {
  box-shadow: 0 0 0 3px var(--accent-primary, #6366f1);
}

/* ===== IMPROVED FORM FOCUS STATES ===== */
.form-control:focus,
.form-select:focus {
  border-color: var(--accent-primary, #6366f1) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

/* ===== IMPROVED BADGE STYLES ===== */
.badge-verified {
  background: linear-gradient(135deg, #3b82f6, #6366f1) !important;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* ===== MESSAGE BUBBLE ENHANCEMENT ===== */
.msg-chat .media-body {
  transition: transform 0.15s ease;
}

.msg-chat .media-body:hover {
  transform: scale(1.01);
}

/* ===== NOTIFICATION DOT ===== */
.nav-link .badge-notify {
  animation: notifyPulse 2s infinite;
}

@keyframes notifyPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ===== LOADING SKELETON SHIMMER ===== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

[data-bs-theme="dark"] .skeleton-loading {
  background: linear-gradient(90deg, #2a2a3a 25%, #3a3a4a 50%, #2a2a3a 75%);
  background-size: 200% 100%;
}

/* ===== MOBILE BOTTOM BAR ENHANCEMENT ===== */
@media (max-width: 767.98px) {
  .back-to-top {
    bottom: 80px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}
