/* Mobile-First CSS for MediApp - Optimized for Portrait Mobile Usage */

/* Import mobile-first design system */
@import url('./mobile-system.css');

/* Base styles - Mobile First */
:root {
  --primary-color: #0c3b69;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --info-color: #17a2b8;
  --secondary-color: #6c757d;
  --light-color: #ffffff;
  --dark-color: #212529;
  
  /* Mobile-optimized spacing (unified with mobile-system) */
  --mobile-padding: var(--spacing-lg);
  --mobile-margin: var(--spacing-md);
  --touch-target-size: var(--touch-comfortable);
  --mobile-font-size: var(--font-size-base);
  --mobile-small-font: var(--font-size-sm);
  --mobile-large-font: var(--font-size-lg);
  
  /* Safe areas for iPhone notch/dynamic island */
  --safe-area-top: var(--safe-top);
  --safe-area-bottom: var(--safe-bottom);
}

body {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  font-size: var(--mobile-font-size);
  line-height: 1.5;
  color: #495057;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: var(--safe-area-top);
  padding-bottom: var(--safe-area-bottom);
  min-height: 100vh;
}

/* Enhanced touch targets for mobile */
.btn {
  min-height: var(--touch-target-size);
  font-size: var(--mobile-font-size);
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn-sm {
  min-height: 40px;
  font-size: var(--mobile-small-font);
  padding: 0.5rem 0.75rem;
}

.btn-lg {
  min-height: 56px;
  font-size: var(--mobile-large-font);
  padding: 1rem 1.5rem;
}

/* Form controls optimized for mobile */
.form-control, .form-select {
  min-height: var(--touch-target-size);
  font-size: var(--mobile-font-size);
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #ced4da;
  background-color: #ffffff;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25), 0 1px 3px rgba(0, 0, 0, 0.1);
  outline: none;
  background-color: #ffffff;
}

/* Mobile-optimized cards */
.card {
  border-radius: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: var(--mobile-margin);
}

.card-body {
  padding: var(--mobile-padding);
}

/* Sticky controls optimized for mobile */
.sticky-controls {
  position: sticky;
  top: var(--safe-area-top);
  z-index: 1000;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 249, 250, 0.95));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: var(--mobile-padding);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin: 0 -15px var(--mobile-margin) -15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Mobile navigation */
.navbar {
  padding: var(--mobile-padding);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.navbar .btn-sm {
  font-size: var(--mobile-small-font);
  min-height: 36px;
}

.navbar .fw-semibold {
  font-size: var(--mobile-large-font);
  margin-top: 0.25rem;
}

/* Enhanced container spacing for mobile */
.container, .container-fluid {
  padding-left: var(--mobile-padding);
  padding-right: var(--mobile-padding);
}

/* Mobile-optimized alerts */
.alert {
  border-radius: 0.75rem;
  font-size: var(--mobile-font-size);
  padding: var(--mobile-padding);
  margin-bottom: var(--mobile-margin);
}

/* Progress bar for booking steps */
.progress {
  height: 8px;
  border-radius: 4px;
  background-color: #e9ecef;
  overflow: hidden;
}

.progress-bar {
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Mobile-optimized tables */
.table-responsive {
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table td, .table th {
  padding: var(--mobile-margin);
  font-size: var(--mobile-small-font);
  vertical-align: middle;
}

/* Mobile card layouts for table replacement */
.patient-card, .package-card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.75rem;
  transition: all 0.2s ease;
  cursor: default;
}

.patient-card:hover, .package-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 123, 255, 0.25);
}

.mobile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.mobile-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 0.25rem;
}

.mobile-card-info {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.mobile-card-info .info-icon {
  width: 20px;
  margin-right: 0.5rem;
  opacity: 0.7;
}

.mobile-card-actions {
  margin-top: 1rem;
  gap: 0.5rem;
}

.mobile-card-actions .btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  min-height: 36px;
}

/* Button groups for mobile */
.btn-group .btn {
  border-radius: 0.5rem;
}

.btn-group .btn:not(:last-child) {
  margin-right: 0.25rem;
}

