/**
 * DeMV Platform - Responsive Vehicle Modal Styles
 * Enhanced responsive styling for vehicle modals
 */

/* Base modal styles for all device sizes */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  visibility: visible;

  backdrop-filter: blur(5px);
}

/* Orientation-specific modal adjustments */
@media screen and (orientation: landscape) {
  .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
  }
  
  .modal-body {
    overflow-y: auto;
    max-height: calc(90vh - 70px); /* Account for header height */
  }
  
  /* Special case for small height landscape (mobile phones) */
  @media (max-height: 500px) {
    .modal {
      align-items: flex-start;
      padding-top: 10px;
    }
    
    .modal-content {
      max-height: 95vh;
    }
    
    .modal-body {
      max-height: calc(95vh - 60px);
    }
    
    /* Compact form layout for landscape mobile - excluding rental modal */
    .form-step:not(#list-as-rental-modal .form-step):not(#list-as-rental-form .form-step) {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      overflow-y: auto;
    }
    
    /* Ensure rental modal form steps are not affected by grid layout */
    #list-as-rental-modal .form-step,
    #list-as-rental-form .form-step {
      display: none;
      grid-template-columns: unset !important;
      gap: unset !important;
    }
    
    #list-as-rental-modal .form-step.active,
    #list-as-rental-form .form-step.active {
      display: flex !important;
      flex-direction: column !important;
      width: 100% !important;
    }
    
    .form-step .form-group {
      margin-bottom: 10px;
    }
    
    .form-step .form-actions {
      grid-column: span 2;
    }
    
    /* More compact progress indicator */
    .form-progress {
      margin-bottom: 10px;
    }
    
    .progress-step .step-number {
      width: 25px;
      height: 25px;
      font-size: 0.9rem;
    }
    
    .progress-step .step-label {
      font-size: 0.8rem;
    }
  }
}

@media screen and (orientation: portrait) {
  .modal-content {
    width: 95%;
    max-width: 500px;
    max-height: 85vh;
  }
  
  .modal-body {
    overflow-y: auto;
    max-height: calc(85vh - 70px);
  }
  
  .form-step {
    display: flex;
    flex-direction: column;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .modal-content {
    max-width: 800px;
  }
  
  .form-row {
    display: flex;
    gap: 20px;
  }
  
  .form-row .form-group {
    flex: 1;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199px) {
  .modal-content {
    max-width: 700px;
  }
  
  .form-row {
    display: flex;
    gap: 15px;
  }
  
  .form-row .form-group {
    flex: 1;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
  .modal-content {
    max-width: 600px;
  }
  
  .form-row {
    display: flex;
    gap: 15px;
  }
  
  .form-row .form-group {
    flex: 1;
  }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767px) {
  .modal-content {
    max-width: 500px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .form-row .form-group {
    width: 100%;
  }
  
  .modal-header h2 {
    font-size: 1.5rem;
  }
  
  .form-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .form-actions button {
    width: 100%;
  }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575px) {
  .modal-content {
    width: 95%;
    border-radius: 12px;
  }
  
  .modal-header {
    padding: 15px;
  }
  
  .modal-header h2 {
    font-size: 1.4rem;
  }
  
  .modal-body {
    padding: 15px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .form-row .form-group {
    width: 100%;
  }
  
  .form-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .form-actions button {
    width: 100%;
  }
  
  /* More compact progress indicator */
  .form-progress {
    margin-bottom: 15px;
  }
  
  .progress-step .step-number {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }
  
  .progress-step .step-label {
    font-size: 0.8rem;
  }
}

/* Touch device optimizations */
@media (hover: none) {
  .modal .btn {
    padding: 12px 20px; /* Larger touch targets */
    /* No animation, transition, or transform */
  }
  
  .modal input, 
  .modal select, 
  .modal textarea {
    padding: 12px 15px; /* Larger touch targets */
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
  
  .close-modal {
    width: 40px;
    height: 40px;
  }
}
