/* -------------------------------------------------
   RESET + BASE
------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto;
  background: var(--bg);
  color: var(--txt);
  height: 100%;
  overflow: hidden;
}
:root {
  --bg: #e9eef6;
  --txt: #222;
  --glass-bg: rgba(255,255,255,0.3);
  --glass-border: rgba(255,255,255,0.5);
  --primary: #007aff;
  --danger: #d72638;
}
body.dark {
  --bg: #111;
  --txt: #eee;
  --glass-bg: rgba(0,0,0,0.35);
  --glass-border: rgba(255,255,255,0.1);
}

/* Scroll invisibile */
::-webkit-scrollbar { width: 0; }

/* -------------------------------------------------
   COMPONENTI GLASS
------------------------------------------------- */
.glass {
  backdrop-filter: blur(15px);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 16px;
}
.glass-bar {
  backdrop-filter: blur(12px);
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
}

/* -------------------------------------------------
   LOGIN SCREEN
------------------------------------------------- */
.center-screen {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 350px;
  text-align: center;
}
.center-screen input {
  width: 100%;
  margin: 10px 0;
  padding: 12px;
  border-radius: 12px;
  border: none;
  font-size: 1rem;
  outline: none;
}
.error { color: var(--danger); margin-top: 8px; }

/* -------------------------------------------------
   APP CONTAINER
------------------------------------------------- */
.app-container {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.app-title {
  font-size: 1.4rem;
  font-weight: 600;
}

/* -------------------------------------------------
   BOTTOM NAV
------------------------------------------------- */
.bottom-nav {
  height: 60px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--glass-border);
}
.nav-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  opacity: 0.5;
}
.nav-btn.active {
  opacity: 1;
  transform: scale(1.1);
}

/* -------------------------------------------------
   CONTENT AREA
------------------------------------------------- */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}
.controls {
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  gap: 10px;
}
.controls input,
.controls select {
  padding: 10px;
  flex: 1;
  border-radius: 12px;
  border: none;
  outline: none;
}

/* -------------------------------------------------
   CARDS GRID
------------------------------------------------- */
.cards {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  padding-bottom: 80px;
}
.card {
  padding: 16px;
  border-radius: 20px;
  background: #fff;
  color: #000;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform .15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.card:hover {
  transform: scale(1.03);
}
.card .store {
  font-size: 1.1rem;
  font-weight: 600;
}
.card small {
  opacity: 0.7;
}

/* -------------------------------------------------
   MODALS
------------------------------------------------- */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  backdrop-filter: blur(12px);
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.modal.hidden { display: none; }

.modal-content {
  width: 90%;
  max-width: 420px;
  border-radius: 20px;
  padding: 20px;
  position: relative;
}
.modal-content.fullscreen {
  max-width: 95%;
  max-height: 95%;
  text-align: center;
  padding-top: 50px;
}
.close-btn {
  position: absolute;
  right: 14px;
  top: 12px;
  background: none;
  border: none;
  font-size: 1.3rem;
  opacity: 0.7;
}
.modal-content label {
  display: block;
  margin: 12px 0 5px;
}
.modal-content input,
.modal-content select {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: none;
  margin-bottom: 8px;
}
.row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* -------------------------------------------------
   BUTTONS
------------------------------------------------- */
button {
  cursor: pointer;
}
.btn-primary {
  background: var(--primary);
  padding: 12px;
  border-radius: 12px;
  border: none;
  color: #fff;
  flex: 1;
}
.btn-secondary {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.2);
  color: inherit;
  flex: 1;
}
.btn-secondary.danger {
  border: none;
  background: var(--danger);
  color: #fff;
}
.icon-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
}

/* -------------------------------------------------
   ANIMATIONS
------------------------------------------------- */
.animated {
  transform: scale(0.9);
  opacity: 0;
  animation: pop .25s forwards;
}
@keyframes pop {
  to { transform: scale(1); opacity: 1; }
}

/* Hidden helper */
.hidden { display: none; }