/* Form check switches optimized for touch */
.form-check-input {
  width: 48px;
  height: 24px;
  border-radius: 12px;
  background-size: contain;
  transition: all 0.2s ease;
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* List groups for mobile */
.list-group-item {
  border-radius: 0.75rem !important;
  margin-bottom: 0.25rem;
  border: 1px solid #e9ecef;
  font-size: var(--mobile-font-size);
  padding: var(--mobile-margin);
}

.list-group-item:hover, .list-group-item:focus {
  background-color: #f8f9fa;
  border-color: var(--primary-color);
}

.list-group-item-action {
  cursor: pointer;
  transition: all 0.2s ease;
}

.list-group-item-action:active {
  background-color: #e9ecef;
  transform: translateY(1px);
}

/* Modal optimizations for mobile */
.modal-dialog {
  margin: var(--mobile-padding);
  max-width: calc(100vw - 2rem);
}

.modal-content {
  border-radius: 1rem;
  border: none;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
  padding: var(--mobile-padding);
  border-bottom: 1px solid #e9ecef;
}

.modal-body {
  padding: var(--mobile-padding);
}

.modal-footer {
  padding: var(--mobile-padding);
  border-top: 1px solid #e9ecef;
}

/* Badge optimizations */
.badge {
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  font-weight: 600;
}

/* Step indicators for booking form */
.step {
  animation: fadeIn 0.3s ease-in-out;
}

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

/* Tablet breakpoint (iPad, large Android tablets) */
@media (min-width: 768px) {
  :root {
    --mobile-padding: 1.5rem;
    --mobile-margin: 1rem;
  }
  
  .container, .container-fluid {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  
  .card-body {
    padding: 1.5rem;
  }
  
  .modal-dialog {
    max-width: 600px;
    margin: 3rem auto;
  }
  
  .table td, .table th {
    font-size: var(--mobile-font-size);
  }
}

/* Desktop breakpoint */
@media (min-width: 1024px) {
  :root {
    --mobile-padding: 1rem;
    --mobile-margin: 0.25rem;
    --touch-target-size: 44px;
  }
  
  .container {
    max-width: 1200px;
  }
  
  .sticky-controls {
    margin: 0;
    border-radius: 0.75rem;
    margin-bottom: var(--mobile-margin);
  }
  
  .card {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  }
}

/* High DPI displays optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .btn, .form-control, .form-select {
    border-width: 0.5px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --light-color: #ffffff;
    --dark-color: #1a1a1a;
    --primary-color: #4dabf7;
    --success-color: #51cf66;
    --warning-color: #ffd43b;
    --danger-color: #ff6b6b;
    --info-color: #74c0fc;
    --secondary-color: #868e96;
  }
  
  body {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #f8f9fa;
  }
  
  .card {
    background: #2d2d2d;
    color: #f8f9fa;
    border-color: #404040;
  }
  
  .sticky-controls, .navbar {
    background: rgba(45, 45, 45, 0.98);
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: #f8f9fa;
  }
  
  .form-control, .form-select {
    background: #343a40;
    border-color: #495057;
    color: #f8f9fa;
  }
  
  .form-control:focus, .form-select:focus {
    background: #495057;
    border-color: #4dabf7;
    color: #ffffff;
    box-shadow: 0 0 0 0.2rem rgba(77, 171, 247, 0.25);
  }
  
  .form-control::placeholder {
    color: #adb5bd;
  }
  
  .list-group-item {
    background: #343a40;
    border-color: #495057;
    color: #f8f9fa;
  }
  
  .list-group-item:hover {
    background: #495057;
    border-color: #4dabf7;
  }
  
  .btn-primary {
    background-color: #4dabf7;
    border-color: #4dabf7;
  }
  
  .btn-primary:hover {
    background-color: #339af0;
    border-color: #339af0;
  }
  
  .btn-outline-primary {
    color: #4dabf7;
    border-color: #4dabf7;
  }
  
  .btn-outline-primary:hover {
    background-color: #4dabf7;
    border-color: #4dabf7;
    color: #1a1a1a;
  }
  
  .btn-outline-secondary {
    color: #868e96;
    border-color: #868e96;
  }
  
  .btn-outline-secondary:hover {
    background-color: #868e96;
    border-color: #868e96;
    color: #1a1a1a;
  }
  
  .alert-info {
    background: rgba(116, 192, 252, 0.15);
    color: #74c0fc;
    border-color: rgba(116, 192, 252, 0.3);
  }
  
  .alert-warning {
    background: rgba(255, 212, 59, 0.15);
    color: #ffd43b;
    border-color: rgba(255, 212, 59, 0.3);
  }
  
  .alert-light {
    background: rgba(248, 249, 250, 0.05);
    color: #f8f9fa;
    border-color: rgba(248, 249, 250, 0.2);
  }
  
  .text-muted {
    color: #adb5bd !important;
  }
  
  .navbar-brand {
    color: #f8f9fa !important;
  }
  
  .modal-content {
    background: #2d2d2d;
    color: #f8f9fa;
    border-color: #404040;
  }
  
  .form-text {
    color: #fff !important;
  }

  .modal-header {
    border-bottom-color: #495057;
  }
  
  .modal-footer {
    border-top-color: #495057;
  }
  
  .table {
    color: #f8f9fa;
  }
  
  .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.05);
  }
  
  .badge {
    color: #1a1a1a;
  }
  
  .progress {
    background-color: #495057;
  }
}

/* Loading states */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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