/* Main Styles */
:root {
  --primary: #a05c4f;
  --secondary: #d3b88c;
  --tertiary: #6a7e64;
  --dark: #463832;
  --light: #f5efe7;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2.5rem;
  --font-size-small: 0.875rem;
  --font-size-base: 1rem;
  --font-size-large: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 1.875rem;
  --font-size-3xl: 2.25rem;
}

/* Add custom CSS that can't be achieved with Tailwind */
html, body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--dark);
  background-color: var(--light);
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Hero Section */
.hero-section {
  background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('https://newoaks.s3.us-west-1.amazonaws.com/AutoDev/12407/1c8be9f1-7668-49a9-909e-40a701fd9bee.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  z-index: 0;
  margin-top: 0;
  width: 100%;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), rgba(70, 56, 50, 0.8));
}

/* Navbar */
.navbar-link {
  color: var(--light);
  position: relative;
}

nav {
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
  z-index: 9999; /* Increased z-index for better stacking */
  top: 0; /* Ensure proper positioning */
}

.navbar-link::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--secondary);
  transition: width 0.3s ease;
}

.navbar-link:hover::after,
.active-link::after {
  width: 100%;
}

.active-link {
  color: var(--secondary);
}

/* Animation for loaders */
.loader {
  width: 48px;
  height: 48px;
  border: 5px solid var(--secondary);
  border-bottom-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}

@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Fade in animation */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

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

/* Text truncation for multi-line text */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Ensure modals appear on top */
.modal {
  z-index: 50;
}

/* Add smooth transition effects */
.transition-all {
  transition: all 0.3s ease;
}

/* Hover effects for cards */
.card-hover:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Image-first card styles */
.descanso-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.descanso-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.descanso-card img {
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Loading skeleton animation */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background-color: #eee;
  background-image: linear-gradient(90deg, #eee, #f5f5f5, #eee);
  background-size: 200px 100%;
  background-repeat: no-repeat;
  animation: shimmer 1.3s ease-in-out infinite;
}

/* Action button animations */
.action-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
}

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

.action-btn:active {
  transform: scale(0.95);
}

/* Quality badge styles */
.quality-badge {
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Distance indicator pulse animation */
.distance-indicator {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Verified badge glow effect */
.verified-badge {
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.3);
  }
  to {
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.7);
  }
}

/* Like button heart animation */
.like-btn.liked {
  animation: heartbeat 0.6s ease-in-out;
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.2);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Contributor avatar hover effect */
.contributor-avatar {
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.contributor-avatar:hover {
  border-color: var(--secondary);
  transform: scale(1.1);
}

/* Image overlay gradient improvements */
.image-overlay {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.8) 0%,
    rgba(0, 0, 0, 0.4) 30%,
    rgba(0, 0, 0, 0.1) 60%,
    transparent 100%
  );
  transition: opacity 0.3s ease;
}

.descanso-card:hover .image-overlay {
  opacity: 0.9;
}

/* Text content animations */
.card-title {
  transition: color 0.3s ease;
}

.descanso-card:hover .card-title {
  color: var(--secondary);
}

/* Stats counter animation */
.stats-counter {
  transition: all 0.3s ease;
}

.descanso-card:hover .stats-counter {
  color: var(--secondary);
  transform: scale(1.05);
}

