/* ===== MOBILE-FIRST REDESIGN ===== */
/* Faraz Trading Platform — Mobile v2 */

/* === BASE MOBILE RESET === */
@media (max-width: 768px) {
  html { font-size: 15px; -webkit-text-size-adjust: 100%; }
  body { overscroll-behavior-y: none; }
  .container { padding: 0 16px; max-width: 100%; }
  
  /* Hide desktop nav on mobile */
  .navlinks { display: none !important; }
  .burger { display: none !important; }
  .nav-cta { display: none !important; }
  .theme-toggle { display: none !important; }
  
  /* Header — compact mobile */
  header { 
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: rgba(2, 2, 3, 0.95); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
  }
  header.scrolled { background: rgba(2, 2, 3, 0.98); }
  .light-theme header, .light-theme header.scrolled {
    background: rgba(248, 250, 252, 0.95);
  }
  nav { padding: 12px 16px; }
  .brand { font-size: 1.1rem; gap: 10px; }
  .brand .logo img { width: 36px; height: 36px; }
  
  /* Footer — hidden on mobile */
  footer { display: none; }
  
  /* WhatsApp FAB — repositioned */
  .wa-fab { bottom: 80px; left: 16px; width: 52px; height: 52px; z-index: 90; }
  .wa-fab svg { width: 26px; height: 26px; }
  
  /* Back to top — hidden on mobile */
  .back-to-top { display: none; }
  
  /* Hero — compact */
  .hero { min-height: auto; padding: 70px 0 30px; }
  .hero h1 { font-size: 1.6rem; line-height: 1.4; margin-bottom: 16px; }
  .hero p.lead { font-size: 0.9rem; line-height: 1.7; margin-bottom: 24px; }
  .hero-cta { flex-direction: column; gap: 10px; }
  .hero-cta .btn { width: 100%; justify-content: center; padding: 14px 24px; min-height: 48px; }
  
  /* Sections */
  section { padding: 40px 0; }
  .eyebrow { font-size: 0.78rem; margin-bottom: 10px; }
  .s-title { font-size: 1.4rem; line-height: 1.3; margin-bottom: 12px; }
  .s-sub { font-size: 0.88rem; margin-bottom: 32px; }
  
  /* Cards — touch optimized */
  .card { 
    padding: 20px 16px; 
    border-radius: 16px;
    margin-bottom: 12px;
  }
  .card h3 { font-size: 1rem; margin-bottom: 8px; }
  .card p { font-size: 0.85rem; line-height: 1.6; }
  .card .ic { width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px; }
  .card .ic svg { width: 22px; height: 22px; }
  
  /* Grid — single column */
  .grid.cols3 { grid-template-columns: 1fr; gap: 12px; }
  .grid.cols2 { grid-template-columns: 1fr; }
  
  /* Stats */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 20px 12px; border-radius: 14px; }
  .stat .num { font-size: 1.6rem; }
  .stat .lbl { font-size: 0.78rem; }
  
  /* Steps */
  .steps { grid-template-columns: 1fr; gap: 10px; }
  .step { padding: 20px 16px; border-radius: 14px; }
  .step .n { font-size: 1.4rem; }
  .step h4 { font-size: 0.95rem; }
  .step p { font-size: 0.85rem; }
  
  /* Contact */
  .contact-wrap { grid-template-columns: 1fr; gap: 24px; }
  .contact-card { padding: 20px 16px; }
  .crow { padding: 14px 12px; }
  .crow .ci { width: 40px; height: 40px; border-radius: 10px; }
  .crow .ci svg { width: 18px; height: 18px; }
  
  /* Buttons — larger touch targets */
  .btn { min-height: 48px; padding: 12px 24px; font-size: 0.92rem; }
  .btn-sm { min-height: 42px; padding: 10px 18px; font-size: 0.85rem; }
  
  /* Forms — iOS-friendly */
  .inp { 
    min-height: 48px; 
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 12px 14px;
    border-radius: 12px;
  }
  select.inp { min-height: 48px; }
  
  /* Theme toggle — mobile position */
  .mobile-theme-toggle {
    display: flex !important;
    position: fixed; bottom: 80px; right: 16px; z-index: 90;
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--bg-card); border: 1px solid var(--border);
    backdrop-filter: blur(12px); color: var(--text-secondary);
    font-size: 1.2rem; cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    transition: all 0.2s;
  }
  .mobile-theme-toggle:active { transform: scale(0.9); }
  
  /* Footer spacer for bottom nav */
  .bottom-spacer { height: 80px; }
}

