/* Layout Desktop Responsive - Stile Facebook/Dashboard */

/* ===== BREAKPOINTS ===== */
/* Mobile: < 768px (default in style.css) */
/* Tablet: 768px - 1023px */
/* Desktop: >= 1024px */

/* ===== LAYOUT BASE DESKTOP ===== */
@media (min-width: 1024px) {
  body {
    overflow-x: hidden;
  }
  
  /* Container principale: rimuovi max-width e centra */
  .app {
    max-width: 100%;
    margin: 0;
    display: grid;
    grid-template-columns: 260px 1fr 320px;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "sidebar header header"
      "sidebar main aside";
    min-height: 100vh;
    box-shadow: none;
  }
  
  /* Topbar diventa header full-width */
  .topbar {
    grid-area: header;
    border-bottom: 1px solid var(--line);
    padding: 14px 24px;
  }
  
  /* Sidebar sinistra */
  .sidebar {
    grid-area: sidebar;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  
  /* Main content centrale */
  .screen,
  main.screen {
    grid-area: main;
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
  }
  
  /* Panel destro (profilo/stats) */
  .aside-panel {
    grid-area: aside;
    background: var(--surface);
    border-left: 1px solid var(--line);
    padding: 24px 16px;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
  }
  
  /* Logo sidebar */
  .sidebar-logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 32px;
    padding: 0 8px;
  }
  
  .sidebar-logo b {
    color: var(--accent);
  }
  
  /* Menu sidebar */
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
  }
  
  .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.95rem;
  }
  
  .sidebar-nav a:hover {
    background: var(--surface-2);
  }
  
  .sidebar-nav a.active {
    background: var(--accent);
    color: #fff;
  }
  
  .sidebar-nav a .icon {
    font-size: 1.3rem;
    width: 24px;
    text-align: center;
  }
  
  /* User card nel sidebar bottom */
  .sidebar-user {
    margin-top: auto;
    padding: 16px;
    background: var(--surface-2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
  }
  
  .sidebar-user-info {
    flex: 1;
    min-width: 0;
  }
  
  .sidebar-user-name {
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .sidebar-user-role {
    font-size: 0.75rem;
    color: var(--muted);
  }
}

/* ===== TABLET LAYOUT ===== */
@media (min-width: 768px) and (max-width: 1023px) {
  .app {
    max-width: 100%;
    margin: 0;
  }
  
  /* Su tablet: nascondi aside, sidebar diventa hamburger */
  .aside-panel {
    display: none;
  }
  
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--surface);
    z-index: 100;
    transition: left 0.3s;
    border-right: 1px solid var(--line);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  /* Overlay quando sidebar aperta */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
    display: none;
  }
  
  .sidebar-overlay.show {
    display: block;
  }
  
  /* Hamburger button */
  .hamburger {
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
  }
  
  .hamburger span {
    width: 24px;
    height: 3px;
    background: var(--text);
    border-radius: 2px;
    transition: 0.3s;
  }
  
  .screen {
    padding: 20px;
  }
}

/* ===== MOBILE: mantieniamo layout attuale ===== */
@media (max-width: 767px) {
  .app {
    max-width: 100%;
  }
  
  .sidebar,
  .aside-panel {
    display: none;
  }
  
  .hamburger {
    display: none;
  }
  
  /* Mobile usa layout verticale standard */
  .screen {
    padding: 16px;
  }
}

