/* =========================================================
   Customization Modal - Layout & Structure (Refined)
   ========================================================= */

   #otherInputContainer {
    visibility: hidden;
    opacity: 0;
    height: auto;
    transition: opacity 0.3s ease-in-out;
  }
  
  #otherCheckbox:checked ~ #otherInputContainer {
    visibility: visible;
    opacity: 1;
  }
  
  /* ---------------------------------------------------------
     Close button
     --------------------------------------------------------- */

  #customizationModal .close-modal,
  #customizationModal .close-customization-modal {
    position: absolute;
    top: 8px;
    right: 8px;
    width: auto;
    height: auto;
    color: rgba(0, 0, 0, 0.7);
    background: none;
    background-color: transparent;
    border: none;
    border-radius: 0;
    text-align: center;
    cursor: pointer;
    z-index: 1056;
    font: inherit;
    line-height: 1;
    padding: 10px;
    box-shadow: none;
    appearance: none;
  }

  #customizationModal .close-modal i,
  #customizationModal .close-customization-modal i {
    color: inherit;
  }

  #customizationModal .close-modal:hover,
  #customizationModal .close-customization-modal:hover,
  #customizationModal .close-modal:focus,
  #customizationModal .close-customization-modal:focus {
    color: #000000;
  }

  /* ---------------------------------------------------------
     Form and Info Structure
     --------------------------------------------------------- */
  
  #customizationModal .form-group {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  
  #customizationModal .form-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 4px;
    gap: 8px;
    flex-wrap: nowrap;
  }
  
  #customizationModal .error-message {
    font-size: 12px;
    white-space: nowrap;
    display: inline-block;
    min-width: auto;
    flex-shrink: 0;
  }
  
  #customizationModal .char-counter {
    font-size: 12px;
    text-align: right;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    min-width: auto;
  }
  
  #customizationModal input.form-control {
    width: 100%;
  }
  
  #customizationModal .error-icon {
    position: absolute;
    right: 18px;
    top: 40%;
    cursor: pointer;
    font-size: 1.2rem;
  }
  
  #customizationModal .error-icon:hover {
    font-size: 1.5rem;
  }
  
  #customizationModal .reset-icon {
    position: absolute;
    right: 10px;
    top: 35px;
    cursor: pointer;
    z-index: 10;
  }
  
  /* ---------------------------------------------------------
     Condensed Modal Layout Adjustments
     --------------------------------------------------------- */
  
  #customizationModal .modal-dialog {
    max-width: 850px;
  }
  
  #customizationModal .modal-body {
    position: relative;
    flex: 1 1 auto;
    /* Extra right padding keeps form fields clear of the close control */
    padding: 16px 60px 0 20px;
  }
  
  #customizationModal .container-fluid {
    padding: 0; /* Removes Bootstrapâ€™s default spacing */
  }
  
  /* Reduce spacing around image */
  #customizationModal img.img-fluid,
  .preview-image {
    display: block;
    margin: 4px auto 8px auto; /* tighter vertical spacing */
    border: 1px solid #000;
    max-height: 34vh; /* slightly reduced */
    object-fit: contain;
  }
  
  /* Tighten up grid spacing slightly */
  #customizationModal .row.g-3 {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
  }
  
  /* Add a buffer equal to the button height before footer */
  #customizationModal .modal-body::after {
    content: "";
    display: block;
    height: 56px; /* approximate Add-to-Cart button height */
  }
  
  /* Keep footer snug */
  #customizationModal .modal-footer {
    padding: 12px 20px;
    border-top: none;
  }
  
  /* ---------------------------------------------------------
     General Layout
     --------------------------------------------------------- */
  
  #customizationModal,
  #customizationModal .modal-dialog,
  #customizationModal .modal-content {
    overflow: visible;
  }
  
  #container-customization {
    text-align: center;
    border-radius: 10px;
    padding: 10px;
  }
  
  #customizationModal input:focus {
    outline-offset: 2px;
    box-shadow: none;
  }
  
  .preview-image {
    max-width: 100%;
    height: auto;
  }
  
  .form-container {
    flex: 1;
  }
  
  @media (max-width: 768px) {
    .preview-image {
      max-width: 70%; /* reduce shrinkage on mobile */
    }
  }
  
  .product-pricing {
    display: flex;
    align-items: center;
  }
  
  .product-size-select {
    margin-left: auto;
  }
  
  /* Make the entire modal smaller overall */
  #customizationModal .modal-dialog {
    max-width: 750px; /* try 700â€“800px depending on your taste */
  }
  
  /* Keep modal content proportionate and tight */
  #customizationModal .modal-content {
    border-radius: 8px;
    overflow: hidden;
  }
  
  /* Limit the form width so it doesn't stretch awkwardly */
  #customizationModal .form-section {
    max-width: 90%; /* reduces width inside the 8-col area */
    margin: 0 auto; /* centers the form */
  }
  
  /* Adjust the image and form vertical alignment */
  #customizationModal .row.align-items-start {
    align-items: center !important; /* better centering between image/form */
  }
  
  /* Reduce image height slightly for better balance */
  #customizationModal img.img-fluid {
    max-height: 32vh;
    object-fit: contain;
    margin: 0 auto;
    display: block;
  }
  
  /* Make modal adapt its height to content */
  #customizationModal .modal-body {
    padding: 16px 60px 16px 20px;
    max-height: 80vh;
    overflow-y: auto;
  }

  @media (max-width: 767.98px) {
    #customizationModal .close-modal,
    #customizationModal .close-customization-modal {
      top: 4px;
      right: 4px;
      padding: 12px;
    }

    #customizationModal .modal-body {
      /* Stacked layout: reserve the top-right corner for the close control */
      padding: 56px 20px 16px 20px;
    }
  }