/* =========================================================================
   BRANDINBOX - CSS REFACTORED & MODULAR
   Organizzato in sezioni logiche per facile manutenzione
   ========================================================================= */

/* =========================================================================
   1. FOUNDATION - Variables & Reset
   ========================================================================= */

:root{
  /* Colors */
  --bg:#ffffff;
  --text:#0b1220;
  --muted:#5b6476;
  --line:rgba(15,23,42,.10);
  --soft:#f6f7fb;

  /* Brand palette */
  --teal:#19b37a;
  --cyan:#15b7d9;
  --deep:#0f3d52;
  --accent: linear-gradient(135deg, var(--cyan), var(--teal));
  --accentSolid: #19b37a;

  /* Layout */
  --radius:18px;
}

html,body{ height:100%; }
body{ background: var(--bg); color: var(--text); }
.muted{ color: var(--muted); }
.nav-shadow{ box-shadow: 0 1px 0 rgba(15,23,42,.06); }
.brand-logo{ height: 86px; width:auto; display:block; }
.divider{ height:1px; background: rgba(15,23,42,.08); width:100%; }


/* =========================================================================
   2. BUTTONS - All button styles
   ========================================================================= */

/* Primary accent button */
.btn-accent{
  background: var(--accent);
  border: 0;
  border-radius: 14px;
  padding: .78rem 1rem;
  font-weight: 800;
  color: #ffffff;
}
.btn-accent:hover{ filter: brightness(1.03); color:#fff; }

/* Soft outline button */
.btn-outline-soft{
  border: 1px solid rgba(15,23,42,.14);
  border-radius: 14px;
  padding: .78rem 1rem;
  font-weight: 800;
  color: var(--text);
  background: #fff;
}
.btn-outline-soft:hover{ background: var(--soft); }

/* Icon-only button (inbox actions) */
.bb-icon-btn{
  width:38px;
  height:38px;
  border-radius:10px;
  border:1px solid rgba(15,23,42,.14);
  background:#fff;
  color: rgba(11,18,32,.85);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
}
.bb-icon-btn:hover{ background: rgba(15,23,42,.04); }
.bb-icon-btn svg{ display:block; }

/* Social auth buttons */
.bb-btn-social{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:.65rem;
  border-radius:14px;
  padding:.8rem 1rem;
  font-weight:700;
}
.bb-btn-google{
  background:#fff;
  border:1px solid rgba(0,0,0,.12);
}
.bb-btn-google:hover{ border-color: rgba(0,0,0,.2); }

.bb-btn-fb{
  background:#fff;
  border:1px solid rgba(24,119,242,.25);
}
.bb-btn-fb:hover{ border-color: rgba(24,119,242,.45); }

.bb-social-ico{
  width:22px;
  height:22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}


/* =========================================================================
   3. CARDS & CONTAINERS - Card styles
   ========================================================================= */

.cardx{
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(15,23,42,.06);
}


/* =========================================================================
   4. BADGES & CHIPS - Small UI elements
   ========================================================================= */

/* Generic chip/badge */
.chip{
  border:1px solid rgba(15,23,42,.10);
  background: rgba(246,247,251,1);
  border-radius: 999px;
  padding: .42rem .75rem;
  font-weight: 800;
  font-size: .88rem;
  color: #243049;
  white-space: nowrap;
}

/* Amazon voucher badge */
.amazon-badge{
  display:inline-flex;
  align-items:center;
  gap:.5rem;
  padding:.32rem .65rem;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(25,179,122,.10);
  font-weight: 900;
  color: rgba(11,18,32,.88);
}
.amazon-dot{
  width:10px;
  height:10px;
  border-radius:99px;
  background: var(--accentSolid);
  box-shadow: 0 0 0 6px rgba(25,179,122,.14);
}

/* Promo badge (inbox guest) */
.bb-promo-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.5rem;
  padding:.40rem .75rem;
  border-radius:999px;
  border:2px solid #ffc107;
  background: #fff3cd;
  font-weight:900;
  color: #664d03;
}

.bb-promo-row { width:100%; }
.bb-promo-btn { white-space:nowrap; }

@media (max-width: 576px){
  .bb-promo-badge { width:100%; }
  .bb-promo-btn { width:100%; }
}


/* =========================================================================
   5. TYPOGRAPHY - Headings, text styles
   ========================================================================= */

.bb-kicker{
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(91,100,118,.92);
  font-weight: 800;
}
.bb-h2{ font-weight: 900; letter-spacing: -0.4px; margin-bottom: 6px; }
.bb-h3{ font-weight: 900; letter-spacing: -0.2px; }
.bb-sub{ color: var(--muted); margin: 0; }
.bb-mini{ font-size: .88rem; color: rgba(91,100,118,.95); }
.mini{ font-size: .86rem; color: rgba(91,100,118,.95); }


