/**
 * EditCarddetails Mobile Optimization CSS
 * Specific styles for sections/EditCarddetails.js mobile responsiveness
 * Fixes centering issues and component scaling conflicts
 */

/* Mobile devices - Primary breakpoint */
@media screen and (max-width: 768px) {
  
  /* Fix EditCarddetails editablearea to match CardNavigator approach */
  #editablearea.newflex111 {
    /* Ensure flex centering works properly */
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    
    /* Container sizing - match CardNavigator */
    padding: 10px !important;
    overflow: visible !important;
    
    /* Remove any Bootstrap conflicts */
    margin-left: 0 !important;
    margin-right: 0 !important;
    
    /* Fit container to content */
    height: auto !important;
    min-height: 500px !important;
  }

  /* Touch handlers are now directly on #editablearea - no intermediate div needed */

  /* Card container specific to EditCarddetails - proportional scaling */
  #editablearea #editorPad.main_customize_container {
    /* Responsive width */
    width: calc(100vw - 30px) !important;
    max-width: 450px !important;
    
    /* Proportional height - scale with width */
    height: calc((100vw - 30px) * (630 / 450)) !important;
    max-height: 630px !important;
    
    /* Centering */
    margin: 0 auto !important;
    
    /* Keep other desktop properties */
    position: relative !important;
    overflow: hidden !important;
  }

  /* Fix card page spacing issues */
  #editablearea #editorPad li {
    /* Remove any default spacing */
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
  }

  /* Card images - fix spacing and display - override secondStepMobile.css */
  #editablearea #editorPad .setc98 {
    width: 100% !important;
    height: 100% !important; /* Override the height: auto from secondStepMobile.css */
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    object-fit: cover !important;
    max-height: none !important; /* Remove any max-height constraints */
  }

  /* Mobile navigation specific to EditCarddetails */
  #editablearea .carousel-buttons {
    position: absolute !important;
    bottom: -60px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 20 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 15px !important;
  }

  /* Carousel buttons styling */
  #editablearea .carousel-button {
    background: rgba(109, 191, 184, 0.95) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    color: white !important;
    font-size: 18px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  }

  #editablearea .carousel-button:hover {
    background: rgba(109, 191, 184, 1) !important;
    transform: scale(1.1) !important;
  }

  #editablearea .carousel-button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
  }

  /* Dots container styling */
  #editablearea .dots-container {
    background: rgba(0, 0, 0, 0.7) !important;
    border-radius: 20px !important;
    padding: 8px 12px !important;
    display: flex !important;
    gap: 5px !important;
    align-items: center !important;
  }

  /* Individual dots */
  #editablearea .dot {
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    border: none !important;
    background-color: rgba(255, 255, 255, 0.5) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
  }

  #editablearea .dot.active {
    background-color: #81dbcd !important;
    transform: scale(1.2) !important;
  }

  /* Overlay buttons specific to EditCarddetails */
  #editablearea #editorPad .overlay-buttons {
    position: absolute !important;
    bottom: 15px !important;
    right: 15px !important;
    z-index: 100 !important;
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
  }

  /* Debug indicator styling */
  .debug-scale-indicator {
    position: fixed !important;
    top: 10px !important;
    right: 10px !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    padding: 5px 10px !important;
    border-radius: 5px !important;
    font-size: 12px !important;
    z-index: 9999 !important;
    font-family: monospace !important;
  }

  /* Calendar/time picker overlay on mobile - ensure it doesn't overflow */
  .formdown2 .input-group.input-append.date {
    left: 0 !important;
    right: 0 !important;
    max-width: 100% !important;
  }

  /* Collab container reduced padding on edit-card */
  .collab-container {
    padding-top: 30px !important;
    padding-bottom: 40px !important;
  }
}

/* Small mobile devices - Additional adjustments */
@media screen and (max-width: 576px) {
  #editablearea {
    padding: 10px !important;
  }

  #editablearea #editorPad.main_customize_container {
    width: calc(100vw - 20px) !important;
  }

  /* Smaller navigation elements */
  #editablearea .carousel-button {
    width: 40px !important;
    height: 40px !important;
    font-size: 16px !important;
  }
}

/* Very small mobile devices - Ultra compact */
@media screen and (max-width: 375px) {
  #editablearea {
    padding: 8px !important;
  }

  #editablearea #editorPad.main_customize_container {
    width: calc(100vw - 16px) !important;
  }

  /* Ultra compact navigation */
  #editablearea .carousel-button {
    width: 36px !important;
    height: 36px !important;
    font-size: 14px !important;
  }
}

/* Desktop - ensure no conflicts */
@media screen and (min-width: 769px) {
  /* Reset any mobile overrides for desktop - match CardNavigator approach */
  #editablearea.newflex111 {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    height: 640px !important;
    padding: 0 !important;
  }
  
  #editablearea #editorPad.main_customize_container {
    width: 450px !important;
    height: 630px !important;
    margin: 0 auto !important;
  }
}