/* ==========================================================================
   Mobile Optimization CSS - Maison du Croissant
   Specific fixes for mobile Android & iPhone display issues
   ========================================================================== */

/* ===== MOBILE-FIRST BASE STYLES ===== */
@media screen and (max-width: 768px) {
  
  /* Reset font sizes for mobile */
  html {
    font-size: 14px !important;
  }
  
  body {
    font-size: 14px !important;
    line-height: 1.4 !important;
    overflow-x: hidden !important;
  }
  
  /* ===== CONTAINER FIXES ===== */
  .container,
  .container-fluid {
    padding-left: 10px !important;
    padding-right: 10px !important;
    max-width: 100% !important;
    margin: 0 auto !important;
  }
  
  /* ===== HERO SECTION MOBILE ===== */
  .hero-header,
  .page-header {
    height: 200px !important;
    min-height: 200px !important;
  }
  
  .hero-header h1,
  .page-header h1 {
    font-size: 1.8rem !important;
    line-height: 1.2 !important;
    margin-bottom: 10px !important;
  }
  
  .hero-header p,
  .page-header p {
    font-size: 0.9rem !important;
    line-height: 1.3 !important;
  }
  
  /* ===== NAVBAR MOBILE ===== */
  .navbar {
    padding: 8px 10px !important;
  }
  
  .navbar-brand {
    font-size: 1.1rem !important;
    padding: 5px 0 !important;
  }
  
  .navbar-nav .nav-link {
    font-size: 0.9rem !important;
    padding: 8px 12px !important;
  }
  
  .navbar-toggler {
    padding: 4px 6px !important;
    font-size: 1rem !important;
  }
  
  /* ===== MENU ITEMS MOBILE ===== */
  .fruite-item,
  .menu-item,
  .product-item {
    margin-bottom: 15px !important;
    padding: 10px !important;
  }
  
  .fruite-item img,
  .menu-item img,
  .product-item img {
    width: 100% !important;
    height: 150px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
  }
  
  .fruite-item h4,
  .menu-item h4,
  .product-item h4 {
    font-size: 1rem !important;
    line-height: 1.2 !important;
    margin: 8px 0 5px 0 !important;
  }
  
  .fruite-item p,
  .menu-item p,
  .product-item p {
    font-size: 0.8rem !important;
    line-height: 1.3 !important;
    margin-bottom: 8px !important;
  }
  
  .fruite-item .price,
  .menu-item .price,
  .product-item .price {
    font-size: 1rem !important;
    font-weight: bold !important;
    margin-bottom: 8px !important;
  }
  
  /* ===== BUTTON FIXES MOBILE ===== */
  .btn {
    font-size: 0.8rem !important;
    padding: 8px 12px !important;
    margin: 3px !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
    min-width: auto !important;
    display: inline-block !important;
  }
  
  .btn-sm {
    font-size: 0.75rem !important;
    padding: 6px 10px !important;
  }
  
  .btn-lg {
    font-size: 0.9rem !important;
    padding: 10px 16px !important;
  }
  
  /* Button groups on mobile */
  .btn-group {
    flex-wrap: wrap !important;
    gap: 5px !important;
  }
  
  .btn-group .btn {
    flex: 1 1 auto !important;
    margin: 2px !important;
  }
  
  /* ===== TABLE FIXES MOBILE ===== */
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border: none !important;
    margin-bottom: 15px !important;
  }
  
  .table {
    font-size: 0.8rem !important;
    margin-bottom: 0 !important;
    min-width: 300px !important;
  }
  
  .table th,
  .table td {
    padding: 6px 8px !important;
    vertical-align: middle !important;
    border-top: 1px solid #dee2e6 !important;
  }
  
  .table th {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    background-color: #f8f9fa !important;
  }
  
  /* Mobile table stack */
  .table-mobile-stack {
    display: block !important;
  }
  
  .table-mobile-stack thead,
  .table-mobile-stack tbody,
  .table-mobile-stack th,
  .table-mobile-stack td,
  .table-mobile-stack tr {
    display: block !important;
  }
  
  .table-mobile-stack thead tr {
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
  }
  
  .table-mobile-stack tr {
    border: 1px solid #ccc !important;
    margin-bottom: 10px !important;
    padding: 10px !important;
    border-radius: 6px !important;
    background: #fff !important;
  }
  
  .table-mobile-stack td {
    border: none !important;
    position: relative !important;
    padding-left: 30% !important;
    text-align: left !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }
  
  .table-mobile-stack td:before {
    content: attr(data-label) ":" !important;
    position: absolute !important;
    left: 6px !important;
    width: 25% !important;
    padding-right: 10px !important;
    white-space: nowrap !important;
    font-weight: bold !important;
    color: #d4af37 !important;
  }
  
  /* ===== CARD FIXES MOBILE ===== */
  .card {
    margin-bottom: 15px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
  }
  
  .card-body {
    padding: 12px !important;
  }
  
  .card-title {
    font-size: 1rem !important;
    margin-bottom: 8px !important;
  }
  
  .card-text {
    font-size: 0.85rem !important;
    line-height: 1.3 !important;
  }
  
  /* ===== FORM FIXES MOBILE ===== */
  .form-control {
    font-size: 16px !important; /* Prevent zoom on iOS */
    padding: 10px 12px !important;
    border-radius: 6px !important;
  }
  
  .form-label {
    font-size: 0.9rem !important;
    margin-bottom: 5px !important;
  }
  
  .input-group {
    flex-wrap: nowrap !important;
  }
  
  .input-group .btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  
  /* ===== MODAL FIXES MOBILE ===== */
  .modal-dialog {
    margin: 10px !important;
    max-width: calc(100% - 20px) !important;
  }
  
  .modal-content {
    border-radius: 8px !important;
  }
  
  .modal-header {
    padding: 12px 15px !important;
  }
  
  .modal-body {
    padding: 15px !important;
  }
  
  .modal-footer {
    padding: 10px 15px !important;
  }
  
  .modal-title {
    font-size: 1.1rem !important;
  }
  
  /* ===== SPACING FIXES MOBILE ===== */
  .mb-1 { margin-bottom: 0.25rem !important; }
  .mb-2 { margin-bottom: 0.5rem !important; }
  .mb-3 { margin-bottom: 0.75rem !important; }
  .mb-4 { margin-bottom: 1rem !important; }
  .mb-5 { margin-bottom: 1.5rem !important; }
  
  .mt-1 { margin-top: 0.25rem !important; }
  .mt-2 { margin-top: 0.5rem !important; }
  .mt-3 { margin-top: 0.75rem !important; }
  .mt-4 { margin-top: 1rem !important; }
  .mt-5 { margin-top: 1.5rem !important; }
  
  .p-1 { padding: 0.25rem !important; }
  .p-2 { padding: 0.5rem !important; }
  .p-3 { padding: 0.75rem !important; }
  .p-4 { padding: 1rem !important; }
  .p-5 { padding: 1.5rem !important; }
  
  /* ===== GRID FIXES MOBILE ===== */
  .row {
    margin-left: -5px !important;
    margin-right: -5px !important;
  }
  
  .col,
  [class*="col-"] {
    padding-left: 5px !important;
    padding-right: 5px !important;
  }
  
  /* Force single column on mobile */
  .col-mobile-12 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  
  /* ===== FOOTER MOBILE ===== */
  .footer {
    padding: 20px 0 !important;
  }
  
  .footer .container {
    padding: 0 10px !important;
  }
  
  .footer h5 {
    font-size: 1rem !important;
    margin-bottom: 10px !important;
  }
  
  .footer p,
  .footer a {
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
  }
  
  /* ===== UTILITY CLASSES MOBILE ===== */
  .text-mobile-center {
    text-align: center !important;
  }
  
  .text-mobile-left {
    text-align: left !important;
  }
  
  .d-mobile-none {
    display: none !important;
  }
  
  .d-mobile-block {
    display: block !important;
  }
  
  .d-mobile-inline {
    display: inline !important;
  }
  
  .d-mobile-inline-block {
    display: inline-block !important;
  }
  
  .w-mobile-100 {
    width: 100% !important;
  }
  
  /* ===== SCROLL FIXES ===== */
  .scroll-horizontal {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  .scroll-horizontal::-webkit-scrollbar {
    height: 6px !important;
  }
  
  .scroll-horizontal::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    border-radius: 3px !important;
  }
  
  .scroll-horizontal::-webkit-scrollbar-thumb {
    background: #d4af37 !important;
    border-radius: 3px !important;
  }
  
  /* ===== TOUCH IMPROVEMENTS ===== */
  .btn,
  .card,
  .nav-link,
  a {
    -webkit-tap-highlight-color: rgba(212, 175, 55, 0.2) !important;
    touch-action: manipulation !important;
  }
  
  /* Minimum touch target size */
  .btn,
  .nav-link,
  .form-control,
  input[type="button"],
  input[type="submit"],
  button {
    min-height: 44px !important;
    min-width: 44px !important;
  }
}

