/* ============================================================
   style.css — Manuel Zambelli Apps Homepage
   Design: iOS Glassmorphism · Dark Futuristic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── Variables ─────────────────────────────────────────────── */
:root {
  --glass-card:   rgba(255,255,255,0.07);
  --glass-border: rgba(255,255,255,0.12);
  --glass-hover:  rgba(255,255,255,0.13);
  --glass-strong: rgba(10,11,18,0.55);
  --accent:       #a78bfa;
  --accent-2:     #60a5fa;
  --text-primary:   #f0f4ff;
  --text-secondary: rgba(240,244,255,0.6);
  --text-muted:     rgba(240,244,255,0.35);
  --card-radius: 22px;
  --icon-radius: 18px;
  --t: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; height: 100%; }
body {
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  background-color: #05060f;
}

/* ─── iOS-style wallpaper background ───────────────────────── */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-canvas::before,
.bg-canvas::after,
.bg-blob-1,
.bg-blob-2 {
  content: '';
  position: absolute;
  border-radius: 50%;
}
.bg-canvas::before {
  width: 900px; height: 900px;
  background: radial-gradient(circle, #3b1fa8 0%, transparent 65%);
  top: -300px; left: -200px;
  opacity: 0.55;
  animation: blobDrift1 20s ease-in-out infinite alternate;
}
.bg-canvas::after {
  width: 750px; height: 750px;
  background: radial-gradient(circle, #1e3a8a 0%, transparent 65%);
  bottom: -200px; right: -150px;
  opacity: 0.45;
  animation: blobDrift2 25s ease-in-out infinite alternate;
}
.bg-blob-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #701a75 0%, transparent 65%);
  top: 20%; right: 5%;
  opacity: 0.30;
  animation: blobDrift3 18s ease-in-out infinite alternate;
}
.bg-blob-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #0e4f5c 0%, transparent 65%);
  bottom: 5%; left: 10%;
  opacity: 0.30;
  animation: blobDrift4 22s ease-in-out infinite alternate;
}

@keyframes blobDrift1 { from{transform:translate(0,0) scale(1)} to{transform:translate(80px,60px) scale(1.1)} }
@keyframes blobDrift2 { from{transform:translate(0,0) scale(1)} to{transform:translate(-60px,-50px) scale(1.08)} }
@keyframes blobDrift3 { from{transform:translate(0,0)} to{transform:translate(40px,70px)} }
@keyframes blobDrift4 { from{transform:translate(0,0)} to{transform:translate(-30px,-40px)} }

.bg-blur {
  position: fixed;
  inset: 0;
  z-index: 0;
  backdrop-filter: blur(80px) saturate(1.6);
  -webkit-backdrop-filter: blur(80px) saturate(1.6);
  pointer-events: none;
}

.bg-grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  background-image: url("https://grainy-gradients.vercel.app/noise.svg");
  opacity: 0.12;
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

/* ─── Layout ─────────────────────────────────────────────────── */
.app-wrapper {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 80px;
}

/* ─── Header ──────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(5,6,15,0.42);
  backdrop-filter: blur(28px) saturate(1.8);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.clock-widget { display: flex; align-items: baseline; gap: 1px; }
.clock-time {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.clock-seconds {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.weather-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition: background var(--t), transform var(--t);
}
.weather-widget:hover { background: var(--glass-hover); transform: scale(1.02); }
.weather-icon { font-size: 1.25rem; line-height: 1; }
.weather-info { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.weather-temp { font-size: 0.9rem; font-weight: 600; }
.weather-city { font-size: 0.68rem; color: var(--text-secondary); }

/* ─── Main Content ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  width: 100%;
  padding-top: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero {
  text-align: center;
  padding: 56px 24px 24px;
  animation: fadeDown 0.9s ease both;
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-title {
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
  background: linear-gradient(160deg, #ffffff 0%, #c4b5fd 55%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 40px rgba(167,139,250,0.25));
}
.hero-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 400;
}

/* Search */
.search-wrapper {
  width: 100%;
  max-width: 380px;
  padding: 0 20px;
  margin: 20px auto 0;
  animation: fadeDown 0.9s 0.1s ease both;
  text-align: center;
  position: relative;
}
.search-bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  padding: 8px 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}
.search-icon {
  width: 14px;
  height: 14px;
  opacity: 0.45;
}
.search-bar:focus-within {
  border-color: rgba(167,139,250,0.5);
  background: rgba(255,255,255,0.1);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.12), 0 8px 32px rgba(0,0,0,0.3);
}
.search-input {
  flex: 1;
  background: none; border: none; outline: none;
  font-family: 'Inter', sans-serif; font-size: 0.92rem;
  color: var(--text-primary); caret-color: var(--accent);
}
.search-input::placeholder { color: var(--text-muted); }
.search-clear {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); display: none; align-items: center;
  justify-content: center; transition: color var(--t);
}
.search-clear.visible { display: flex; }

.search-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 8px;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.search-hint kbd {
  background: rgba(255,255,255,0.1);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: inherit;
}

