/*
 * SmallTraders PWA v7.0 — style.css
 * ✅ Splash idéntico al v4 (logo real + barra dorada/verde)
 * ✅ FAB button + Drawer de apps
 * ✅ Bottom Nav 5 botones tipo app nativa
 * ✅ Fluent Community integrado
 * ✅ Solo afecta móvil ≤1024px
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ══════════════════════════════════════════
   VARIABLES
══════════════════════════════════════════ */
:root {
  --bg:          #060d08;
  --bg2:         #08120a;
  --surface:     #0d1f12;
  --surface2:    #132d1a;
  --border:      rgba(255,255,255,.07);
  --border2:     #1c3d22;
  --border3:     #2d6337;
  --gold:        #c9a227;
  --gold-glow:   rgba(201,162,39,.35);
  --green:       #22c55e;
  --green-dim:   rgba(34,197,94,.14);
  --green-glow:  rgba(34,197,94,.25);
  --text:        #e8f0e8;
  --text2:       #b0c8b0;
  --muted:       #5a7a5a;
  --nav-h:       68px;
  --header-h:    0px;
  --safe-b:      env(safe-area-inset-bottom, 0px);
  --safe-t:      env(safe-area-inset-top, 0px);
  --fd: 'Plus Jakarta Sans', system-ui, sans-serif;
  --fb: 'Space Grotesk', system-ui, sans-serif;
}

/* ══════════════════════════════════════════
   OCULTAR TODO EN DESKTOP ≥1025px
══════════════════════════════════════════ */
@media (min-width: 1025px) {
  #st-splash,
  #st-fab-menu,
  #st-drawer,
  #st-bottom-nav { display: none !important; }
}

/* ══════════════════════════════════════════
   RESET MÓVIL BASE
══════════════════════════════════════════ */
@media (max-width: 1024px) {

  *, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
  }

  html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
  }

  body {
    font-family: var(--fb);
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    -webkit-font-smoothing: antialiased;
  }

  body.st-drawer-open {
    overflow: hidden;
    touch-action: none;
  }

  img, video { max-width: 100%; height: auto; }
  a { color: inherit; text-decoration: none; }

  /* ── Ocultar WhatsApp flotantes ── */
  #joinchat, .joinchat, .joinchat__button,
  .whatsapp-float, .wa-float, .wa-chat-btn, .wspclk,
  #woowbot, .woowbot, #tidio-chat, #crisp-chatbox {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    position: fixed !important;
    top: -9999px !important;
  }
}

/* ══════════════════════════════════════════
   ① SPLASH SCREEN — IDÉNTICO AL v4
══════════════════════════════════════════ */
#st-splash {
  display: none; /* JS lo activa en móvil */
}

@media (max-width: 1024px) {
  #st-splash {
    display: flex !important;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg);
    align-items: center;
    justify-content: center;
    transition: opacity .45s ease, transform .45s ease;
  }

  #st-splash.st-fade-out {
    opacity: 0;
    transform: scale(1.03);
    pointer-events: none;
  }

  .st-splash-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 0 32px;
    text-align: center;
  }

  .st-splash-logo-wrap {
    animation: st-pop .65s cubic-bezier(.34,1.56,.64,1) forwards;
  }

  .st-splash-logo {
    width: 200px;
    height: auto;
    filter: drop-shadow(0 8px 32px rgba(201,162,39,.4));
  }

  .st-splash-sub {
    font-family: var(--fd);
    font-size: 15px;
    font-weight: 500;
    color: var(--text2);
    margin: 0;
    letter-spacing: .3px;
    animation: st-fade-up .5s .2s both;
  }

  .st-splash-token-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--green-dim);
    border: 1px solid rgba(34,197,94,.3);
    color: var(--green);
    font-family: var(--fd);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .6px;
    padding: 6px 16px;
    border-radius: 30px;
    animation: st-fade-up .5s .35s both;
  }

  .st-splash-dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    animation: st-blink 1.2s ease-in-out infinite;
    flex-shrink: 0;
  }

  .st-splash-loader {
    width: 160px;
    height: 3px;
    background: rgba(255,255,255,.08);
    border-radius: 4px;
    overflow: hidden;
    animation: st-fade-up .5s .45s both;
  }

  .st-splash-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--gold), var(--green));
    border-radius: 4px;
    animation: st-load 2s .1s ease-out forwards;
  }

  .st-splash-ver {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: .4px;
    animation: st-fade-up .5s .55s both;
  }

  /* Animaciones splash */
  @keyframes st-pop {
    from { transform: scale(.5) rotate(-10deg); opacity: 0; }
    to   { transform: scale(1)  rotate(0deg);   opacity: 1; }
  }
  @keyframes st-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes st-load {
    from { width: 0; }
    to   { width: 100%; }
  }
  @keyframes st-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: .3; }
  }
}