/* === BOTTOM NAVIGATION BAR === */
@media (max-width: 768px) {
  .bottom-nav {
    display: flex !important;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: rgba(2, 2, 3, 0.97); backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
    justify-content: space-around; align-items: center;
  }
  .light-theme .bottom-nav {
    background: rgba(248, 250, 252, 0.97);
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 8px; font-size: 0.65rem; color: var(--text-muted);
    text-decoration: none; min-width: 56px; min-height: 48px;
    justify-content: center; border-radius: 12px;
    transition: all 0.2s;
  }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav a:active { background: rgba(6, 214, 160, 0.08); }
  .bottom-nav a svg { width: 22px; height: 22px; stroke-width: 1.8; }
  .bottom-nav a.active svg { stroke: var(--accent); }
}

/* Hide bottom nav on desktop */
@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
  .mobile-theme-toggle { display: none !important; }
}

/* === PLATFORM TABS — MOBILE === */
@media (max-width: 768px) {
  .platform-main { padding-top: 60px; padding-bottom: 80px; min-height: 100vh; }
  
  /* Header */
  .plat-header { flex-direction: column; gap: 10px; align-items: flex-start; margin-bottom: 16px; padding-bottom: 12px; }
  .plat-title { font-size: 1.2rem; }
  .plat-sub { font-size: 0.82rem; }
  .live-clock { font-size: 0.72rem; padding: 5px 10px; }
  
  /* Indices bar */
  .indices-bar { gap: 8px; padding: 8px 0; margin-bottom: 16px; -webkit-overflow-scrolling: touch; }
  .indices-bar::-webkit-scrollbar { display: none; }
  .indices-bar { scrollbar-width: none; }
  .idx-card { min-width: 120px; padding: 10px 12px; border-radius: 12px; }
  .idx-card .name { font-size: 0.65rem; }
  .idx-card .price { font-size: 0.88rem; }
  .idx-card .change { font-size: 0.72rem; }
  
  /* Dashboard grid */
  .dash-grid { grid-template-columns: 1fr; gap: 12px; }
  .dash-card { padding: 16px 14px; border-radius: 14px; }
  .dash-card.span2 { grid-column: span 1; }
  .dash-card-head { margin-bottom: 10px; padding-bottom: 8px; }
  .dash-card-head h3 { font-size: 0.88rem; }
  .badge-sm { font-size: 0.62rem; padding: 2px 8px; }
  
  /* Mini table */
  .mt-row { padding: 8px 8px; font-size: 0.78rem; gap: 8px; grid-template-columns: 1fr auto auto; }
  .mt-row .name { display: none; }
  .mt-row .sym { font-size: 0.82rem; }
  .mt-row .val { font-size: 0.78rem; }
  .mt-row .chg { font-size: 0.72rem; min-width: 44px; }
  
  /* News mini */
  .nm-item { padding: 8px; font-size: 0.78rem; border-radius: 8px; }
  .nm-item .nm-title { font-size: 0.78rem; line-height: 1.4; }
  .nm-item .nm-meta { font-size: 0.65rem; }
  
  /* Scanner */
  .scanner-filters { gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
  .filter-btn { padding: 8px 14px; font-size: 0.75rem; min-height: 38px; border-radius: 20px; }
  .scan-grid { gap: 10px; }
  .scan-card { grid-template-columns: 1fr auto; padding: 12px 14px; gap: 8px; border-radius: 14px; }
  .scan-card .score-badge { display: none; }
  .scan-card .sc-info h4 { font-size: 0.88rem; }
  .scan-card .sc-info .sector { font-size: 0.7rem; }
  .scan-card .sc-price { font-size: 0.82rem; }
  .scan-card .sc-chg { font-size: 0.75rem; min-width: 44px; }
  .scan-card .sc-signals { gap: 4px; padding-top: 8px; }
  .signal-tag { font-size: 0.65rem; padding: 3px 8px; border-radius: 6px; }
  .fav-btn { width: 28px; height: 28px; font-size: 0.75rem; top: 6px; left: 6px; }
  
  /* Crypto */
  .crypto-grid { grid-template-columns: 1fr; gap: 10px; }
  .crypto-card { padding: 14px; border-radius: 14px; }
  .crypto-card .cc-top { gap: 8px; margin-bottom: 8px; }
  .crypto-card .cc-top img { width: 28px; height: 28px; }
  .crypto-card .cc-top .cc-sym { font-size: 0.88rem; }
  .crypto-card .cc-top .cc-name { font-size: 0.7rem; }
  .crypto-card .cc-price { font-size: 1rem; margin-bottom: 6px; }
  .crypto-card .cc-changes { font-size: 0.7rem; gap: 8px; flex-wrap: wrap; }
  
  /* News */
  .news-grid { grid-template-columns: 1fr; gap: 10px; }
  .news-card { padding: 14px; border-radius: 14px; }
  .news-card h3 { font-size: 0.88rem; line-height: 1.5; }
  .news-card .nc-desc { font-size: 0.78rem; line-height: 1.6; margin-bottom: 8px; }
  .news-card .nc-head { gap: 8px; }
  .news-card .nc-sentiment { font-size: 0.68rem; padding: 2px 6px; }
  .ai-analysis-card { padding: 14px; }
  .ai-analysis-card h3 { font-size: 0.88rem; }
  .ai-analysis-card p { font-size: 0.82rem; }
  
  /* Strategy */
  .strat-builder { grid-template-columns: 1fr; gap: 12px; }
  .strat-config { padding: 16px; border-radius: 14px; position: static; }
  .strat-results { padding: 14px; min-height: 280px; border-radius: 14px; }
  .strat-form label { font-size: 0.82rem; margin-top: 12px; }
  .bt-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .bt-stat { padding: 10px 8px; border-radius: 10px; }
  .bt-stat .val { font-size: 1rem; }
  .bt-stat .lbl { font-size: 0.68rem; }
  .bt-chart-container { height: 200px; }
  .bt-trades-table { font-size: 0.75rem; }
  .bt-trades-table th, .bt-trades-table td { padding: 8px 10px; }
  
  /* Analysis */
  .analysis-grid { grid-template-columns: 1fr; gap: 12px; }
  .search-box { padding: 8px 12px; gap: 8px; border-radius: 14px; }
  .search-box .inp { font-size: 0.88rem; padding: 8px; }
  .chart-panel { padding: 14px; border-radius: 14px; }
  .chart-panel .chart-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .chart-panel .price-big { font-size: 1.3rem; }
  .chart-panel .change-big { font-size: 0.78rem; margin-right: 0; }
  .chart-container { height: 250px; }
  .side-card { padding: 14px; border-radius: 14px; }
  .side-card h4 { font-size: 0.85rem; margin-bottom: 10px; padding-bottom: 8px; }
  .indicator-row, .fundamental-row { font-size: 0.78rem; padding: 5px 0; }
  .summary-badge { padding: 6px 12px; font-size: 0.78rem; border-radius: 20px; }
  
  /* Indicator / AI tabs */
  .ind-chart, .ai-results { min-height: 250px; }
  
  /* Loading */
  .loading-row { padding: 8px; font-size: 0.78rem; }
  .scan-placeholder { padding: 40px 16px; }
  .scan-placeholder p { font-size: 0.88rem; }
  
  /* Table scroll */
  .data-table-scroll { max-height: 300px; }
}

/* === TOUCH OPTIMIZATIONS === */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch */
  .card:hover, .scan-card:hover, .crypto-card:hover, .news-card:hover,
  .idx-card:hover, .stat:hover, .step:hover, .filter-btn:hover {
    transform: none !important;
  }
  
  /* Press feedback */
  .card:active, .scan-card:active, .crypto-card:active, .news-card:active,
  .idx-card:active, .stat:active, .step:active {
    transform: scale(0.98) !important;
    transition-duration: 0.1s !important;
  }
  .btn:active { transform: scale(0.97) !important; transition-duration: 0.1s !important; }
  .filter-btn:active { transform: scale(0.95); }
  
  /* Larger touch targets */
  .fav-btn { width: 36px; height: 36px; }
  .filter-btn { min-height: 42px; }
  button, .btn { min-height: 48px; }
  .inp { min-height: 48px; font-size: 16px !important; }
  a { min-height: 44px; display: inline-flex; align-items: center; }
}

/* === SAFE AREAS (iOS) === */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .wa-fab { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .mobile-theme-toggle { bottom: calc(80px + env(safe-area-inset-bottom)); }
}

/* === SKELETON ANIMATION === */
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(148,163,184,0.08) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

/* === SCROLL SMOOTH === */
@media (max-width: 768px) {
  html { scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
  * { -webkit-tap-highlight-color: transparent; }
}
