/* 
 * CareHive Comprehensive Responsive Framework
 * Mobile-first approach with optimized breakpoints
 */

:root {
  --carehive-primary: #1089b9;
  --carehive-secondary: #0d6e91;
  --carehive-accent: #34D399;
  --carehive-text: #1F2937;
  --carehive-light: #F0FDF4;
  --carehive-gray: #F9FAFB;
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Base responsive typography using clamp() */
html {
  font-size: clamp(14px, 2.5vw, 16px);
}

body {
  line-height: 1.6;
  overflow-x: hidden;
}

/* Typography scaling */
h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  line-height: 1.3;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.3;
}

h4 {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  line-height: 1.4;
}

h5 {
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.4;
}

h6 {
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
  line-height: 1.4;
}

/* Container responsive improvements */
.container, .container-fluid {
  padding-left: clamp(15px, 3vw, 30px);
  padding-right: clamp(15px, 3vw, 30px);
}

/* Responsive spacing utilities */
.spacing-xs { margin: clamp(8px, 2vw, 16px); }
.spacing-sm { margin: clamp(16px, 3vw, 24px); }
.spacing-md { margin: clamp(24px, 4vw, 32px); }
.spacing-lg { margin: clamp(32px, 5vw, 48px); }
.spacing-xl { margin: clamp(48px, 6vw, 64px); }

/* Responsive padding utilities */
.padding-xs { padding: clamp(8px, 2vw, 16px); }
.padding-sm { padding: clamp(16px, 3vw, 24px); }
.padding-md { padding: clamp(24px, 4vw, 32px); }
.padding-lg { padding: clamp(32px, 5vw, 48px); }
.padding-xl { padding: clamp(48px, 6vw, 64px); }