/* =========================================================================
   6. FORMS - Form controls & validation
   ========================================================================= */

.form-control-lg{
  padding: .62rem .9rem;
  font-size: 1rem;
  border-radius: 14px;
}
.form-check-label{
  font-size:.92rem;
  color: rgba(11,18,32,.86);
}


/* =========================================================================
   7. MODALS - Modal overlays & auth modal
   ========================================================================= */

.modal-header{
  border-bottom: 1px solid rgba(15,23,42,.08);
}
.modal-content{
  border-radius: 18px;
}

/* Auth modal specific */
.bb-auth-modal{
  border:0;
  border-radius:18px;
  box-shadow:0 22px 70px rgba(0,0,0,.18);
}
.bb-auth-modal .modal-content{
  border:0;
  border-radius:18px;
}
.bb-auth-modal .nav-link svg{
  flex-shrink: 0;
  opacity: .85;
}

/* Legal iframe modal */
.legal-iframe{
  width:100%;
  height:70vh;
  border:0;
  border-radius: 12px;
  background:#fff;
}


/* =========================================================================
   8. TABS - Tab navigation styles
   ========================================================================= */

.tab-pill .nav-link{
  display:inline-flex;
  align-items:center;
  gap:.45rem;
  border-radius: 999px;
  font-weight: 900;
  color: rgba(11,18,32,.72);
}
.tab-pill .nav-link.active{
  background: rgba(25,179,122,.14);
  color: rgba(11,18,32,.92);
}

.pill-ico{
  width:18px;
  height:18px;
  flex:0 0 18px;
  opacity:.9;
}


/* =========================================================================
   9. LANDING PAGE - Hero & homepage elements
   ========================================================================= */

.hero{
  padding: 46px 0 22px;
  background:
    radial-gradient(900px 300px at 20% 0%, rgba(21,183,217,.12), transparent 65%),
    radial-gradient(800px 260px at 82% 5%, rgba(25,179,122,.12), transparent 60%);
}
.hero h1{ letter-spacing: -0.9px; line-height: 1.05; }

/* Access card sticky (desktop) */
@media (min-width: 992px){
  .access-sticky{
    position: sticky;
    top: 92px;
  }
}

.bb-section{ padding: 10px 0 0; }


/* =========================================================================
   10. BRAND MARQUEE - Scrolling brand strip
   ========================================================================= */