/* ===== PROFILE PANEL (desktop right column) ===== */
.profile-panel {
  background: var(--surface-2);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.profile-panel-header {
  text-align: center;
  margin-bottom: 20px;
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 2rem;
  margin: 0 auto 12px;
}

.profile-name {
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.profile-username {
  color: var(--muted);
  font-size: 0.85rem;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.stat-item {
  background: var(--surface);
  padding: 12px;
  border-radius: 10px;
  text-align: center;
}

.stat-value {
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Quick Actions */
.quick-actions {
  background: var(--surface-2);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.quick-actions-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 16px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.quick-action-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

.quick-action-btn .icon {
  font-size: 1.2rem;
}

/* ===== Widget "Più desiderate" nel pannello destro (desktop) ===== */
.aside-wanted { background: var(--surface-2); border-radius: 16px; padding: 16px; margin-bottom: 20px; }
.aside-wanted-title { font-weight: 800; font-size: 0.95rem; margin-bottom: 10px; text-align: center; }
.aside-wanted-empty { font-size: 0.82rem; color: var(--muted); text-align: center; padding: 10px 0; }
.aside-wanted-empty a { color: var(--accent-2); font-weight: 700; }
.aw-block { display: none; flex-direction: column; }
.aw-block.on { display: flex; }
/* Titolo della tipologia di gioco (Pokémon, Magic…) come pillola centrata; il colore del testo
   arriva inline da RRGameColor (una tinta per gioco, leggibile su sfondo scuro). */
.aw-game { align-self: center; font-weight: 800; font-size: 0.82rem; margin: 0 0 8px; padding: 3px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.aw-row { display: flex; align-items: center; gap: 8px; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.aw-row:last-child { border-bottom: none; }
.aw-rank { flex: none; min-width: 26px; text-align: center; font-weight: 800; }
.aw-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 0.86rem; }
.aw-name small { display: block; color: var(--muted); font-size: 0.7rem; font-weight: 500; }
.aw-count { flex: none; font-size: 0.74rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.aw-cta { display: block; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); text-align: center; font-size: 0.76rem; color: var(--muted); text-decoration: none; line-height: 1.35; }
.aw-cta b { color: var(--accent-2); }

/* ===== GRID LAYOUT per aste/cards ===== */
@media (min-width: 1024px) {
  .auction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
  }
  
  .auction-item {
    margin-bottom: 0;
  }
}

/* ===== UTILITIES ===== */
.desktop-only {
  display: none;
}

@media (min-width: 1024px) {
  .desktop-only {
    display: block;
  }
  
  .mobile-only {
    display: none;
  }
}

@media (max-width: 1023px) {
  .mobile-only {
    display: block;
  }
}


/* ============================================================
   Reraise — Shell components (iniettati da layout-loader.js)
   Campana notifiche + badge, bottom-nav mobile, drawer, ecc.
   ============================================================ */

/* Campana notifiche nella topbar (desktop + mobile) */
.rr-bell{ position:relative; display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:40px; border-radius:12px; font-size:1.2rem; text-decoration:none;
  color:var(--text); background:var(--surface-2); border:1px solid var(--line); flex:none; margin-left:8px; }
.rr-bell:hover{ background:var(--surface); }
.rr-badge{ position:absolute; top:-5px; right:-5px; background:var(--accent); color:#fff;
  font-size:.66rem; font-weight:800; line-height:1; padding:3px 6px; border-radius:999px; min-width:18px;
  text-align:center; border:2px solid var(--bg); }

/* Badge nelle liste di navigazione (sidebar/drawer) */
.notif-badge{ margin-left:auto; background:var(--accent); color:#fff; font-size:.7rem; font-weight:800;
  padding:2px 7px; border-radius:999px; min-width:20px; text-align:center; }

/* Logout nel blocco utente della sidebar */
.rr-logout{ background:none; border:none; color:var(--muted); cursor:pointer; font-size:1.15rem;
  padding:6px; border-radius:8px; flex:none; }
.rr-logout:hover{ color:var(--text); background:var(--surface); }

/* Card promo premium (colonna destra) */
.premium-card{ background:linear-gradient(135deg,var(--accent-2),var(--accent)); padding:20px;
  border-radius:16px; text-align:center; color:#fff; }

/* ---------- BOTTOM NAV (mobile/tablet) ---------- */
.rr-bottomnav{ position:fixed; left:0; right:0; bottom:0; z-index:60; display:flex; align-items:flex-end;
  justify-content:space-around; gap:2px; padding:8px 6px calc(8px + env(safe-area-inset-bottom,0px));
  background:rgba(20,25,34,.97); backdrop-filter:blur(12px); border-top:1px solid var(--line); }
.rr-bottomnav a, .rr-bottomnav button{ position:relative; flex:1; display:flex; flex-direction:column;
  align-items:center; gap:3px; background:none; border:none; cursor:pointer; text-decoration:none;
  color:var(--muted); font-family:inherit; font-weight:600; padding:6px 2px; border-radius:12px;
  transition:color .15s ease, background .15s ease, transform .1s ease; }
.rr-bottomnav a:active, .rr-bottomnav button:active{ transform:scale(.93); }
.rr-bottomnav a .ic, .rr-bottomnav button .ic{ font-size:1.3rem; line-height:1; }
.rr-bottomnav a .lb, .rr-bottomnav button .lb{ font-size:.65rem; }
.rr-bottomnav a.active{ color:var(--accent); background:var(--accent-soft); }
.rr-bottomnav .rr-badge{ top:-2px; right:22%; }
.rr-bottomnav .rr-fab{ flex:0 0 auto; width:56px; height:56px; margin:-26px 4px 0; border-radius:50%;
  background:var(--accent-grad); color:#fff; font-size:1.9rem; font-weight:300; display:flex; align-items:center;
  justify-content:center; box-shadow:0 10px 24px rgba(255,92,57,.5); }
.rr-bottomnav .rr-fab:active{ transform:scale(.93); }

/* ---------- DRAWER (mobile/tablet) ---------- */
.rr-overlay{ position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:70; display:none; }
.rr-overlay.open{ display:block; }
.rr-drawer{ position:fixed; top:0; bottom:0; left:0; width:280px; max-width:82vw; z-index:71;
  background:var(--surface); border-right:1px solid var(--line);
  padding:20px 16px calc(20px + env(safe-area-inset-bottom,0px));
  transform:translateX(-100%); transition:transform .25s ease; overflow-y:auto;
  display:flex; flex-direction:column; }
.rr-drawer.open{ transform:none; }
.rr-drawer-head{ margin-bottom:18px; }
.rr-drawer-nav{ display:flex; flex-direction:column; gap:4px; }
.rr-drawer-nav a{ display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius:12px;
  color:var(--text); text-decoration:none; font-weight:600; }
.rr-drawer-nav a .icon{ font-size:1.25rem; width:24px; text-align:center; }
.rr-drawer-nav a:hover{ background:var(--surface-2); }
.rr-drawer-nav a.active{ background:var(--accent-grad); color:#fff; }

/* Spazio per la bottom-nav e larghezza leggibile su tablet */
@media (max-width:1023px){
  .screen{ padding-bottom:96px; }
}
@media (min-width:768px) and (max-width:1023px){
  .screen{ max-width:720px; margin:0 auto; }
}

/* Su desktop nascondi la shell mobile e riafferma sidebar/aside */
@media (min-width:1024px){
  .rr-bottomnav, .rr-drawer, .rr-overlay{ display:none !important; }
  .sidebar.desktop-only{ display:flex !important; }
  .aside-panel.desktop-only{ display:block !important; }
}


/* Titolo pagina nella topbar unica */
.rr-title{ font-weight:800; font-size:1.15rem; letter-spacing:.3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topbar .chips-pill{ flex:none; }
