:root {
  --primary-color: #2879f3;
  --primary-hover: #0653c7;
  --accent-color: #ff2a00;
  --bg-white: #ffffff;
  --text-main: #1a1a1a;
  --text-muted: #666666;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --radius-lg: 24px;
  --radius-md: 12px;
  --card-width: 400px;
  --card-min-height: 500px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: #ffffff;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-main);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

/* Light Dynamic Background */
body::before, body::after {
  content: "";
  position: fixed;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  z-index: -1;
  filter: blur(100px);
  opacity: 0.25; /* Slightly more accented */
  pointer-events: none;
  animation: float 18s infinite alternate ease-in-out;
}

body::before {
  background: radial-gradient(circle, var(--primary-color), transparent);
  top: -15%;
  right: -10%;
}

body::after {
  background: radial-gradient(circle, var(--accent-color), transparent);
  bottom: -15%;
  left: -10%;
  animation-delay: -5s;
  animation-duration: 22s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(80px, 80px) scale(1.15) rotate(10deg); }
  100% { transform: translate(-40px, 40px) scale(0.95) rotate(-5deg); }
}

/* Particles System */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

/* Particles System - Hearts Only */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.heart {
  position: absolute;
  bottom: -50px;
  opacity: 0;
  background: var(--color, var(--accent-color));
  transform: rotate(-45deg);
  animation: heartFloat var(--duration, 15s) linear infinite;
  animation-delay: var(--delay, 0s);
}

.heart::before, .heart::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: inherit;
  border-radius: 50%;
}

.heart::before { top: -50%; left: 0; }
.heart::after { left: 50%; top: 0; }

/* Heart Variations */
.heart-sm { width: 12px; height: 12px; }
.heart-md { width: 22px; height: 22px; }
.heart-lg { width: 35px; height: 35px; }

@keyframes heartFloat {
  0% { 
    transform: translateY(0) rotate(var(--start-rot, -45deg)) scale(0.5); 
    opacity: 0; 
  }
  10% { opacity: var(--max-opacity, 0.3); }
  90% { opacity: var(--max-opacity, 0.3); }
  100% { 
    transform: translateY(-115vh) rotate(var(--end-rot, 45deg)) scale(1.2); 
    opacity: 0; 
  }
}

/* Background Elements */
.bg_logo {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  z-index: -1;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0.05;
}

.logo {
  width: 80vmin;
  height: 80vmin;
  background: url('logopisio.svg') no-repeat center;
  background-size: contain;
}

/* Containers */
.card-container {
  width: 90%;
  max-width: var(--card-width);
  margin: 20px 0;
  position: relative;
  z-index: 10;
}

.log-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-md);
  width: 100%;
  min-height: var(--card-min-height);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Typography */
.heading {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 1.5rem 0;
  text-align: center;
  background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.titoloDomanda {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-main);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(40, 121, 243, 0.2);
}

.btn:hover { 
  transform: translateY(-1px); 
  box-shadow: 0 6px 15px rgba(40, 121, 243, 0.3);
}

.btn:active { transform: scale(0.97); }

.btn-secondary {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(40, 121, 243, 0.05);
}

/* Forms */
.input-group {
  margin-bottom: 1.2rem;
  position: relative;
}

.input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.05);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: white;
}

/* Offer Buttons */
.shotbtn, .drinkbtn {
  border: none;
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shotbtn { background: #e3f2fd; color: #2196f3; }
.drinkbtn { background: #fbe9e7; color: #ff5722; }

.shotbtn:active, .drinkbtn:active { transform: scale(0.9); }

/* Questionnaire Progress */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(0,0,0,0.05);
  border-radius: 3px;
  margin-bottom: 30px;
  overflow: hidden;
}

.progress-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  transition: width 0.4s ease;
}

/* Match & Chat Items */
.match-item, .chat-item {
  background: white;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 250px;
  max-width: 350px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: white;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.35), 
             toastOut 0.3s 3.7s cubic-bezier(0.68, -0.55, 0.265, 1.35) forwards;
  border-left: 4px solid var(--primary-color);
}

.toast-success { border-left-color: #10b981; }
.toast-error { border-left-color: #ef4444; }
.toast-info { border-left-color: var(--primary-color); }

.toast-icon { font-size: 1.25rem; }
.toast-success .toast-icon { color: #10b981; }
.toast-error .toast-icon { color: #ef4444; }
.toast-info .toast-icon { color: var(--primary-color); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

.modal-content {
  background: var(--bg-white);
  padding: 30px;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 400px;
  position: relative;
  box-shadow: var(--shadow-md);
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .heading { font-size: 1.5rem; }
  .log-card { padding: 25px; min-height: 480px; }
}