.bb-brand-strip{
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(15,23,42,.08);
  background: linear-gradient(180deg, #fff, #fbfbfe);
  border-radius: 999px;
  padding: 10px 0;
}
.bb-brand-track{
  display:flex;
  gap: 12px;
  align-items:center;
  width: max-content;
  padding: 0 14px;
  animation: bb-marquee 26s linear infinite;
}
.bb-brand-pill{
  display:flex;
  align-items:center;
  justify-content:center;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.10);
  background: #fff;
  font-weight: 900;
  font-size: .92rem;
  color: rgba(11,18,32,.78);
  box-shadow: 0 8px 20px rgba(15,23,42,.04);
  user-select: none;
  white-space: nowrap;
}
.bb-brand-strip:hover .bb-brand-track{ animation-play-state: paused; }
@keyframes bb-marquee{
  from{ transform: translateX(0); }
  to{ transform: translateX(-50%); }
}
.bb-brand-fade{
  position:absolute;
  top:0;
  bottom:0;
  width:64px;
  pointer-events:none;
}
.bb-brand-fade-left{
  left:0;
  background: linear-gradient(90deg, #fff, rgba(255,255,255,0));
}
.bb-brand-fade-right{
  right:0;
  background: linear-gradient(270deg, #fff, rgba(255,255,255,0));
}
@media (prefers-reduced-motion: reduce){
  .bb-brand-track{ animation: none; }
}


/* =========================================================================
   11. HOW IT WORKS - Step cards
   ========================================================================= */

.bb-step{
  background:#fff;
  border-radius:14px;
  border:1px solid rgba(15,23,42,.10);
  box-shadow: 0 8px 20px rgba(15,23,42,.03);
  padding: 14px 16px;
}

.bb-step-head{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:6px;
  line-height:1.2;
}

.bb-step-num{
  width:26px;
  height:26px;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  font-size:.82rem;
  background: rgba(25,179,122,.10);
  border:1px solid rgba(25,179,122,.22);
  color: rgba(11,18,32,.88);
  flex:0 0 26px;
}

.bb-step-title{
  font-weight:900;
  font-size:.95rem;
  margin:0;
}

.bb-step-text{
  font-size:.90rem;
  line-height:1.45;
  margin:0;
  color: rgba(91,100,118,.95);
}

.bb-equal-box{
  display: flex;
  flex-direction: column;
  height: 100%;
}


/* =========================================================================
   12. FAQ - Accordion styling
   ========================================================================= */

.bb-faq .accordion-item{
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 10px;
}
.bb-faq .accordion-button{
  font-weight: 900;
  padding: 14px 16px;
}
.bb-faq .accordion-button:not(.collapsed){
  background: rgba(25,179,122,.10);
  color: rgba(11,18,32,.92);
  box-shadow: none;
}
.bb-faq .accordion-body{
  color: rgba(91,100,118,.95);
}


/* =========================================================================
   13. CHECKLIST - Checklist component
   ========================================================================= */

.bb-checklist{
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.bb-checkitem{
  display:flex;
  gap: 10px;
  align-items:flex-start;
  color: rgba(11,18,32,.84);
}
.bb-checkdot{
  width:10px;
  height:10px;
  border-radius: 99px;
  background: var(--accentSolid);
  box-shadow: 0 0 0 6px rgba(25,179,122,.14);
  margin-top: 6px;
}
.bb-softbox{
  border: 1px solid rgba(15,23,42,.08);
  background: rgba(246,247,251,1);
  border-radius: 16px;
  padding: 14px;
}


/* =========================================================================
   14. INBOX LAYOUT - Page-level inbox structure
   ========================================================================= */

/* Page scoping */
body.bb-inbox-page{ overflow-y: auto; }
body.bb-inbox-page main{ overflow: visible; }
body.bb-inbox-page .container{ max-width:1180px !important; }
.bb-inbox-wrap{ min-height: calc(100vh - 180px); }

/* Hero card (guest) */
body.bb-inbox-page .bb-hero-card{
  background:
    radial-gradient(900px 260px at 15% 0%, rgba(21,183,217,.10), transparent 65%),
    radial-gradient(820px 260px at 85% 10%, rgba(25,179,122,.10), transparent 60%),
    #ffffff;
}


/* =========================================================================
   15. INBOX - Points Box
   ========================================================================= */

.bb-points{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(15,23,42,.10);
  background: rgba(246,247,251,1);
  min-width: 220px;
  text-align:right;
}

.bb-points-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  font-size:13px;
  margin: 2px 0;
}
.bb-points-label{ color: rgba(15,23,42,.65); }
.bb-points-value{ font-weight:800; color: rgba(11,18,32,.92); }


/* =========================================================================
   16. INBOX - Featured Carousel (Top 3)
   ========================================================================= */

.bb-topbar{
  border:1px solid rgba(15,23,42,.10);
  border-radius:14px;
  padding:12px;
  background:#fff;
}

.bb-topbar-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:10px;
}

.bb-carousel-swipe{
  display:flex;
  gap:16px;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x mandatory;
  padding: 0 18px 6px 18px;
  justify-content:flex-start;
}

/* Featured card */
.bb-topcard{
  scroll-snap-align:center;
  flex:0 0 auto;
  width:520px;
  min-width:520px;
  border:1px solid rgba(15,23,42,.10);
  border-radius:14px;
  background:#fff;
  padding:12px;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  text-decoration:none;
  color:inherit;
}

.bb-topcard-meta{ margin-bottom:10px; }
.bb-topcard-title{
  font-weight:800;
  font-size:14px;
  line-height:1.2;
  margin-bottom:4px;
}
.bb-topcard-sub{
  font-size:12px;
  color:rgba(15,23,42,.65);
}

.bb-topcard-frame{
  height:300px;
  border-radius:12px;
  border:1px solid rgba(15,23,42,.10);
  overflow:hidden;
  background:rgba(15,23,42,.03);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* Mobile carousel peek */
@media (max-width:576px){
  .bb-carousel-swipe{
    padding: 0 12vw 6px 12vw;
    scroll-padding: 12vw;
  }
  .bb-topcard{
    width:76vw;
    min-width:76vw;
  }
  /* Scaling handled by JavaScript */
}


/* =========================================================================
   17. INBOX - DEM List
   ========================================================================= */

.bb-dem-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.bb-dem-item{
  background:#fff;
  border:1px solid rgba(15,23,42,.10);
  border-radius:12px;
  overflow:hidden;
}

/* Unread state: subtle border glow */
.bb-dem-item.bb-unread{
  border-color: rgba(21,183,217,.28);
  box-shadow: 0 10px 28px rgba(15,23,42,.06);
}

/* DEM header */
.bb-dem-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:12px;
}

.bb-dem-left{
  display:flex;
  gap:10px;
  align-items:flex-start;
  min-width:0;
}
.bb-dem-meta{ min-width:0; }
.bb-dem-sender{
  font-size:12px;
  color:rgba(15,23,42,.70);
  font-weight:700;
  line-height:1.2;
}
.bb-dem-brand{ font-weight:600; }
.bb-dem-subject{
  font-size:14px;
  font-weight:800;
  line-height:1.2;
  margin-top:2px;
}
.bb-dem-subject a{
  color:inherit;
  text-decoration:none;
}
.bb-dem-subject a:hover{
  text-decoration:underline;
}

/* Brand logo */
.bb-dem-logo{
  width:40px;
  height:40px;
  border-radius:12px;
  overflow:hidden;
  background:rgba(15,23,42,.06);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}
.bb-dem-logo img{
  width:100%;
  height:100%;
  object-fit:contain;
  padding:6px;
  display:block;
}

/* Right side: date + actions */
.bb-dem-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex:0 0 auto;
}
.bb-dem-date{
  font-size:12px;
  color:rgba(15,23,42,.70);
  white-space:nowrap;
}