/* ══════════════════════════════════════════
   ② FAB BUTTON
══════════════════════════════════════════ */
#st-fab-menu {
  display: none;
}

@media (max-width: 1024px) {
  #st-fab-menu {
    display: flex !important;
    position: fixed;
    bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
    right: 18px;
    z-index: 9990;
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: linear-gradient(135deg, #0d2016 0%, #142b1a 100%);
    border: 1.5px solid var(--border3);
    color: var(--green);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow:
      0 4px 20px rgba(0,0,0,.65),
      0 0 0 1px rgba(34,197,94,.12),
      inset 0 1px 0 rgba(255,255,255,.06);
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
  }

  #st-fab-menu:active {
    transform: scale(.92);
  }

  #st-fab-menu.open {
    background: linear-gradient(135deg, #162e1e 0%, #1e4027 100%);
    border-color: var(--green);
    box-shadow: 0 4px 24px rgba(0,0,0,.6), 0 0 18px var(--green-glow);
  }

  /* Pulse ring on load */
  #st-fab-menu::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 20px;
    border: 2px solid var(--green);
    opacity: 0;
    animation: st-pulse 2.5s ease-in-out 2.5s 3;
  }

  @keyframes st-pulse {
    0%   { transform: scale(.9); opacity: .5; }
    70%  { transform: scale(1.18); opacity: 0; }
    100% { opacity: 0; }
  }

  .st-fab-grid, .st-fab-close {
    position: absolute;
    transition: opacity .15s ease, transform .15s ease;
  }
  .st-fab-close { opacity: 0; transform: scale(.7) rotate(-45deg); }
  #st-fab-menu.open .st-fab-grid  { opacity: 0; transform: scale(.7) rotate(45deg); }
  #st-fab-menu.open .st-fab-close { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* ══════════════════════════════════════════
   ③ DRAWER — panel de apps
══════════════════════════════════════════ */
#st-drawer {
  display: none;
}