/* Enhanced button responsiveness */
.btn {
  padding: clamp(10px, 2.5vw, 16px) clamp(20px, 4vw, 32px);
  font-size: clamp(0.875rem, 2vw, 1rem);
  border-radius: var(--border-radius-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 44px; /* Touch-friendly minimum */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-sm {
  min-height: 36px;
  padding: clamp(8px, 2vw, 12px) clamp(16px, 3vw, 24px);
  font-size: clamp(0.75rem, 1.8vw, 0.875rem);
}

.btn-lg {
  min-height: 52px;
  padding: clamp(14px, 3vw, 20px) clamp(28px, 5vw, 40px);
  font-size: clamp(1rem, 2.2vw, 1.125rem);
}

/* Form elements responsive improvements */
.form-control, .form-select {
  font-size: clamp(14px, 2.5vw, 16px);
  padding: clamp(12px, 2.5vw, 16px);
  border-radius: var(--border-radius-sm);
  min-height: 44px; /* Touch-friendly */
  transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
  transform: none; /* Prevent zoom on iOS */
}

/* Input group improvements */
.input-group .input-group-text {
  padding: clamp(12px, 2.5vw, 16px);
  font-size: clamp(14px, 2.5vw, 16px);
}

/* Card responsive improvements */
.card {
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.card-body {
  padding: clamp(16px, 4vw, 32px);
}

.card-header {
  padding: clamp(16px, 3vw, 24px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Modal responsive improvements */
.modal-dialog {
  margin: clamp(16px, 3vw, 32px);
  max-width: calc(100vw - 32px);
}

.modal-content {
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-body {
  padding: clamp(20px, 4vw, 40px);
}

/* Grid system improvements */
.row {
  margin-left: clamp(-8px, -2vw, -15px);
  margin-right: clamp(-8px, -2vw, -15px);
}

.row > * {
  padding-left: clamp(8px, 2vw, 15px);
  padding-right: clamp(8px, 2vw, 15px);
}

/* Image responsiveness */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Navigation responsive improvements */
.navbar {
  padding: clamp(12px, 2vw, 20px) 0;
}

.navbar-brand {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
}

.navbar-nav .nav-link {
  padding: clamp(8px, 2vw, 12px) clamp(12px, 2.5vw, 16px);
  font-size: clamp(0.9rem, 2vw, 1rem);
}

/* Breakpoint: Extra Small devices (320px to 575.98px) */
@media (max-width: 575.98px) {
  /* Ultra-compact mobile styles */
  .container, .container-fluid {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  /* Hide complex elements on very small screens */
  .hide-xs {
    display: none !important;
  }
  
  /* Stack all columns on very small screens */
  .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
    margin-bottom: 1rem;
  }
  
  /* Adjust typography for readability */
  body {
    font-size: 14px;
  }
  
  .btn {
    width: 100%;
    margin-bottom: 8px;
  }
  
  .btn-group-responsive .btn {
    width: 100%;
    border-radius: var(--border-radius-md) !important;
    margin-bottom: 8px;
  }
  
  /* Modal adjustments */
  .modal-dialog {
    margin: 8px;
    max-width: calc(100vw - 16px);
  }
  
  .modal-content {
    border-radius: var(--border-radius-md);
  }
}

/* Breakpoint: Small devices (576px to 767.98px) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .hide-sm {
    display: none !important;
  }
  
  /* Better use of space on small tablets/large phones */
  .btn-group-responsive {
    display: flex;
    gap: 8px;
  }
  
  .btn-group-responsive .btn {
    flex: 1;
  }
}

/* Breakpoint: Medium devices (768px to 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
  .hide-md {
    display: none !important;
  }
  
  /* Tablet optimizations */
  .row > [class*="col-md-"] {
    padding-bottom: 1rem;
  }
}

/* Breakpoint: Large devices (992px to 1199.98px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .hide-lg {
    display: none !important;
  }
}

/* Breakpoint: Extra large devices (1200px and up) */
@media (min-width: 1200px) {
  .hide-xl {
    display: none !important;
  }
  
  /* Desktop optimizations */
  .container {
    max-width: 1200px;
  }
}

/* Specific component responsive styles */

/* Step Progress Indicator */
.step-progress {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(24px, 4vw, 32px);
  overflow-x: auto;
  padding: 10px 0;
}

.step-progress::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: #E5E7EB;
  z-index: 1;
}

.progress-line {
  position: absolute;
  top: 50%;
  left: 0;
  height: 2px;
  background: var(--carehive-primary);
  z-index: 2;
  transition: width 0.3s ease;
}

.step-item {
  background: white;
  width: clamp(32px, 6vw, 40px);
  height: clamp(32px, 6vw, 40px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  border: 3px solid #E5E7EB;
  z-index: 3;
  position: relative;
  flex-shrink: 0;
  font-size: clamp(0.75rem, 1.5vw, 1rem);
}

/* Subscription/Package Cards */
.subscription-cards, .package-selection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(16px, 3vw, 24px);
  margin: clamp(20px, 4vw, 30px) 0;
}

.subscription-card, .package-card {
  border: 2px solid #E5E7EB;
  border-radius: var(--border-radius-lg);
  padding: clamp(20px, 4vw, 32px);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  background: white;
}

.subscription-card:hover, .package-card:hover,
.subscription-card.selected, .package-card.selected {
  border-color: var(--carehive-primary);
  background: var(--carehive-light);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* Quiz Interface */
.quiz-container {
  max-width: 100%;
}

.question-card {
  background: white;
  border-radius: var(--border-radius-md);
  padding: clamp(20px, 4vw, 32px);
  margin-bottom: clamp(16px, 3vw, 24px);
  box-shadow: var(--shadow-sm);
  border: 1px solid #E5E7EB;
}

.quiz-option {
  background: white;
  border: 2px solid #E5E7EB;
  border-radius: var(--border-radius-sm);
  padding: clamp(12px, 2.5vw, 16px);
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: block;
  width: 100%;
  text-align: left;
}

.quiz-option:hover, .quiz-option.selected {
  border-color: var(--carehive-primary);
  background: var(--carehive-light);
}

/* File Upload Areas */
.upload-area {
  border: 2px dashed #E5E7EB;
  border-radius: var(--border-radius-md);
  padding: clamp(24px, 5vw, 48px);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #FAFAFA;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-area:hover {
  border-color: var(--carehive-primary);
  background: var(--carehive-light);
}

/* File Preview */
.file-preview {
  max-width: 150px;
  max-height: 150px;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-sm);
  margin: 8px auto;
}

/* Navigation Buttons */
.step-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: clamp(24px, 4vw, 40px);
  padding-top: clamp(20px, 3vw, 30px);
  border-top: 1px solid #E5E7EB;
  gap: 16px;
}

/* Responsive breakpoint adjustments */
@media (max-width: 575.98px) {
  /* Ultra-small screen adjustments */
  .step-progress {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 16px;
    padding: 10px 16px;
  }
  
  .step-progress::before {
    display: none; /* Hide connecting line on very small screens */
  }
  
  .subscription-cards, .package-selection {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .subscription-card, .package-card {
    padding: 20px;
  }
  
  .step-navigation {
    flex-direction: column;
    gap: 12px;
  }
  
  .step-navigation .btn {
    width: 100%;
  }
  
  .quiz-container .question-card {
    padding: 16px;
  }
  
  .upload-area {
    padding: 20px;
    min-height: 100px;
  }
}

@media (max-width: 767.98px) {
  /* Small screen adjustments */
  .form-card {
    margin: 0;
    border-radius: var(--border-radius-md);
  }
  
  .signup-container {
    padding: 16px;
  }
  
  .step-header {
    padding: 20px;
    margin-bottom: 20px;
  }
  
  .subscription-cards, .package-selection {
    grid-template-columns: 1fr;
  }
  
  /* Better mobile form layout */
  .row .col-md-6 {
    margin-bottom: 1rem;
  }
}

/* Print styles */
@media print {
  .step-navigation,
  .mobile-nav-toggle,
  .btn:not(.no-print) {
    display: none !important;
  }
  
  .form-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .card, .form-control, .btn {
    border-width: 2px;
  }
}

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

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
  .card {
    background-color: #1f2937;
    color: white;
  }
  
  .form-control {
    background-color: #374151;
    border-color: #4B5563;
    color: white;
  }
}