.bb-dem-actions{
  display:flex;
  flex-direction:column;
  gap:8px;
}

/* DEM preview section */
.bb-dem-preview{
  padding:0 12px 12px 12px;
}


/* =========================================================================
   18. INBOX - Preview System
   ========================================================================= */

.bb-preview-link{
  display:block;
  text-decoration:none;
  color:inherit;
}

.bb-preview-wrap{
  height:200px;
  border-radius:12px;
  border:1px solid rgba(15,23,42,.10);
  overflow:hidden;
  background: rgba(246,247,251,1);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.bb-preview-iframe{
  width:600px;
  min-width:600px;
  height:200px;
  border:0;
  display:block;
  background:#fff;
  pointer-events:none;
  flex-shrink: 0;
}

/* Height variants */
.bb-preview-200{ height:200px; }
.bb-preview-300{ height:300px; }
.bb-preview-400{ height:400px; }

iframe.bb-preview-200{ height:200px; }
iframe.bb-preview-300{ height:300px; }
iframe.bb-preview-400{ height:400px; }




/* =========================================================================
   19. INBOX - Pagination
   ========================================================================= */

.pagination svg{
  width:14px !important;
  height:14px !important;
  max-width:14px !important;
  max-height:14px !important;
  display:inline-block !important;
  vertical-align:middle !important;
}
.pagination .page-link{
  line-height:1 !important;
  padding:.375rem .65rem !important;
}


/* =========================================================================
   20. DEM DETAIL PAGE - Single DEM view
   ========================================================================= */

body.bb-dem-page{
  overflow-y: auto !important;
}

body.bb-dem-page main{
  overflow: visible !important;
}

body.bb-dem-page .bb-dem-frame{
  overflow: visible !important;
}

.bb-dem-frame{
  border:1px solid rgba(15,23,42,.10);
  border-radius:14px;
  background:#fff;
  overflow:visible;
}

/* DEM header layout */
.bb-dem-head--stack{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.bb-dem-btnrow{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.bb-btn-grow{
  width:auto;
}

@media (max-width: 576px){
  .bb-dem-head{ gap:10px; }
  .bb-dem-actions{ gap:6px; }
  .bb-icon-btn{ width:36px; height:36px; }

  .bb-dem-btnrow{
    flex-direction:row;
    align-items:stretch;
  }
  .bb-btn-grow{
    flex:1 1 0;
    min-width:0;
  }
  .bb-dem-date{
    font-size:12px;
    opacity:.8;
  }
  .bb-dem-subject-link{
    display:inline-block;
    word-break:break-word;
  }
}


/* =========================================================================
   21. DEM - Progress Bar & Toast
   ========================================================================= */

.bb-readbar{
  border:1px solid rgba(15,23,42,.10);
  border-radius:14px;
  padding:12px;
  background:#fff;
}
.bb-readbar-label{
  font-size:13px;
  color:rgba(15,23,42,.75);
  margin-bottom:8px;
}

.bb-toast{
  position:fixed;
  left:0;
  right:0;
  bottom:18px;
  display:flex;
  justify-content:center;
  pointer-events:none;
  z-index:9999;
  opacity:0;
  transform: translateY(10px);
  transition: all .25s ease;
}
.bb-toast.bb-toast-show{
  opacity:1;
  transform: translateY(0);
}
.bb-toast-card{
  pointer-events:auto;
  background:#0f172a;
  color:#fff;
  border-radius:16px;
  padding:12px 14px;
  min-width: 320px;
  max-width: 92vw;
  box-shadow: 0 10px 25px rgba(0,0,0,.18);
}
.bb-toast-title{
  font-weight:800;
  margin-bottom:2px;
}
.bb-toast-msg{
  font-size:13px;
  opacity:.92;
}


/* =========================================================================
   22. UTILITY CLASSES - Misc helpers
   ========================================================================= */

.bb-line{
  height:1px;
  background: rgba(15,23,42,.08);
}


/* =========================================================================
   23. MOBILE RESPONSIVE - Global mobile adjustments
   ========================================================================= */

@media (prefers-reduced-motion: reduce){
  .bb-brand-track{ animation: none; }
}
