/* ============================================================
   SENTINEL — CSS Globale
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

/* ── Link ── */
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); }

/* ── Pulsanti ── */
button {
  font-family: var(--font-main);
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--transition);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--border-radius-md);
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition);
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { background: var(--color-accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text);
}

/* ── Input ── */
input, textarea, select {
  font-family: var(--font-main);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: 12px 16px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
}
input:focus, textarea:focus {
  border-color: var(--color-accent);
}
input::placeholder { color: var(--color-text-hint); }

/* ── Card ── */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--color-border-hover); }

/* ── Loader schermata iniziale ── */
#app-loader {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  z-index: 9999;
  transition: opacity 0.4s ease;
}
#app-loader.hidden { opacity: 0; pointer-events: none; }

.loader-logo { display:flex; align-items:center; gap:12px; }
.loader-icon { font-size:36px; color:var(--color-accent); }
.loader-name { font-size:28px; font-weight:700; letter-spacing:-0.5px; }
.loader-spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout principale ── */
#view-app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── Topbar fissa in alto ── */
#app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

/* ── Contenuto principale ── */
#main-content {
  flex: 1;
  padding: 20px 16px;
  /* spazio per topbar in alto + navbar in basso */
  padding-top: calc(var(--topbar-height) + 20px);
  padding-bottom: calc(var(--navbar-height) + 20px);
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

/* ── Navbar bottom ── */
#navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--color-bg-card);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding: 0 8px;
}

/* ── FAB (Floating Action Button) ── */
.fab {
  position: fixed;
  bottom: calc(var(--navbar-height) + 16px);
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-md);
  z-index: 99;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}
.fab:hover { background: var(--color-accent-hover); transform: scale(1.08); }
.fab:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Toast notifiche ── */
#toast-container {
  position: fixed;
  top: calc(var(--topbar-height) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: 12px 20px;
  font-size: 14px;
  color: var(--color-text);
  animation: toast-in 0.25s ease;
  pointer-events: auto;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}
.toast.success { border-color: var(--color-success); }
.toast.error   { border-color: var(--color-danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Badge modulo ── */
.badge-news    { background: var(--color-accent-muted); color: var(--color-news); }
.badge-buy     { background: #0d2a1e; color: var(--color-buy); }

/* ── Utility ── */
.text-muted   { color: var(--color-text-muted); }
.text-small   { font-size: 13px; }
.text-center  { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-12 { margin-bottom: 12px; }
