/* Custom Styles for CLOS Lyon Bariatric App */

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.gradient-bg {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

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

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

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

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

/* Animation for loading */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* Timeline styles */
.timeline-item {
  position: relative;
  padding-left: 2rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 100%;
  background: #e5e7eb;
}

.timeline-item::after {
  content: '';
  position: absolute;
  left: -4px;
  top: 0.5rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #667eea;
  border: 2px solid white;
  box-shadow: 0 0 0 2px #667eea;
}

.timeline-item.completed::after {
  background: #10b981;
  box-shadow: 0 0 0 2px #10b981;
}

.timeline-item.in-progress::after {
  background: #f59e0b;
  box-shadow: 0 0 0 2px #f59e0b;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 50;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  animation: fadeIn 0.3s;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-content {
  animation: slideIn 0.3s;
}

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

/* Button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Badge styles */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
}

/* Video player styles */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Calendar styles */
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s;
}

.calendar-day:hover {
  background: #f3f4f6;
}

.calendar-day.has-appointment {
  background: #dbeafe;
  border-color: #3b82f6;
}

.calendar-day.today {
  background: #667eea;
  color: white;
  font-weight: bold;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 0.3s ease;
}

/* Alert styles */
.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  border-left: 4px solid;
  margin-bottom: 1rem;
}

.alert-info {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}

.alert-warning {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.alert-success {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

.alert-danger {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

/* Print styles */
@media print {
  nav, .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
  }
  
  .page-break {
    page-break-before: always;
  }
}

/* ============================================================================
   MOBILE RESPONSIVE STYLES
   ============================================================================ */

/* Mobile Navigation */
.mobile-menu {
  display: none;
}

.mobile-menu.active {
  display: block;
}

.hamburger {
  display: none;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}

.hamburger span {
  display: block;
  width: 25px;
  height: 3px;
  background: white;
  transition: all 0.3s;
  border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile-specific utilities */
.touch-action-none {
  touch-action: none;
}

.overflow-x-auto-mobile {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Tablet and below (< 1024px) */
@media (max-width: 1023px) {
  /* Reduce padding on containers */
  .max-w-7xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Stack grid columns */
  .grid.grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid.grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Smaller cards */
  .card-hover {
    padding: 1rem;
  }
  
  /* Reduce font sizes */
  h1.text-3xl {
    font-size: 1.5rem;
  }
  
  h2.text-2xl {
    font-size: 1.25rem;
  }
  
  h2.text-xl {
    font-size: 1.125rem;
  }
}

/* Mobile phones (< 768px) */
@media (max-width: 767px) {
  /* Navigation */
  nav .flex.items-center.space-x-6 {
    display: none;
  }
  
  .hamburger {
    display: flex;
  }
  
  .mobile-menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 40;
  }
  
  .mobile-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: white;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: background 0.2s;
  }
  
  .mobile-menu a:hover {
    background: rgba(255,255,255,0.1);
  }
  
  /* Single column layout */
  .grid.grid-cols-4,
  .grid.grid-cols-3,
  .grid.grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  .lg\:grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  /* Full width modals */
  .modal-content {
    width: 95%;
    max-width: none;
    margin: 1rem;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  /* Responsive tables */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Stack form fields */
  form .grid.grid-cols-2,
  form .grid.grid-cols-3 {
    grid-template-columns: 1fr;
  }
  
  /* Smaller buttons on mobile */
  .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
  
  /* Cards spacing */
  .space-y-6 > * + * {
    margin-top: 1rem;
  }
  
  /* Compact stats cards */
  .bg-white.rounded-lg.shadow-md.p-6 {
    padding: 1rem;
  }
  
  /* Video grid */
  .grid.gap-6 {
    gap: 1rem;
  }
  
  /* Reduce icon sizes */
  .text-3xl {
    font-size: 2rem;
  }
  
  .text-2xl {
    font-size: 1.5rem;
  }
  
  /* Phase chart - horizontal scroll on mobile */
  #phaseChart.grid {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Appointments list - more compact */
  .flex.items-center.justify-between.p-4 {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem;
  }
  
  /* Patient cards - stack content */
  .flex.items-center.justify-between.p-3 {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .flex.items-center.justify-between.p-3 > .text-right {
    text-align: left;
    margin-top: 0.5rem;
    width: 100%;
  }
}

/* Small phones (< 375px) */
@media (max-width: 374px) {
  /* Even smaller padding */
  .max-w-7xl {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  .py-8 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
  
  /* Smaller fonts */
  body {
    font-size: 14px;
  }
  
  h1 {
    font-size: 1.25rem;
  }
  
  .btn {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
  }
  
  /* Compact cards */
  .bg-white.rounded-lg {
    padding: 0.75rem;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  /* Larger tap targets */
  button, a, input, select {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Remove hover effects on touch devices */
  .card-hover:hover {
    transform: none;
  }
  
  .btn:hover {
    transform: none;
  }
  
  /* Better touch feedback */
  button:active, a:active {
    opacity: 0.7;
  }
}

/* Landscape mode on phones */
@media (max-width: 767px) and (orientation: landscape) {
  /* Reduce header height */
  nav .h-16 {
    height: 3rem;
  }
  
  /* Compact layout */
  .py-8 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
}

/* iPad / Tablet Portrait (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  /* 2 column layout */
  .grid.grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .lg\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Slightly smaller padding */
  .p-6 {
    padding: 1.25rem;
  }
}

/* Dark mode support (if needed later) */
@media (prefers-color-scheme: dark) {
  /* Future dark mode styles */
}

/* Accessibility - Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* PWA specific */
@media (display-mode: standalone) {
  /* Add safe area for notch devices */
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

