/* Mobile Keyboard Viewport Fixes */

/* Prevent iOS zoom on input focus */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  textarea,
  select {
    font-size: 16px !important;
    -webkit-appearance: none;
    border-radius: 0;
  }
  
  /* Fix for search inputs */
  input[type="search"] {
    -webkit-appearance: none;
  }
  
  /* Fix for number inputs */
  input[type="number"] {
    -webkit-appearance: none;
    margin: 0;
  }
  
  /* Fix for select elements */
  select {
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
  }
}

/* Dynamic viewport height support */
@supports (height: 100dvh) {
  .mobile-viewport-height {
    height: 100dvh;
    min-height: 100dvh;
  }
}

/* Fallback for older browsers */
@supports not (height: 100dvh) {
  .mobile-viewport-height {
    height: 100vh;
    min-height: 100vh;
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  .mobile-viewport-height {
    height: -webkit-fill-available;
    min-height: -webkit-fill-available;
  }
  
  /* Fix for iOS Safari viewport issues */
  body {
    -webkit-overflow-scrolling: touch;
  }
}

/* Modal fixes for mobile keyboard */
@media screen and (max-width: 768px) {
  .modal-content {
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Ensure modals don't get cut off by keyboard */
  .modal-dialog {
    margin: 16px;
    max-height: calc(100dvh - 32px);
  }
}

/* Form container fixes */
@media screen and (max-width: 768px) {
  .form-container {
    padding-bottom: 80px; /* Space for bottom navigation */
  }
  
  /* Ensure inputs are visible when keyboard is open */
  .input-group {
    margin-bottom: 16px;
  }
  
  /* Fix for floating labels */
  .floating-label {
    position: relative;
  }
  
  .floating-label input:focus + label,
  .floating-label input:not(:placeholder-shown) + label {
    transform: translateY(-20px) scale(0.8);
  }
}

/* Prevent horizontal scroll on mobile */
@media screen and (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
  }
  
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }
} 