/* Mobile Responsive Fixes for du.ae clone */
/* CRITICAL: All fixes are inside media queries ONLY - do NOT affect desktop */

/* ===== MOBILE (max-width: 899px) ===== */
@media (max-width: 899px) {
  
  /* ===== FIX #1: Form control min-width overflow =====
     The .muirtl-24oggn class has min-width: 400px which overflows 375px mobile screens.
     Override min-width to fit within the viewport. */
  .muirtl-24oggn,
  .MuiFormControl-root.MuiTextField-root {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  
  /* ===== FIX #1b: Increase input height and put label inside ===== */
  /* Increase the input field height */
  .MuiOutlinedInput-root {
    min-height: 56px !important;
  }
  
  .MuiOutlinedInput-input {
    padding: 16px 14px !important;
    height: auto !important;
  }
  
  /* Move the label inside the input field (as placeholder text) */
  .MuiInputLabel-root {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 14px !important;
    left: auto !important;
    color: #999 !important;
    font-size: 14px !important;
    pointer-events: none !important;
    transition: all 0.2s ease !important;
    background: transparent !important;
  }
  
  /* When focused or has value - float label to top */
  .MuiInputLabel-shrink,
  .MuiInputLabel-root.Mui-focused,
  .MuiFormControl-root:focus-within .MuiInputLabel-root {
    top: 0 !important;
    transform: translateY(-50%) scale(0.75) !important;
    font-size: 12px !important;
    color: #702c8b !important;
    background: white !important;
    padding: 0 4px !important;
    right: 10px !important;
  }
  
  /* Make the fieldset/outline taller too */
  .MuiOutlinedInput-notchedOutline {
    min-height: 56px !important;
  }
  
  /* ===== FIX #2: Amount page padding reduction =====
     The .muirtl-fheosv container has padding: 0 40px 40px which makes the input too narrow.
     Reduce padding on mobile for more space. */
  .muirtl-fheosv {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  
  /* Amount content area - reduce padding on mobile */
  .amount-content-area {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  
  /* ===== FIX #3: Credit card page heading overflow =====
     The h3#paymentSection heading needs proper containment on mobile */
  #paymentSection {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
  }
  
  /* ===== FIX #4: General overflow prevention ===== */
  .MuiBox-root,
  .MuiContainer-root {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  
  /* Ensure the main app doesn't overflow */
  .App {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  
  /* ===== FIX #5: Main content grid - stack vertically ===== */
  .muirtl-uyfs2b {
    flex-basis: 100% !important;
    max-width: 100% !important;
  }
  
  .muirtl-10dahps {
    flex-basis: 100% !important;
    max-width: 100% !important;
  }
  
  /* ===== FIX #6: Show nav links in header on mobile ===== */
  /* Hide the login button (الدخول) */
  .jss14 {
    display: none !important;
  }
  
  /* Show the secondary nav container but position it in the header */
  .muirtl-1bvc4cc {
    display: block !important;
    position: absolute !important;
    top: 12px !important;
    right: 100px !important;
    left: auto !important;
    z-index: 200 !important;
    background: transparent !important;
    overflow: visible !important;
  }
  
  /* Make the list horizontal */
  .muirtl-1bvc4cc .jss11.MuiList-root {
    display: flex !important;
    flex-direction: row !important;
    padding: 0 !important;
    gap: 12px !important;
    border-top: none !important;
    border-bottom: 1px solid #eee !important;
    padding-bottom: 2px !important;
    margin-bottom: 0 !important;
  }
  
  /* Style the list items */
  .muirtl-1bvc4cc .MuiListItem-root {
    padding: 0 !important;
    width: auto !important;
  }
  
  /* Style the links */
  .muirtl-1bvc4cc .MuiListItem-root a {
    font-size: 12px !important;
    color: #333 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
  }

  /* Move the purple active indicator down so it doesn't hit the heading below */
  .muirtl-1bvc4cc .MuiListItem-root a::after,
  .jss11 .MuiLink-root::after,
  .jss9.MuiLink-root::after,
  .muirtl-1bvc4cc .MuiLink-root::after,
  .muirtl-1bvc4cc a.MuiLink-root::after {
    bottom: -18px !important;
  }
  
  /* Hide تحديث بطاقة الهوية (3rd item) on mobile */
  .muirtl-1bvc4cc .MuiListItem-root:nth-child(3) {
    display: none !important;
  }
  
  /* ===== FIX #6b: Show language button in mobile header next to logo ===== */
  /* Hide the entire top bar (muirtl-10929pm contains the English btn row) */
  .muirtl-10929pm {
    display: none !important;
  }
  
  /* Hide the main navigation (الأجهزة, الباقات, etc.) on mobile */
  .jss16 {
    display: none !important;
  }
  
  /* The logo row container (muirtl-1wndsnp) - make it a flex row with space-between */
  .muirtl-1wndsnp {
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 4px 12px 16px !important;
    margin-left: -8px !important;
    margin-right: -8px !important;
  }
  
  /* In LTR (English) mode, reverse the flex direction and padding */
  [dir="ltr"] .muirtl-1wndsnp {
    flex-direction: row !important;
    padding: 12px 16px 12px 0px !important;
    margin-left: -16px !important;
    margin-right: -8px !important;
  }
  
  /* The logo grid item - auto width */
  .muirtl-s6rwg2 {
    flex: 0 0 auto !important;
  }
  
  /* The grid-md-7 item that contains the second muirtl-1d3bbye (with logo) */
  .muirtl-uyfs2b {
    flex: 0 0 auto !important;
    max-width: none !important;
  }
  
  /* Add a language button via CSS ::after on the logo row */
  /* Actually, we need to show the English button from the hidden top bar */
  /* Better approach: use position:absolute to place the lang button next to logo */
  .muirtl-10929pm {
    display: block !important;
    position: absolute !important;
    top: 16px !important;
    left: 16px !important;
    right: auto !important;
    width: auto !important;
    height: auto !important;
    z-index: 200 !important;
  }
  
  /* In LTR (English) mode, move language button to the right side */
  [dir="ltr"] .muirtl-10929pm {
    left: auto !important;
    right: 16px !important;
  }
  
  /* Hide everything in the top bar except the language button */
  .muirtl-1393ond {
    display: block !important;
  }
  
  .muirtl-1393ond .muirtl-1d3bbye {
    display: block !important;
    max-width: none !important;
    overflow: visible !important;
  }
  
  /* Hide the other grid item in the top bar (الأفراد/الأعمال) */
  .muirtl-1udr1mz {
    display: none !important;
  }
  
  /* Hide AA button on mobile */
  .muirtl-vrt3y5 {
    display: none !important;
  }
  
  /* Hide search button on mobile */
  .muirtl-11vqwm9 {
    display: none !important;
  }
  
  /* Make the language button visible with dark color */
  .muirtl-80skus {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #702c8b !important;
  }
  
  /* Make the jss15 header visible on mobile */
  .jss15 {
    height: auto !important;
    overflow: visible !important;
    position: relative !important;
  }
  
  /* ===== FIX #7: Purple section - phone image and text grid ===== */
  .muirtl-14ybvol {
    flex-basis: 100% !important;
    max-width: 100% !important;
    text-align: center;
  }
  
  .muirtl-13ldt23 {
    flex-basis: 60% !important;
    max-width: 60% !important;
    margin: 20px auto !important;
  }
  
  /* Purple section container - stack vertically */
  .muirtl-17v1qt9 {
    flex-direction: column;
    align-items: center;
  }
  
  /* ===== FIX #8: App store buttons - center on mobile ===== */
  .muirtl-fto86y {
    justify-content: center !important;
  }
  
  /* ===== FIX #9: Footer - stack vertically ===== */
  .muirtl-z72k3s {
    flex-basis: 100% !important;
    max-width: 100% !important;
    text-align: center !important;
  }
  
  .muirtl-z72k3s .MuiList-root {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  /* ===== FIX #10: Main container padding ===== */
  .muirtl-4q4avz {
    padding-right: 16px !important;
    padding-left: 16px !important;
  }
  
  /* ===== FIX #11: Form container - full width ===== */
  .MuiFormControl-root {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* ===== FIX #12: Submit button - full width on mobile ===== */
  .jss19 {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* ===== FIX #13: Bank transfer card - full width ===== */
  .MuiCardActionArea-root {
    width: 100% !important;
  }
  
  /* ===== FIX #14: Accepted cards section - center text ===== */
  .muirtl-1eiz73c {
    justify-content: center;
  }
  
  /* ===== FIX #15: Title font size reduction for mobile ===== */
  .muirtl-1r0nl55 {
    font-size: 22px !important;
    line-height: 30px !important;
  }
  
  /* Purple section title */
  .muirtl-1tj5blp {
    font-size: 20px !important;
    line-height: 28px !important;
  }
  
  /* ===== FIX #16: Recharge amount section - full width on mobile ===== */
  .jss20 {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  
  .muirtl-fheosv {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 8px !important;
  }
  
  /* Reduce spacing above payment heading on credit card page */
  .muirtl-1f9obds {
    margin-top: 16px !important;
  }
  
  .MuiTypography-h3.MuiTypography-gutterBottom {
    margin-top: 16px !important;
  }
  
  /* Recharge submit button */
  .recharge-submit {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  /* ===== FIX #17: Credit card form fields - full width ===== */
  .MuiGrid-grid-md-7,
  .MuiGrid-grid-md-5,
  .MuiGrid-grid-md-8,
  .MuiGrid-grid-md-4 {
    flex-basis: 100% !important;
    max-width: 100% !important;
  }
  
  /* ===== FIX #18: Credit card page - payment section grid ===== */
  .muirtl-6au7ll {
    flex-basis: 100% !important;
    max-width: 100% !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  
  /* ===== FIX #19: Input fields - ensure proper sizing ===== */
  .MuiOutlinedInput-root {
    width: 100% !important;
  }
  
  .MuiInputBase-root {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* ===== FIX #20: muirtl-ukiypn min-width fix (amount page) ===== */
  .muirtl-ukiypn {
    min-width: 0 !important;
    width: 100% !important;
  }
}

/* ===== SMALL MOBILE (max-width: 480px) ===== */
@media (max-width: 480px) {
  
  /* Phone image - smaller on very small screens */
  .muirtl-13ldt23 {
    flex-basis: 80% !important;
    max-width: 80% !important;
  }
  
  /* Secondary nav - smaller font */
  .jss11 .MuiLink-root {
    font-size: 12px !important;
    padding: 10px 6px !important;
  }
  
  /* Recharge amount cards - wrap properly */
  .muirtl-1udr1mz {
    flex-basis: 33.33% !important;
    max-width: 33.33% !important;
  }
  
  /* ===== FIX #8: App section - phone image above store buttons on mobile ===== */
  .muirtl-fto86y {
    flex-direction: column-reverse !important;
  }
  .muirtl-fto86y > .MuiGrid-grid-xs-9 {
    max-width: 100% !important;
    flex-basis: 100% !important;
  }
  .muirtl-fto86y > .MuiGrid-grid-xs-3 {
    max-width: 100% !important;
    flex-basis: 100% !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
  }
  .muirtl-fto86y > .MuiGrid-grid-xs-3 img {
    width: 200px !important;
    height: auto !important;
  }

  /* Credit card payment grid items - stack on very small screens */
  .MuiGrid-grid-xs-6 {
    flex-basis: 100% !important;
    max-width: 100% !important;
  }
  
  /* Even smaller padding on very small screens */
  .muirtl-fheosv,
  .jss20 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  .amount-content-area {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}
