/* ================================
   RispondiTu - Homepage Style (Fantasia & Colori)
   ================================ */

/* === Background Decorativo Animato === */
.bg-decoration {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  pointer-events: none;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Forme geometriche animate */
.shape {
  position: absolute;
  opacity: 0.1;
  border-radius: 50%;
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
}

.shape-1 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  top: 10%;
  left: 5%;
  animation-delay: 0s;
}

.shape-2 {
  width: 200px;
  height: 200px;
  background: linear-gradient(135deg, #f093fb, #f5576c);
  top: 60%;
  right: 10%;
  animation-delay: 3s;
  animation-duration: 25s;
}

.shape-3 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  bottom: 5%;
  left: 15%;
  animation-delay: 6s;
  animation-duration: 30s;
}

.shape-4 {
  width: 250px;
  height: 250px;
  background: linear-gradient(135deg, #43e97b, #38f9d7);
  top: 30%;
  right: 5%;
  animation-delay: 9s;
  animation-duration: 22s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  25% {
    transform: translate(50px, -50px) rotate(90deg) scale(1.1);
  }
  50% {
    transform: translate(-30px, 30px) rotate(180deg) scale(0.9);
  }
  75% {
    transform: translate(30px, 50px) rotate(270deg) scale(1.05);
  }
}

/* === Hero Section === */
.hero-section {
  padding: 80px 0 60px 0;
  text-align: center;
  position: relative;
}

.hero-title {
  font-size: 56px;
  font-weight: 900;
  color: white;
  margin-bottom: 16px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  letter-spacing: -2px;
  animation: fadeInDown 0.8s ease;
}

.hero-subtitle {
  font-size: 24px;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 400;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  animation: fadeInUp 0.8s ease 0.2s both;
}

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

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

/* === Homepage Container === */
.homepage-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 60px 20px;
}

/* === Grid delle 4 sezioni === */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
  margin-top: 40px;
  animation: fadeIn 1s ease 0.4s both;
}

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

/* === Section Cards === */
.section-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
}

/* Tutti i figli diretti devono stare sopra il ::before */
.section-card > * {
  position: relative;
  z-index: 1;
}

.section-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--section-color-1), var(--section-color-2));
  transition: height 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.section-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  border-color: var(--section-color-1);
}

.section-card:hover::before {
  height: 100%;
  opacity: 0.05;
}

/* Colori specifici per ogni sezione */
.domanda-section {
  --section-color-1: #667eea;
  --section-color-2: #764ba2;
}

.pensiero-section {
  --section-color-1: #f093fb;
  --section-color-2: #f5576c;
}

.curiosita-section {
  --section-color-1: #4facfe;
  --section-color-2: #00f2fe;
}

.consiglio-section {
  --section-color-1: #43e97b;
  --section-color-2: #38f9d7;
}

/* === Section Icon === */
.section-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: inline-block;
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.section-card:hover .section-icon {
  animation: spin 0.6s ease;
}

@keyframes spin {
  from {
    transform: rotate(0deg) scale(1);
  }
  to {
    transform: rotate(360deg) scale(1.2);
  }
}

/* === Section Content === */
.section-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.section-date {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
  display: block;
}

/* === Question Box Home === */
.question-box-home {
  background: linear-gradient(135deg, 
    rgba(102, 126, 234, 0.1), 
    rgba(118, 75, 162, 0.05));
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 24px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  position: relative;
  z-index: 1;
}

.question-box-home .question {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
  margin: 0;
}

/* === Mini Form === */
.mini-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.mini-form input[type="text"],
.mini-form textarea {
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: white;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  user-select: text;
  cursor: text;
}

.mini-form input:focus,
.mini-form textarea:focus {
  outline: none;
  border-color: var(--section-color-1);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.mini-form textarea {
  resize: vertical;
  min-height: 100px;
}

.mini-form button {
  background: linear-gradient(135deg, var(--section-color-1), var(--section-color-2));
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.mini-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* === Blog Content === */
.blog-content {
  padding: 20px 0;
}

.blog-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.3;
}

.blog-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* === Category Badge === */
.category-badge {
  display: inline-block;
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--section-color-1), var(--section-color-2));
  color: white;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* === Tags === */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  padding: 6px 12px;
  background: rgba(67, 233, 123, 0.15);
  color: #38f9d7;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(67, 233, 123, 0.3);
}

/* === View Link === */
.view-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--section-color-1);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s ease;
  padding: 8px 0;
}

.view-link:hover {
  gap: 10px;
  color: var(--section-color-2);
}

/* === No Content === */
.no-content {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

/* === Flash Messages (adapted) === */
.flash {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 14px;
  animation: slideInRight 0.4s ease;
}

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

.flash.success {
  background: rgba(67, 233, 123, 0.15);
  color: #38f9d7;
  border: 2px solid rgba(67, 233, 123, 0.3);
}

.flash.error {
  background: rgba(244, 33, 46, 0.15);
  color: var(--error-color);
  border: 2px solid rgba(244, 33, 46, 0.3);
}

/* === Footer Override === */
.footer {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

/* === Responsive === */
@media (max-width: 1024px) {
  .sections-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .hero-title {
    font-size: 42px;
  }
  
  .hero-subtitle {
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  .sections-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .hero-section {
    padding: 60px 0 40px 0;
  }
  
  .hero-title {
    font-size: 36px;
  }
  
  .hero-subtitle {
    font-size: 18px;
  }
  
  .section-card {
    padding: 24px;
  }
  
  .section-icon {
    font-size: 40px;
  }
  
  .section-title {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 28px;
    letter-spacing: -1px;
  }
  
  .hero-subtitle {
    font-size: 16px;
  }
  
  .section-icon {
    font-size: 36px;
  }
  
  .question-box-home .question {
    font-size: 18px;
  }
}

/* === Animazioni speciali al caricamento === */
.section-card:nth-child(1) {
  animation: slideInUp 0.6s ease 0.1s both;
}

.section-card:nth-child(2) {
  animation: slideInUp 0.6s ease 0.2s both;
}

.section-card:nth-child(3) {
  animation: slideInUp 0.6s ease 0.3s both;
}

.section-card:nth-child(4) {
  animation: slideInUp 0.6s ease 0.4s both;
}

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