@media (max-width: 1024px) {
  #st-drawer {
    display: block !important;
  }

  .st-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9991;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s ease;
  }

  #st-drawer.open .st-drawer-backdrop {
    opacity: 1;
    pointer-events: all;
  }

  .st-drawer-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 9992;
    pointer-events: none;
    height: 90dvh;
    max-height: 90dvh;
    background: var(--bg2);
    border-top: 1px solid var(--border2);
    border-radius: 24px 24px 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 48px rgba(0,0,0,.8);
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(.32,0,.2,1);
    overflow: hidden;
  }

  #st-drawer.open .st-drawer-sheet {
    transform: translateY(0);
    pointer-events: all;
  }

  .st-drawer-handle {
    flex-shrink: 0;
    width: 40px; height: 4px;
    background: var(--border3);
    border-radius: 2px;
    margin: 10px auto 0;
  }

  /* Header del drawer */
  .st-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px 10px;
    background: #040a05;
    border-bottom: 1px solid var(--border2);
    flex-shrink: 0;
  }
  .st-drawer-logo-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .st-drawer-logo-text {
    color: var(--text);
    font-size: 15px;
    font-weight: 400;
  }
  .st-drawer-logo-text strong {
    font-weight: 700;
    color: var(--green);
  }
  .st-drawer-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .st-drawer-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--green);
    background: rgba(34,197,94,.1);
    border: 1px solid rgba(34,197,94,.3);
    border-radius: 20px;
    padding: 3px 9px;
    white-space: nowrap;
  }
  #st-drawer-close {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 50%;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: background .2s;
    padding: 0;
  }
  #st-drawer-close:active { background: rgba(255,255,255,.14); color: var(--text); }
  #st-drawer-close svg { width: 16px; height: 16px; }

  /* Body scrollable */
  .st-drawer-body {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    padding: 12px 14px 28px;
    scrollbar-width: thin;
    scrollbar-color: var(--border2) transparent;
  }
  .st-drawer-body::-webkit-scrollbar { width: 4px; }
  .st-drawer-body::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

  /* Secciones */
  .st-drawer-section { margin-bottom: 20px; }
  .st-section-label {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 10px 4px;
    padding: 0;
  }

  /* Grid de apps */
  .st-apps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 9px;
  }

  /* App card */
  .st-app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px 10px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 11px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: background .2s, border-color .2s, transform .15s;
  }
  .st-app-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--card-color, var(--green));
    opacity: 0;
    transition: opacity .2s;
  }
  .st-app-card:active { transform: scale(.94); background: var(--surface2); }
  .st-app-card:active::before { opacity: 1; }

  .st-app-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--card-color, #22c55e) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--card-color, #22c55e) 28%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--card-color, var(--green));
  }
  .st-app-icon svg { width: 20px; height: 20px; }
  .st-app-icon img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }

  .st-app-label {
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--text);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    hyphens: auto;
  }

  /* Footer del drawer */
  .st-drawer-footer {
    text-align: center;
    padding: 14px 0 6px;
    border-top: 1px solid var(--border2);
    margin-top: 8px;
  }
  .st-drawer-footer span {
    font-size: 9px;
    letter-spacing: .5px;
    color: var(--muted);
    text-transform: uppercase;
  }

  /* Card entrance animation */
  #st-drawer.open .st-app-card {
    animation: st-card-in .3s ease both;
  }
  #st-drawer.open .st-drawer-section:nth-child(1) .st-app-card:nth-child(1) { animation-delay: .04s; }
  #st-drawer.open .st-drawer-section:nth-child(1) .st-app-card:nth-child(2) { animation-delay: .06s; }
  #st-drawer.open .st-drawer-section:nth-child(1) .st-app-card:nth-child(3) { animation-delay: .08s; }
  #st-drawer.open .st-drawer-section:nth-child(1) .st-app-card:nth-child(4) { animation-delay: .10s; }
  #st-drawer.open .st-drawer-section:nth-child(1) .st-app-card:nth-child(5) { animation-delay: .12s; }
  #st-drawer.open .st-drawer-section:nth-child(1) .st-app-card:nth-child(6) { animation-delay: .14s; }
  #st-drawer.open .st-drawer-section:nth-child(1) .st-app-card:nth-child(7) { animation-delay: .16s; }
  #st-drawer.open .st-drawer-section:nth-child(1) .st-app-card:nth-child(8) { animation-delay: .18s; }
  #st-drawer.open .st-drawer-section:nth-child(2) .st-app-card { animation-delay: .22s; }
  #st-drawer.open .st-drawer-section:nth-child(3) .st-app-card { animation-delay: .28s; }

  @keyframes st-card-in {
    from { opacity: 0; transform: translateY(8px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
}

/* ══════════════════════════════════════════
   ④ BOTTOM NAV — 5 botones tipo app nativa
══════════════════════════════════════════ */
#st-bottom-nav {
  display: none;
}

@media (max-width: 1024px) {
  #st-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 9980;
    height: calc(var(--nav-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: rgba(6,13,8,.96);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-top: 1px solid var(--border2);
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -4px 24px rgba(0,0,0,.5);
  }

  .st-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    height: 100%;
    cursor: pointer;
    color: var(--muted);
    text-decoration: none;
    transition: color .2s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }

  .st-nav-item.active {
    color: var(--green);
  }

  .st-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 32px; height: 2px;
    background: var(--green);
    border-radius: 0 0 2px 2px;
  }

  .st-nav-icon {
    width: 26px; height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .st-nav-icon svg { width: 22px; height: 22px; }

  .st-nav-item span {
    font-family: var(--fd);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .2px;
    white-space: nowrap;
  }

  /* Botón central (Wallet) */
  .st-nav-center { flex: 1.2; }

  .st-nav-center-btn {
    width: 46px; height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--gold) 0%, #e4c04a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #060d08;
    box-shadow: 0 4px 16px var(--gold-glow);
    transition: transform .15s ease, box-shadow .15s ease;
  }
  .st-nav-center-btn svg { width: 22px; height: 22px; }
  .st-nav-center.active .st-nav-center-btn {
    box-shadow: 0 4px 24px var(--gold-glow), 0 0 0 3px rgba(201,162,39,.2);
    transform: translateY(-2px);
  }
  .st-nav-center:active .st-nav-center-btn { transform: scale(.92) translateY(0); }

  .st-nav-item:not(.st-nav-center):active .st-nav-icon {
    transform: scale(.88);
  }
}

/* ══════════════════════════════════════════
   FLUENT COMMUNITY — integración visual
══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .fcom-sidebar,
  .fcom-left-sidebar,
  .fcom-right-sidebar,
  .fc-sidebar {
    display: none !important;
  }

  .fcom-main-content,
  .fcom-feed-wrap,
  .fc-main-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 10px 10px 0 !important;
  }

  .fcom-space-tabs,
  .fc-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .fcom-space-tabs::-webkit-scrollbar,
  .fc-tabs::-webkit-scrollbar { display: none !important; }

  .fcom-post-item,
  .fc-post-card {
    background: var(--surface) !important;
    border: 1px solid var(--border2) !important;
    border-radius: 14px !important;
    margin-bottom: 10px !important;
  }
}