/* Sticky navbar */
.navbar-sticky {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999; /* Consistent z-index with main navbar */
  transition: background-color 0.3s ease;
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Global page padding - ensures consistent navbar clearance across all pages */
.page-container {
  padding-top: 6rem; /* Reduced from 9rem to 6rem for smaller navbar */
  min-height: calc(100vh - 6rem);
  position: relative;
  z-index: 1; /* Ensure content appears below navbar */
}

/* Mobile responsive padding adjustments for page container */
@media (max-width: 768px) {
  .page-container {
    padding-top: 4.5rem; /* Reduced from 6rem to 4.5rem for smaller mobile navbar */
    min-height: calc(100vh - 4.5rem);
  }
}

@media (max-width: 480px) {
  .page-container {
    padding-top: 4.5rem; /* Consistent with mobile breakpoint */
    min-height: calc(100vh - 4.5rem);
  }
}

/* Landscape mobile optimizations */
@media (max-width: 768px) and (orientation: landscape) {
  .page-container {
    padding-top: 4rem; /* Reduced from 5rem for better landscape space usage */
    min-height: calc(100vh - 4rem);
  }
}

/* Override specific padding classes if needed */
.pt-24 {
  padding-top: 6rem !important; /* Updated to match new smaller navbar clearance */
}

.pt-32 {
  padding-top: 6rem !important; /* Updated to match new smaller navbar clearance */
}

/* Specific navbar height calculations for different breakpoints */
.navbar-height-desktop {
  height: 72px;
  min-height: 72px;
}

.navbar-height-tablet {
  height: 68px;
  min-height: 68px;
}

.navbar-height-mobile {
  height: 64px;
  min-height: 64px;
}

/* Document descanso text and page header clearance */
.page-header {
  margin-top: 1.5rem;
  padding-top: 0.5rem;
}

.page-title {
  margin-top: 1rem;
  padding-top: 0.5rem;
}

/* Ensure proper touch targets and mobile accessibility */
.camera-button {
  min-height: 48px;
  min-width: 48px;
  padding: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.camera-button:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.camera-button:active {
  transform: scale(0.95);
}

/* Mobile optimizations and responsiveness improvements */
@media (max-width: 768px) {
  body {
    font-size: var(--font-size-base);
  }
  
  h1 {
    font-size: var(--font-size-2xl);
  }
  
  h2 {
    font-size: var(--font-size-xl);
  }
  
  .container {
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
  }
  
  /* Enhanced mobile touch targets with proper sizing */
  button, 
  .btn, 
  a.btn, 
  input[type="button"], 
  input[type="submit"], 
  .touch-target {
    min-height: 48px; 
    min-width: 48px;
    padding: var(--spacing-sm) var(--spacing-md);
    touch-action: manipulation;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.4;
  }
  
  /* Camera button optimized for mobile */
  .camera-button {
    min-height: 56px;
    min-width: 56px;
    padding: 16px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }
  
  /* Enhanced tab navigation for mobile */
  .tab-navigation {
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  .tab-navigation::-webkit-scrollbar {
    display: none;
  }
  
  .tab-button {
    min-width: 120px;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.875rem 1.25rem;
    min-height: 48px;
    border-radius: 6px;
    font-weight: 500;
  }
  
  /* Improved mobile forms */
  input, select, textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 8px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }
  
  /* Enhanced mobile navbar with proper spacing */
  nav {
    z-index: 9999 !important;
    height: auto;
    min-height: 64px;
    padding: 8px 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  
  /* Mobile navbar link improvements */
  .navbar-link {
    padding: 12px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-weight: 500;
  }
  
  /* Mobile menu positioning */
  .mobile-menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--light);
    z-index: 9998;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  
  /* Mobile page spacing with improved clearance */
  .page-container {
    padding-top: 4.5rem; /* Reduced from 6rem to 4.5rem for smaller mobile navbar */
    min-height: calc(100vh - 4.5rem);
  }
  
  /* Additional spacing for mobile page headers */
  .page-header {
    margin-top: 1rem;
    padding-top: 1rem;
  }
  
  /* Fix for very small mobile screens (height < 600px) */
  @media (max-height: 600px) {
    .page-container {
      padding-top: 4rem; /* Reduced from 5rem for smaller navbar on small screens */
    }
    
    nav {
      min-height: 56px;
      padding: 4px 0;
    }
    
    .mobile-menu {
      top: 56px;
    }
    
    .page-header {
      margin-top: 0.5rem;
      padding-top: 0.5rem;
    }
  }
  
  /* Improved spacing for content overlap prevention */
  .main-content {
    margin-top: 1rem;
    padding-bottom: 2rem;
  }
  
  /* Enhanced button accessibility */
  .action-button,
  .primary-button,
  .secondary-button {
    min-height: 48px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    letter-spacing: 0.025em;
  }
  
  /* Mobile-optimized card interactions */
  .card-interactive {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Better mobile modal positioning */
  .modal-mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Enhanced responsiveness for small tablets (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .page-container {
    padding-top: 5.5rem; /* Reduced from 7rem to 5.5rem for smaller tablet navbar */
    min-height: calc(100vh - 5.5rem);
  }
  
  nav {
    min-height: 68px;
  }
  
  .navbar-link {
    padding: 10px 20px;
  }
  
  .page-header {
    margin-top: 1.25rem;
    padding-top: 0.75rem;
  }
}

/* Large mobile/small tablet optimizations */
@media (max-width: 480px) {
  /* Extra small screen adjustments */
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  h1 {
    font-size: 1.5rem;
    line-height: 1.3;
  }
  
  h2 {
    font-size: 1.25rem;
    line-height: 1.4;
  }
  
  /* Compact button sizing for very small screens */
  .btn-compact {
    min-height: 40px;
    padding: 8px 16px;
    font-size: 14px;
  }
  
  /* Improved spacing for very small screens */
  .page-container {
    padding-top: 4.5rem; /* Consistent with mobile breakpoint */
    min-height: calc(100vh - 4.5rem);
  }
  
  nav {
    min-height: 60px;
  }
  
  .page-header {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
  }
}

/* Landscape mobile optimizations */
@media (max-width: 768px) and (orientation: landscape) {
  nav {
    min-height: 56px;
    padding: 4px 0;
  }
  
  .page-container {
    padding-top: 4rem; /* Reduced from 5rem for better landscape space usage with smaller navbar */
    min-height: calc(100vh - 4rem);
  }
  
  .mobile-menu {
    top: 56px;
  }
  
  .page-header {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }
}

/* High DPI mobile screens */
@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
  button,
  .btn,
  input,
  select {
    border-width: 0.5px;
  }
}

/* Responsive iframe for maps */
.responsive-iframe {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
}

.responsive-iframe iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Image comparison slider */
.image-comparison {
  position: relative;
  overflow: hidden;
}

.image-comparison img {
  width: 100%;
  display: block;
}

.image-comparison .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
}

.image-comparison .slider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: var(--primary);
  transform: translateX(-50%);
  cursor: ew-resize;
  z-index: 10;
}

.image-comparison .slider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  transform: translate(-50%, -50%);
  z-index: 2;
}

