/**
 * Mobile Responsive Stylesheet
 * Purpose: Make existing client/freelancer pages mobile-friendly
 * Approach: Mobile-first with progressive enhancement
 */

/* ============================================
   Base Mobile Styles (All Devices)
   ============================================ */

/* Ensure proper viewport scaling */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

/* Touch-friendly elements */
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* ============================================
   Tablet & Mobile (≤ 991px)
   ============================================ */
@media (max-width: 991px) {
  /* Container spacing */
  .container,
  .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
  }

  /* Form elements */
  .form-group {
    margin-bottom: 15px;
  }

  .form-control {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px 15px;
    min-height: 44px; /* Touch-friendly */
  }

  /* Buttons - Touch-friendly sizing */
  .btn {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 16px;
  }

  .btn-block,
  .btn.btn-block {
    width: 100%;
    display: block;
  }

  /* Cards */
  .card {
    margin-bottom: 15px;
  }

  .card-body {
    padding: 15px;
  }

  /* Tables - Responsive scroll */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    white-space: nowrap;
  }

  /* Modals */
  .modal-dialog {
    margin: 10px;
  }

  .modal-content {
    border-radius: 8px;
  }

  /* Navigation */
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-tabs .nav-link {
    white-space: nowrap;
  }

  /* Breadcrumbs */
  .breadcrumb {
    flex-wrap: wrap;
    font-size: 14px;
  }

  /* Alerts */
  .alert {
    font-size: 14px;
    padding: 12px 15px;
  }

  /* Badges */
  .badge {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* ============================================
   Mobile Only (≤ 767px)
   ============================================ */
@media (max-width: 767px) {
  /* Typography */
  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  h3 {
    font-size: 18px;
  }

  h4 {
    font-size: 16px;
  }

  /* Spacing */
  .mb-3,
  .my-3 {
    margin-bottom: 1rem !important;
  }

  .mt-3,
  .my-3 {
    margin-top: 1rem !important;
  }

  .p-3 {
    padding: 1rem !important;
  }

  /* Grid - Force single column */
  .row > [class*="col-"] {
    margin-bottom: 15px;
  }

  /* Force stacking on mobile */
  .col-mobile-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Action buttons - Stack vertically */
  .btn-group {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .btn-group > .btn {
    margin-bottom: 10px;
    border-radius: 4px !important;
  }

  /* Pagination */
  .pagination {
    justify-content: center;
  }

  .pagination .page-link {
    padding: 8px 12px;
    font-size: 14px;
  }

  /* Dropdowns */
  .dropdown-menu {
    position: fixed !important;
    top: auto !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-height: 70vh;
    overflow-y: auto;
  }

  /* Forms - Full width on mobile */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  select,
  textarea {
    width: 100%;
    max-width: 100%;
  }

  /* File upload buttons */
  .custom-file,
  input[type="file"] {
    font-size: 14px;
  }

  /* Images - Responsive */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Job/Project Cards - Mobile friendly */
  .job-card,
  .project-card,
  .order-card {
    padding: 15px;
    margin-bottom: 10px;
  }

  /* Stats/Dashboard widgets - Stack */
  .stats-widget,
  .dashboard-widget {
    margin-bottom: 15px;
  }

  /* Hide decorative elements on mobile */
  .mobile-hide {
    display: none !important;
  }

  /* Bottom padding for mobile navbar */
  body.has-mobile-nav {
    padding-bottom: 70px;
  }

  /* Ensure content doesn't hide behind mobile navbar */
  .main-content {
    min-height: calc(100vh - 140px);
  }
}

/* ============================================
   Small Mobile (≤ 480px)
   ============================================ */
@media (max-width: 480px) {
  /* Even smaller typography */
  h1 {
    font-size: 20px;
  }

  h2 {
    font-size: 18px;
  }

  /* Compact forms */
  .form-group {
    margin-bottom: 10px;
  }

  .form-control {
    padding: 10px 12px;
  }

  /* Compact buttons */
  .btn {
    padding: 10px 15px;
    font-size: 14px;
  }

  /* Tighter spacing */
  .container,
  .container-fluid {
    padding-left: 10px;
    padding-right: 10px;
  }

  .card-body {
    padding: 10px;
  }
}

/* ============================================
   Utility Classes
   ============================================ */

/* Show/Hide based on device */
.mobile-only {
  display: none;
}

@media (max-width: 767px) {
  .mobile-only {
    display: block !important;
  }

  .desktop-only {
    display: none !important;
  }
}

/* Touch-friendly spacing */
.touch-spacing {
  margin-bottom: 44px;
}

/* Full-width on mobile */
@media (max-width: 767px) {
  .mobile-full-width {
    width: 100% !important;
    display: block !important;
  }
}

/* Sticky mobile actions */
.mobile-sticky-actions {
  position: fixed;
  bottom: 60px; /* Above mobile navbar */
  left: 0;
  right: 0;
  padding: 10px;
  background: #fff;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 999;
}

@media (min-width: 768px) {
  .mobile-sticky-actions {
    position: static;
    box-shadow: none;
  }
}
