/* MyFit Coach - Custom Styles */

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

/* Custom scrollbar for dark theme */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1f2937;
}

::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Loading animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading {
  animation: spin 1s linear infinite;
}

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Range slider custom styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #3B82F6 0%, #3B82F6 50%, #374151 50%, #374151 100%);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3B82F6;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.5);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3B82F6;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.5);
}

/* Number input styling */
input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Button hover effects */
button {
  transition: all 0.2s ease;
}

button:active {
  transform: scale(0.98);
}

/* Card hover effect */
.card:hover {
  transform: translateY(-2px);
  transition: transform 0.2s ease;
}

/* Progress bar */
.progress-bar {
  height: 4px;
  background: #374151;
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3B82F6, #10B981);
  transition: width 0.3s ease;
}

/* Pulse animation for timer */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* Badge styles */
.badge-success {
  background: linear-gradient(135deg, #10B981, #059669);
}

.badge-warning {
  background: linear-gradient(135deg, #F59E0B, #D97706);
}

.badge-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
}

/* Glassmorphism effect */
.glass {
  background: rgba(31, 41, 55, 0.4);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(75, 85, 99, 0.2);
}

/* Bottom navigation shadow */
.bottom-nav {
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.5);
}

/* Safe area padding for iOS */
@supports(padding: max(0px)) {
  .pb-safe {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

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

.skeleton {
  background: linear-gradient(90deg, #1f2937 0px, #374151 40px, #1f2937 80px);
  background-size: 200px;
  animation: skeleton-loading 1.5s infinite;
}

/* ============================================================================
   MOBILE OPTIMIZATIONS (Pixel 9 Pro & Modern Smartphones)
   ============================================================================ */

/* Touch target minimum size (Apple & Google guidelines: 44x44px) */
button, 
a,
input[type="checkbox"],
input[type="radio"],
.touch-target {
  min-height: 44px;
  min-width: 44px;
}

/* Better tap highlight */
* {
  -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
  -webkit-touch-callout: none;
}

/* Prevent text selection on buttons */
button, .btn {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Improve input fields on mobile */
input,
textarea,
select {
  font-size: 16px !important; /* Prevents iOS zoom on focus */
  border-radius: 8px;
}

/* Better spacing for mobile */
@media (max-width: 640px) {
  .btn-large {
    min-height: 56px;
    font-size: 1.125rem;
    padding: 0.75rem 1.5rem;
  }
  
  /* Larger touch targets for charts */
  canvas {
    touch-action: manipulation;
  }
  
  /* Prevent horizontal scroll */
  body {
    overflow-x: hidden;
  }
  
  /* Better card spacing */
  .card {
    margin-bottom: 0.75rem;
  }
  
  /* Optimize set logger inputs */
  #set-weight,
  #set-reps {
    font-size: 2rem !important;
    height: 64px;
  }
  
  /* Better RIR slider for touch */
  input[type="range"]::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }
  
  input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }
}

/* Pixel 9 Pro specific (1344 x 2992 px, 19.5:9 ratio) */
@media (max-width: 428px) and (min-height: 926px) {
  /* Optimize for tall screens */
  .min-h-screen {
    min-height: 100vh;
    min-height: -webkit-fill-available;
  }
  
  /* Better chart height on tall screens */
  canvas {
    max-height: 250px;
  }
}

/* Improve Chart.js responsiveness */
.chart-container {
  position: relative;
  height: 250px;
  width: 100%;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .chart-container {
    height: 220px;
  }
}

/* Better notification positioning on mobile */
@media (max-width: 640px) {
  #notification {
    bottom: 80px; /* Above bottom navigation */
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}

/* Optimize bottom navigation for safe areas */
.bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Better modal/overlay for mobile */
@media (max-width: 640px) {
  .modal-overlay {
    padding: 1rem;
  }
  
  .modal-content {
    max-height: 85vh;
    overflow-y: auto;
  }
}
