* { box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; margin: 0; padding: 0; background: #fafbfc; color: #1a1a1a; }
.container { max-width: 1000px; margin: 0 auto; padding: 24px; }
.header { text-align: center; margin-bottom: 32px; padding: 24px; background: white; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.06); border: 1px solid #e8eef2; }
.logo { max-width: 200px; width: 100%; height: auto; margin: 0 auto 12px; display: block; }
.logo-full { max-width: 320px; width: 100%; height: auto; margin: 0 auto 12px; display: block; }
.tagline { font-size: 32px; color: #4a5568; margin: 12px 0 0; line-height: 1.6; font-weight: 400; }

/* Logo più compatto in modalità standalone (PWA installata) */
@media (display-mode: standalone) {
  .logo {
    max-width: 140px;
    margin-bottom: 8px;
  }
  
  .logo-full {
    max-width: 240px;
    margin-bottom: 8px;
  }
  
  .header {
    padding: 16px;
    margin-bottom: 20px;
  }
  
  .tagline {
    font-size: 28px;
    margin-top: 8px;
  }
}
h1 { display: flex; align-items: center; gap: 8px; }
.badge { font-size: 12px; background: #eee; padding: 2px 6px; border-radius: 6px; }
form { display: grid; gap: 12px; margin: 16px 0 24px; background: white; padding: 24px; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.06); border: 1px solid #e8eef2; }
textarea { width: 100%; min-height: 100px; }
input[type="file"], input[type="number"], select, textarea { padding: 10px; border: 1px solid #ddd; border-radius: 8px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
button { padding: 12px 16px; border: 0; border-radius: 10px; background: #00b894; color: white; font-weight: 700; cursor: pointer; transition: all 0.3s ease; letter-spacing: 0.3px; }
button:hover:not(:disabled) { background: #00a383; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,184,148,0.3); }
button.secondary { background: #4a5568; }
button.secondary:hover:not(:disabled) { background: #2d3748; }
button:disabled { opacity: 0.6; cursor: not-allowed; }
.result { margin-top: 16px; padding: 16px; border: 1px solid #eee; border-radius: 12px; background: #fafafa; }
.notice { margin-top: 8px; padding: 10px; background: #fff8e1; border: 1px solid #ffe08a; border-radius: 8px; }
.card { border: 1px solid #e7e7e7; border-radius: 10px; padding: 12px; margin: 8px 0; background: white; }
.card h3 { margin: 0 0 6px; }
.meta { color: #555; font-size: 14px; }
.reason { font-size: 14px; margin: 2px 0; }
.listing { background: #fff; border: 2px solid #00b894; padding: 20px; border-radius: 12px; margin-top: 16px; box-shadow: 0 4px 16px rgba(0,184,148,0.1); }
.listing h3 { margin: 0 0 16px 0; color: #00b894; border-bottom: 2px solid #00b894; padding-bottom: 8px; font-weight: 700; }
.listing-section { margin: 12px 0; padding: 12px; background: #f9f9f9; border-radius: 8px; }
.listing-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.listing-content { padding: 8px; background: white; border: 1px solid #ddd; border-radius: 4px; font-family: monospace; }
.copy-btn { padding: 6px 12px; background: #4a5568; color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600; transition: all 0.3s ease; }
.copy-btn:hover { background: #2d3748; transform: translateY(-1px); }
.keywords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.keyword { background: #e3f2fd; padding: 4px 10px; border-radius: 12px; font-size: 13px; color: #1976d2; }
.tips { background: #fff3cd; border-left: 4px solid #ffc107; }
footer { margin-top: 40px; padding: 24px; text-align: center; color: #4a5568; font-size: 13px; background: white; border-radius: 12px; border: 1px solid #e8eef2; }

/* Loading overlay */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 184, 148, 0.95);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.loading-content {
  text-align: center;
  animation: slideUp 0.3s ease;
}

.loading-logo {
  width: 120px;
  height: 120px;
  animation: rotate 2s linear infinite;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.2));
}

.loading-text {
  color: white;
  font-size: 20px;
  font-weight: 600;
  margin-top: 24px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Modal condivisione */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  padding: 40px;
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.3s ease;
}

.modal-content h2 {
  color: #1a1a1a;
  margin-bottom: 16px;
  font-size: 28px;
  font-weight: 700;
}

.modal-subtitle {
  color: #4a5568;
  margin-bottom: 32px;
  font-size: 16px;
  line-height: 1.6;
}

.share-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.share-btn.whatsapp {
  background: #25D366;
  color: white;
}

.share-btn.whatsapp:hover {
  background: #20BA5A;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37,211,102,0.4);
}

.share-btn.telegram {
  background: #0088cc;
  color: white;
}

.share-btn.telegram:hover {
  background: #006699;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,136,204,0.4);
}

.share-btn.email {
  background: #4a5568;
  color: white;
}

.share-btn.email:hover {
  background: #2d3748;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74,85,104,0.4);
}

.share-icon {
  font-size: 24px;
}

.modal-close {
  background: transparent;
  color: #4a5568;
  border: none;
  padding: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: #1a1a1a;
  transform: none;
  box-shadow: none;
}

.modal-close-x {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: #4a5568;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  line-height: 1;
  padding: 0;
}

.modal-close-x:hover {
  background: #f0f0f0;
  color: #1a1a1a;
  transform: rotate(90deg);
  box-shadow: none;
}

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

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

/* Verification UI */
.verification-container {
  text-align: center;
  padding: 20px 0;
}

.verification-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e8eef2;
  border-top-color: #00b894;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.countdown-circle {
  position: relative;
  display: inline-block;
  margin: 20px 0;
}

.countdown-svg {
  transform: rotate(-90deg);
}

.countdown-bg {
  fill: none;
  stroke: #e8eef2;
  stroke-width: 6;
}

.countdown-progress {
  fill: none;
  stroke: #00b894;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 251.2;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.countdown-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: 700;
  color: #00b894;
}

.verification-success {
  text-align: center;
  padding: 20px;
}

.success-checkmark {
  width: 80px;
  height: 80px;
  background: #00b894;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 48px;
  color: white;
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Custom Upload Zone */
.upload-zone {
  border: 2px dashed #cbd5e0;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  background: #f7fafc;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.upload-zone:hover {
  border-color: #00b894;
  background: #f0fdf4;
  transform: translateY(-2px);
}

.upload-zone.drag-over {
  border-color: #00b894;
  background: #d1fae5;
  border-width: 3px;
}

.upload-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.upload-text {
  color: #1a1a1a;
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 8px 0;
}

.upload-hint {
  color: #718096;
  font-size: 13px;
  margin: 0;
}

/* Image Preview */
.image-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #f7fafc;
  border: 2px solid #00b894;
  border-radius: 12px;
  margin-top: 12px;
}

.image-preview img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #e8eef2;
}

/* Multi-photo preview (3 foto) */
#imagesPreviewContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.image-preview-multi {
  position: relative;
  background: #f7fafc;
  border: 2px solid #00b894;
  border-radius: 12px;
  padding: 12px;
  transition: all 0.3s ease;
}

.image-preview-multi:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,184,148,0.2);
}

.image-preview-multi img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #e8eef2;
  margin-bottom: 8px;
}

.remove-btn-small {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ff6b6b;
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.remove-btn-small:hover {
  background: #e85555;
  transform: rotate(90deg) scale(1.1);
}

.preview-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.file-name {
  color: #1a1a1a;
  font-weight: 600;
  font-size: 14px;
  word-break: break-word;
}

.remove-btn {
  padding: 8px 16px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.remove-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* AI Counter Badge */
.ai-counter {
  display: inline-block;
  background: #00b894;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

/* Captcha Multiforme */
.captcha-container {
  margin-top: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #f7fafc 0%, #e8eef2 100%);
  border: 2px solid #00b894;
  border-radius: 12px;
  text-align: center;
}

.captcha-question {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  min-height: 32px;
}

.captcha-refresh {
  background: #00b894;
  color: white;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.captcha-refresh:hover {
  background: #00a180;
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(0, 184, 148, 0.3);
}

.captcha-input {
  width: 100%;
  max-width: 300px;
  padding: 12px 16px;
  border: 2px solid #cbd5e0;
  border-radius: 8px;
  font-size: 15px;
  text-align: center;
  transition: border-color 0.3s ease;
}

.captcha-input:focus {
  outline: none;
  border-color: #00b894;
  box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.1);
}

/* Mobile Optimizations - Phase 2 */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }
  
  .header {
    padding: 20px 16px;
    margin-bottom: 20px;
  }
  
  .logo {
    max-width: 180px;
  }
  
  .logo-full {
    max-width: 280px;
  }
  
  .tagline {
    font-size: 28px;
  }
  
  /* Form ottimizzato per mobile */
  form {
    padding: 20px 16px;
    gap: 16px;
  }
  
  /* Touch targets più grandi (minimo 44x44px Apple HIG) */
  button {
    padding: 14px 20px;
    font-size: 16px;
    min-height: 48px;
  }
  
  /* Input fields più accessibili */
  input[type="file"],
  input[type="number"],
  select,
  textarea {
    padding: 12px;
    font-size: 16px; /* Previene zoom automatico su iOS */
    min-height: 48px;
  }
  
  textarea {
    min-height: 120px;
  }
  
  /* Due colonne diventa una su mobile */
  .row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  /* Modal ottimizzato per mobile */
  .modal-content {
    padding: 28px 20px;
    width: 95%;
    max-width: 400px;
  }
  
  .modal-content h2 {
    font-size: 22px;
    margin-bottom: 12px;
  }
  
  .modal-subtitle {
    font-size: 15px;
    margin-bottom: 24px;
  }
  
  /* Share buttons full-width su mobile */
  .share-btn {
    padding: 14px 20px;
    font-size: 15px;
  }
  
  /* Card e risultati più leggibili */
  .card {
    padding: 16px;
  }
  
  .listing {
    padding: 16px;
  }
  
  .listing-section {
    padding: 12px;
  }
  
  /* Footer più compatto */
  footer {
    padding: 20px 16px;
    font-size: 12px;
  }
  
  /* Upload zone mobile */
  .upload-zone {
    padding: 32px 16px;
  }
  
  .upload-icon {
    font-size: 40px;
  }
  
  .upload-text {
    font-size: 15px;
  }
  
  /* Preview mobile */
  .image-preview {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
  }
  
  .image-preview img {
    width: 100%;
    height: auto;
    max-height: 200px;
  }
  
  .preview-info {
    width: 100%;
  }
  
  .remove-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
  }
}

/* Extra small devices (vecchi smartphone) */
@media (max-width: 375px) {
  .container {
    padding: 12px;
  }
  
  .header {
    padding: 16px 12px;
  }
  
  form {
    padding: 16px 12px;
  }
  
  .modal-content {
    padding: 24px 16px;
  }
  
  .logo {
    max-width: 160px;
  }
  
  .logo-full {
    max-width: 220px;
  }
  
  .pwa-banner {
    bottom: 16px;
    left: 16px;
    right: 16px;
    border-radius: 12px;
  }
  
  .pwa-banner-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .pwa-banner-text {
    flex: 1;
    padding-right: 0;
  }
  
  .pwa-install-btn {
    width: 100%;
    padding: 12px 24px;
  }
  
  .pwa-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
  }
}

/* PWA Install Banner */
.pwa-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 600px;
  width: calc(100% - 48px);
  background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
  color: white;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 184, 148, 0.4);
  z-index: 9999;
  opacity: 0;
  transform: translateX(-50%) translateY(100px);
}

.pwa-banner-show {
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(100px) scale(0.9);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  position: relative;
}

.pwa-banner-icon {
  font-size: 36px;
  line-height: 1;
  animation: pulseIcon 2s ease-in-out infinite;
}

@keyframes pulseIcon {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.pwa-banner-text {
  flex: 1;
  padding-right: 100px;
}

.pwa-banner-text strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.pwa-banner-text span {
  display: block;
  font-size: 14px;
  opacity: 0.95;
  line-height: 1.4;
}

.pwa-install-btn {
  background: white;
  color: #00b894;
  border: none;
  padding: 14px 36px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: pulseButton 2s ease-in-out infinite;
}

@keyframes pulseButton {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.3);
  }
}

.pwa-install-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  background: #f0f9f7;
  animation: none;
}

.pwa-install-btn:active {
  transform: translateY(-1px) scale(0.98);
}

.pwa-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.pwa-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}