/* ===== EXTRA SMALL MOBILE (320px-480px) ===== */
@media screen and (max-width: 480px) {
  html {
    font-size: 13px !important;
  }
  
  .container,
  .container-fluid {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  
  .hero-header h1,
  .page-header h1 {
    font-size: 1.5rem !important;
  }
  
  .btn {
    font-size: 0.75rem !important;
    padding: 6px 10px !important;
  }
  
  .table {
    font-size: 0.75rem !important;
  }
  
  .modal-dialog {
    margin: 5px !important;
    max-width: calc(100% - 10px) !important;
  }
}

/* ===== LANDSCAPE MOBILE FIXES ===== */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .hero-header,
  .page-header {
    height: 150px !important;
    min-height: 150px !important;
  }
  
  .hero-header h1,
  .page-header h1 {
    font-size: 1.3rem !important;
  }
  
  .navbar {
    padding: 5px 10px !important;
  }
}

/* ===== MENU SPECIFIC MOBILE FIXES ===== */
@media screen and (max-width: 768px) {
  
  /* Menu item cards mobile */
  .fruite-item .card-body {
    padding: 8px !important;
  }
  
  .fruite-item .card-title {
    font-size: 0.9rem !important;
    line-height: 1.2 !important;
    margin-bottom: 5px !important;
  }
  
  .fruite-item .card-text {
    font-size: 0.75rem !important;
    line-height: 1.2 !important;
    margin-bottom: 5px !important;
  }
  
  .fruite-item .product-features {
    font-size: 0.7rem !important;
    line-height: 1.1 !important;
  }
  
  .fruite-item .fs-5 {
    font-size: 0.9rem !important;
  }
  
  /* Menu button group mobile */
  .fruite-item .d-flex.gap-2 {
    gap: 3px !important;
    flex-wrap: wrap !important;
  }
  
  .fruite-item .btn.flex-fill {
    flex: 1 1 45% !important;
    font-size: 0.7rem !important;
    padding: 6px 8px !important;
    margin: 1px !important;
    min-height: 32px !important;
    line-height: 1.2 !important;
  }
  
  .fruite-item .btn i {
    font-size: 0.65rem !important;
    margin-right: 3px !important;
  }
  
  /* Menu category tabs mobile */
  .nav-tabs .nav-link {
    font-size: 0.8rem !important;
    padding: 8px 12px !important;
    margin: 2px !important;
  }
  
  /* Menu grid mobile */
  .menu-grid .col-md-6,
  .menu-grid .col-lg-6,
  .menu-grid .col-xl-4 {
    padding: 5px !important;
  }
  
  /* Hero section mobile specific */
  .hero-header .display-3 {
    font-size: 1.8rem !important;
  }
  
  .hero-header .display-4 {
    font-size: 1.5rem !important;
  }
  
  .hero-header .display-5 {
    font-size: 1.3rem !important;
  }
  
  /* Menu search mobile */
  .search-bar {
    margin-bottom: 15px !important;
  }
  
  .search-bar .form-control {
    font-size: 14px !important;
    height: 40px !important;
  }
  
  .search-bar .btn {
    height: 40px !important;
    font-size: 0.8rem !important;
  }
}

