/* TurkAsia B2B - Strict Mobile Responsiveness & Adaptive Styles */

/* =========================================================================
   VISIBILITY HELPERS & DESKTOP DEFAULTS
   ========================================================================= */
.mobile-only {
  display: none !important;
}

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

/* Mobile drawer and bottom tab bar are strictly hidden on desktop */
@media (min-width: 769px) {
  .mobile-drawer,
  .mobile-bottom-bar,
  .mobile-only {
    display: none !important;
  }
}

/* =========================================================================
   TABLET ADAPTATIONS (max-width: 992px)
   ========================================================================= */
@media (max-width: 992px) {
  .hero-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }

  .hero-stats {
    width: 100%;
    justify-content: space-between;
  }

  .stat-item {
    flex: 1;
    padding: 10px 14px;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
}

/* =========================================================================
   MOBILE ADAPTATIONS (max-width: 768px)
   ========================================================================= */
@media (max-width: 768px) {
  /* Visibility toggles */
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  .hide-on-mobile {
    display: none !important;
  }

  /* Body space for bottom tab bar */
  body {
    padding-bottom: 74px; /* Tab bar height space */
  }

  /* Container */
  .container {
    padding: 0 14px;
  }

  /* Site Header */
  .site-header {
    height: 60px;
  }

  .nav-container {
    height: 60px;
  }

  .nav-brand {
    font-size: 19px;
  }

  .nav-brand .brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
  }

  /* Nav Auth & Dropdowns Mobile Alignment */
  .nav-auth-section {
    gap: 6px;
  }

  .lang-selector-btn {
    height: 38px;
    padding: 0 8px;
    font-size: 13px;
  }

  .nav-user-btn {
    height: 38px;
    padding: 3px;
    border-radius: var(--radius-full);
  }

  .nav-user-avatar {
    width: 30px;
    height: 30px;
  }

  /* Mobile Hamburger Button */
  .mobile-hamburger-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-offwhite);
    color: var(--color-text-main);
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    margin-left: 8px;
    transition: var(--transition);
  }

  .mobile-hamburger-btn:active {
    background: var(--color-offwhite-dark);
    transform: scale(0.95);
  }

  /* Mobile Drawer Navigation */
  .mobile-drawer {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 43, 58, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1050;
  }

  .mobile-drawer.active {
    display: block;
  }

  .mobile-drawer-inner {
    background: #FFFFFF;
    width: 100%;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 18px 16px 36px;
    border-bottom: 2px solid var(--color-teal);
    box-shadow: var(--shadow-xl);
    animation: slideDown 0.25s ease-out;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-16px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .mobile-search-form {
    position: relative;
    margin-bottom: 16px;
  }

  .mobile-search-form input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-offwhite);
    font-size: 14px;
    outline: none;
  }

  .mobile-search-form i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-tertiary);
  }

  .mobile-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-main);
  }

  .mobile-nav-item:hover, .mobile-nav-item.active {
    background: var(--color-teal-subtle);
    color: var(--color-teal);
  }

  .mobile-badge {
    margin-left: auto;
    background: var(--color-teal);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
  }

  /* =========================================================================
     MOBILE BOTTOM BAR (Expo Tab Bar Look & Feel)
     ========================================================================= */
  .mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #FFFFFF;
    border-top: 1px solid var(--color-border);
    display: flex !important;
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
    padding: 0 6px;
    box-shadow: 0 -4px 16px rgba(7, 43, 58, 0.06);
  }

  .bottom-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-size: 10px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    min-width: 58px;
    text-align: center;
    transition: var(--transition);
  }

  .bottom-tab-item i {
    font-size: 20px;
    margin-bottom: 2px;
    line-height: 1;
  }

  .bottom-tab-item.active {
    color: var(--color-teal);
  }

  .bottom-tab-item.active i {
    color: var(--color-teal);
    transform: scale(1.1);
  }

  /* Center Floating Plus Button */
  .bottom-tab-item.add-btn {
    position: relative;
    top: -12px;
    color: var(--color-teal);
  }

  .bottom-add-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-teal), var(--color-teal-dark));
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 14px var(--color-teal-glow);
    border: 3px solid #FFFFFF;
    margin-bottom: 2px;
    transition: transform 0.2s ease;
  }

  .bottom-tab-item.add-btn:active .bottom-add-circle {
    transform: scale(0.92);
  }

  /* =========================================================================
     PAGE SPECIFIC MOBILE STYLES
     ========================================================================= */
  
  /* Hero */
  .hero-banner {
    padding: 28px 0 32px;
  }

  .hero-title {
    font-size: 24px;
    line-height: 1.25;
  }

  .hero-desc {
    font-size: 14px;
    margin-bottom: 18px;
  }

  .hero-stats {
    flex-direction: row;
    gap: 8px;
  }

  .stat-item {
    padding: 8px 10px;
  }

  .stat-number {
    font-size: 17px;
  }

  .stat-label {
    font-size: 10px;
  }

  /* Filter Bar */
  .filter-bar {
    padding: 10px 0;
    margin-bottom: 18px;
  }

  .filter-bar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .category-pills {
    width: 100%;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .pill-item {
    padding: 6px 14px;
    font-size: 12px;
  }

  .sort-select {
    width: 100%;
    padding: 10px 14px;
  }

  /* Cards Grid */
  .cards-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
    margin-bottom: 32px;
  }

  .card-title {
    font-size: 16px;
  }

  .card-desc {
    font-size: 13px;
  }

  .opp-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .opp-meta-item:last-child {
    text-align: left !important;
  }

  .card-footer {
    padding: 12px 16px;
  }

  /* Detail Layouts (2 Column -> 1 Column) */
  div[style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  div[style*="grid-template-columns: 2fr 1.5fr auto"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Service Detail Gallery */
  #mainGalleryImage {
    height: 260px !important;
  }

  div[style*="height: 420px"] {
    height: 260px !important;
  }

  /* Company Detail Header */
  div[style*="height: 220px"], div[style*="height: 200px"] {
    height: 140px !important;
  }

  .comp-logo, div[style*="width: 100px; height: 100px"], div[style*="width: 92px; height: 92px"] {
    width: 70px !important;
    height: 70px !important;
    font-size: 26px !important;
  }

  div[style*="margin-top: -50px"], div[style*="margin-top: -46px"] {
    margin-top: -35px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  div[style*="padding: 0 32px 28px"], div[style*="padding: 0 32px 24px"] {
    padding: 0 16px 20px !important;
  }

  /* Forms & Rows */
  .form-card {
    padding: 20px 16px !important;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* Responsive Class Rules */
  .explore-filter-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .detail-two-col {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .opp-type-selector {
    grid-template-columns: 1fr !important;
  }

  .edit-steps-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Chat Room Height on Mobile */
  div[style*="height: 75vh"] {
    height: calc(100vh - 145px) !important;
    border-radius: var(--radius-md) !important;
  }

  #messagesContainer div[style*="max-width: 70%"] {
    max-width: 86% !important;
  }

  /* Modals on Mobile */
  .modal-card {
    padding: 18px !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }

  /* Touch Scroll and Card Footer */
  .category-pills, .tag-list {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .category-pills::-webkit-scrollbar, .tag-list::-webkit-scrollbar {
    display: none;
  }

  .poster-name {
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Footer */
  .site-footer {
    padding: 40px 0 20px;
    margin-top: 40px;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 24px;
    margin-bottom: 28px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* =========================================================================
   EXTRA SMALL DEVICES (max-width: 480px)
   ========================================================================= */
@media (max-width: 480px) {
  .hero-title {
    font-size: 21px;
  }

  .card-title {
    font-size: 15px;
  }

  .form-control {
    padding: 10px 14px;
    font-size: 14px;
  }

  .nav-action-btn {
    padding: 6px 12px;
    font-size: 13px;
  }
}
