/* assets/css/mobile.css */

:root {
  --primary:     #E63946;
  --secondary:   #1D3557;
  --accent:      #00D4FF;
  --bg:          #0A0A0F;
  --surface:     #111827;
  --surface2:    #1F2937;
  --text:        #F9FAFB;
  --text-muted:  #9CA3AF;
  --border:      #374151;
  --bottom-nav-h: 64px;
  --header-h:     0px;
  --subheader-h:  0px;
}

.mobile-bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9999 !important;
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

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

/* Base Mobile Layout (TRIGGERED ONLY ON MOBILE) */
@media screen and (max-width: 768px) {
  :root {
    --header-h: 52px;
    --subheader-h: 44px;
  }

  body {
    padding-top: calc(var(--header-h) + var(--subheader-h)) !important;
    padding-bottom: var(--bottom-nav-h) !important;
    background-color: var(--bg);
    color: var(--text);
  }

  /* Hide Desktop Elements */
  .desktop-sidebar, 
  .desktop-navbar,
  header:not(.mobile-header),
  nav:not(.mobile-subheader):not(.mobile-bottom-nav):not(.desktop-navbar *) { 
    display: none !important; 
  }

  /* Show Mobile Elements */
  .mobile-only,
  .mobile-header,
  .mobile-bottom-nav,
  .mobile-subheader { 
    display: flex !important; 
  }

  /* Fixed top row: logo + actions */
  .mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-h);
    align-items: center;
    padding: 0 12px;
    box-sizing: border-box;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .mobile-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    gap: 10px;
  }

  .mobile-header-brand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    min-width: 0;
  }

  .mobile-header-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
  }

  .mobile-header-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #ef4444;
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
  }

  .mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .mobile-header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }

  .mobile-header-icon-btn:hover {
    background: var(--surface2);
    color: var(--text);
  }

  /* Sub-header: horizontal scroll menu */
  .mobile-subheader {
    position: fixed !important;
    top: var(--header-h) !important;
    left: 0;
    right: 0;
    z-index: 99;
    height: var(--subheader-h) !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  .mobile-subheader::-webkit-scrollbar {
    display: none;
  }

  .mobile-nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--surface);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }

  .mobile-nav-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #0a0a0f;
    font-weight: 600;
  }

  .mobile-nav-pill-icon {
    font-size: 1em;
    line-height: 1;
  }
}

/* Hide Mobile UI on Desktop (TRIGGERED ON PC) */
@media screen and (min-width: 769px) {
  body {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  /* Explicitly hide all mobile components on PC */
  .mobile-only,
  .mobile-header,
  .mobile-bottom-nav,
  .mobile-subheader,
  #filter-drawer,
  nav.mobile-bottom-nav,
  header.mobile-header,
  nav.mobile-subheader {
    display: none !important;
  }
  /* Ensure desktop elements are visible */
  .desktop-navbar,
  .desktop-sidebar {
    display: block !important;
  }
}

/* Utility classes for mobile views */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#scroll-top-btn {
  position: fixed; bottom: calc(var(--bottom-nav-h) + 20px); right: 20px;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent); color: #000;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(0,212,255,0.4);
  z-index: 9998; border: none; transition: transform 0.2s;
}
#scroll-top-btn:active { transform: scale(0.9); }