/* Enhanced Profile Styles */
.profile-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
}

.profile-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

.profile-avatar {
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.profile-avatar:hover {
  transform: scale(1.05);
}

.profile-stats-card {
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-stats-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.achievement-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: perspective(1000px) rotateX(0deg);
}

.achievement-card:hover {
  transform: perspective(1000px) rotateX(5deg) scale(1.05);
}

.achievement-card.earned {
  animation: achievementEarned 0.6s ease-out;
}

@keyframes achievementEarned {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2) rotate(5deg);
  }
  100% {
    transform: scale(1);
  }
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 60px;
  width: 2px;
  height: calc(100% - 40px);
  background: linear-gradient(to bottom, var(--primary), var(--secondary));
  opacity: 0.3;
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-marker {
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.timeline-marker:hover {
  transform: scale(1.2);
  box-shadow: 0 0 20px rgba(160, 92, 79, 0.5);
}

.contribution-gallery-item {
  transition: all 0.3s ease;
  overflow: hidden;
}

.contribution-gallery-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.contribution-gallery-item img {
  transition: transform 0.5s ease;
}

.contribution-gallery-item:hover img {
  transform: scale(1.1);
}

.social-connection-item {
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.social-connection-item:hover {
  border-left-color: var(--primary);
  background-color: rgba(160, 92, 79, 0.05);
  transform: translateX(5px);
}

.tab-indicator {
  position: relative;
  overflow: hidden;
}

.tab-indicator::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.3s ease;
}

.tab-indicator.active::after {
  width: 100%;
}

.profile-tab-content {
  animation: fadeInUp 0.3s ease-out;
}

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

.gradient-bg-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
}

.glass-morphism {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.contribution-map-container {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

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

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

/* Profile responsive adjustments */
@media (max-width: 768px) {
  .profile-header {
    padding: var(--spacing-md);
  }
  
  .profile-avatar {
    margin: 0 auto var(--spacing-md);
  }
  
  .profile-stats {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  .tab-navigation {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .tab-navigation::-webkit-scrollbar {
    display: none;
  }
  
  .contribution-gallery {
    grid-template-columns: 1fr;
  }
  
  .achievement-grid {
    grid-template-columns: 1fr;
  }
}