/* Apps Grid */
.apps-section {
  width: 100%;
  max-width: 820px;
  padding: 44px 24px 0;
  animation: fadeUp 0.9s 0.2s ease both;
  position: relative;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.apps-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

/* No Results Overlay */
.no-results {
  position: absolute;
  top: 60px;
  left: 0; right: 0;
  text-align: center;
  color: var(--text-muted);
  display: none;
  z-index: 5;
}
.no-results.visible { display: block; }
.no-results-icon { font-size: 2rem; margin-bottom: 8px; }

/* Card */
.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 14px 14px;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  width: 110px;
  transition: transform var(--t), background var(--t), border-color var(--t), box-shadow var(--t);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  animation: cardIn 0.45s ease both;
  overflow: hidden;
}
@keyframes cardIn {
  from { opacity: 0; transform: scale(0.85) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.app-card::after {
  content: "";
  position: absolute;
  top: -100%; left: -100%;
  width: 50%; height: 300%;
  background: linear-gradient(to bottom right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0) 100%);
  transform: rotate(45deg);
  transition: 0.6s;
  pointer-events: none;
}
.app-card:hover::after { left: 100%; top: 100%; }

.app-card:hover {
  transform: translateY(-8px) scale(1.05);
  background: var(--glass-hover);
  border-color: rgba(167,139,250,0.35);
  box-shadow: 0 20px 50px rgba(0,0,0,0.45), 0 0 0 1px rgba(167,139,250,0.2);
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* Icon wrap */
.app-icon-wrap {
  width: 62px; height: 62px;
  border-radius: var(--icon-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform var(--t), background var(--t);
  position: relative;
  overflow: visible;
  font-size: 2.8rem;
  box-shadow: inset 0 0 12px rgba(255,255,255,0.03);
}
.app-icon-wrap span, .app-icon-wrap img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: normal;
  margin-top: 0;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25));
}
.app-card:hover .app-icon-wrap { transform: scale(1.12); background: rgba(255,255,255,0.12); }
.app-name { font-size: 0.73rem; font-weight: 500; color: var(--text-secondary); text-align: center; }

.app-card.in-maintenance {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.03);
}

.app-card.in-maintenance .app-icon-wrap {
  filter: grayscale(1) opacity(0.5);
  transition: filter var(--t), opacity var(--t);
}

.app-card.in-maintenance:hover .app-icon-wrap {
  filter: grayscale(0.8) opacity(0.7);
}

.maintenance-text-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  font-weight: 800;
  color: #fbbf24; /* More vivid orange */
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(0, 0, 0, 0.45); /* Dark background to make text pop */
  backdrop-filter: blur(2px);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.badge-maintenance {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #f59e0b;
  color: #000;
  font-size: 0.9rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  pointer-events: none;
  border: 2px solid rgba(0,0,0,0.8);
  animation: pulse-maintenance 2s infinite;
}

@keyframes pulse-maintenance {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.maintenance-modal-content {
  text-align: center;
  padding: 10px 0;
}

.maintenance-modal-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  display: block;
}

.maintenance-modal-text {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Modals Overlay (FIXED) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  z-index: 1000;
  display: none; /* controllato da script */
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.3s ease forwards; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: rgba(14,15,28,0.92);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 28px;
  padding: 32px;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 40px 100px rgba(0,0,0,0.7);
  max-height: 90vh;
  overflow-y: auto;
  animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalPop { from { transform: scale(0.9) translateY(20px); } to { transform: scale(1) translateY(0); } }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal-title { font-size: 1.25rem; font-weight: 600; }
.modal-close {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary); transition: var(--t);
}

.weather-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; }
.weather-stat-box {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; padding: 16px; text-align: center;
}
.weather-stat-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; display: block; }
.weather-stat-val { font-size: 1.1rem; font-weight: 600; }

.privacy-modal p, .privacy-modal li { font-size: 0.84rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 8px; }
.privacy-modal h3 { font-size: 0.95rem; font-weight: 600; color: var(--accent); margin: 16px 0 8px; }

.privacy-modal-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.1); }
#manage-consent { color: var(--accent); background: none; border: none; cursor: pointer; text-decoration: underline; font-size: 0.75rem; }
.btn-close-privacy { padding: 9px 20px; border-radius: 50px; background: rgba(255,255,255,0.1); border: 1px solid var(--glass-border); color: #fff; cursor: pointer; }

/* Cookie Banner (FORCING AT BOTTOM) */
.cookie-banner {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 2000;
  width: min(92vw, 560px);
  background: rgba(14,15,28,0.92);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 20px 24px;
  backdrop-filter: blur(30px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: flex !important;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cookie-banner.active { transform: translateX(-50%) translateY(0); }

.cookie-text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.6; }
.cookie-link { color: var(--accent); cursor: pointer; text-decoration: underline; }
.cookie-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-cookie { padding: 8px 18px; border-radius: 50px; cursor: pointer; border: 1px solid transparent; font-size: 0.82rem; }
.btn-reject { background: rgba(255,255,255,0.1); color: #fff; }
.btn-accept { background: var(--accent); color: #000; font-weight: 600; }

.footer { text-align: center; padding: 28px 20px; color: var(--text-muted); font-size: 0.73rem; width: 100%; position: relative; z-index: 5; }
.footer .footer-link { background: none; border: none; color: inherit; cursor: pointer; text-decoration: underline; }
#consent-badge { font-size: 0.65rem; color: var(--accent); margin-left: 6px; }

@media (max-width: 520px) {
  .app-card { width: 95px; }
  .app-icon-wrap { width: 50px; height: 50px; font-size: 1.8rem; }
  .modal-content { padding: 20px; }
  .cookie-banner { bottom: 12px; }
}