@media screen and (max-width: 480px) {
  
  /* Extra small mobile menu adjustments */
  .fruite-item .btn.flex-fill {
    flex: 1 1 100% !important;
    font-size: 0.75rem !important;
    padding: 8px 10px !important;
    margin: 2px 0 !important;
  }
  
  .fruite-item .d-flex.gap-2 {
    flex-direction: column !important;
    gap: 5px !important;
  }
  
  .fruite-item .card-title {
    font-size: 0.85rem !important;
  }
  
  .nav-tabs {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
  }
  
  .nav-tabs .nav-item {
    flex-shrink: 0 !important;
  }
}

/* ===== CART SPECIFIC MOBILE FIXES ===== */
@media screen and (max-width: 768px) {
  
  /* Cart summary mobile */
  .cart-summary {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 1000 !important;
    background: white !important;
    border-top: 2px solid var(--luxury-gold) !important;
    padding: 15px 10px !important;
    margin: 0 -10px !important;
  }
  
  /* Cart buttons mobile */
  .cart-buttons .btn {
    font-size: 0.85rem !important;
    padding: 10px 15px !important;
    margin: 5px 0 !important;
  }
  
  .cart-buttons .d-flex {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  .cart-buttons .btn.w-100 {
    width: 100% !important;
  }
  
  /* Quantity controls mobile */
  .input-group {
    max-width: 100px !important;
  }
  
  .input-group .btn {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.7rem !important;
    padding: 0 !important;
  }
  
  .input-group .form-control {
    max-width: 44px !important;
    font-size: 0.8rem !important;
    padding: 4px !important;
  }
}
