/* ==================== TATIN BASE CSS - ESTILO RETRO 2006-2012 ==================== */

:root {
  /* Colores principales */
  --tatin-blue: #2196F3;
  --tatin-blue-light: #64B5F6;
  --tatin-blue-dark: #1976D2;
  --tatin-orange: #FF9800;
  --tatin-green: #4CAF50;
  --tatin-purple: #9C27B0;
  --tatin-gold: #FFC107;
  
  /* Colores de texto */
  --text-primary: #2C3E50;
  --text-secondary: #7F8C8D;
  --text-white: #FFFFFF;
  
  /* Fondos */
  --bg-primary: #FFF9C4;
  --bg-secondary: #FFF59D;
  --bg-tertiary: #FFF176;
  --bg-panel: rgba(255, 255, 255, 0.95);
  --bg-panel-hover: rgba(255, 255, 255, 1);
  
  /* Efectos */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.25);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --transition: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== RESET & BASE ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  color: var(--text-primary);
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
  
  /* Fondo amarillo base */
  background: linear-gradient(180deg,
    var(--bg-primary) 0%,
    var(--bg-secondary) 50%,
    var(--bg-tertiary) 100%);
  background-attachment: fixed;
}

/* ==================== CONTENEDOR PRINCIPAL ==================== */
.tatin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 2;
}

/* ==================== HERO SECTION ==================== */
.hero-section {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(245, 248, 255, 0.9) 100%);
  border-radius: var(--radius-xl);
  padding: 40px;
  margin-bottom: 30px;
  text-align: center;
  
  border: 1px solid rgba(200, 220, 255, 0.8);
  box-shadow: 
    var(--shadow-lg),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  color: var(--tatin-blue-dark);
  margin-bottom: 15px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
  font-size: 1.3rem;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}

.stat-box {
  text-align: center;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--tatin-blue);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

/* ==================== SECCIONES ==================== */
.posts-section,
.categories-section,
.tops-section,
.communities-section,
.chat-section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.section-link {
  color: var(--tatin-blue);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition-fast);
}

.section-link:hover {
  color: var(--tatin-blue-dark);
  text-decoration: underline;
}

/* ==================== POSTS GRID ==================== */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.post-card {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(245, 248, 255, 0.9) 100%);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid rgba(200, 220, 255, 0.8);
  
  box-shadow: 
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  pointer-events: none;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 
    var(--shadow-lg),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 20px rgba(33, 150, 243, 0.3);
}

.post-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.post-category {
  display: inline-block;
  background: var(--tatin-blue);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.post-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 15px;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

.post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
}

.post-author {
  font-weight: 600;
  color: var(--tatin-blue);
}

.post-points {
  color: var(--tatin-orange);
  font-weight: 700;
}

/* ==================== CATEGORÍAS GRID ==================== */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
}

.category-card {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(245, 248, 255, 0.9) 100%);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  text-decoration: none;
  
  border: 1px solid rgba(200, 220, 255, 0.8);
  box-shadow: 
    var(--shadow-sm),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.5) 0%,
    transparent 100%);
  pointer-events: none;
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: 
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 15px rgba(33, 150, 243, 0.2);
}

.category-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.category-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.category-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ==================== TOPS ==================== */
.tops-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.top-card {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(245, 248, 255, 0.9) 100%);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  
  border: 1px solid rgba(200, 220, 255, 0.8);
  box-shadow: 
    var(--shadow-sm),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.top-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.5) 0%,
    transparent 100%);
  pointer-events: none;
}

.top-card:hover {
  transform: translateX(5px);
  box-shadow: 
    var(--shadow-md),
    0 0 20px rgba(33, 150, 243, 0.2);
}

.top-medal {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.top-info {
  flex: 1;
}

.top-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.top-meta {
  display: flex;
  gap: 15px;
  font-size: 0.9rem;
}

.top-author {
  color: var(--tatin-blue);
  font-weight: 600;
}

.top-points {
  color: var(--tatin-orange);
  font-weight: 700;
}

/* ==================== COMUNIDADES ==================== */
.communities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.community-card {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(245, 248, 255, 0.9) 100%);
  border-radius: var(--radius-md);
  padding: 25px;
  text-align: center;
  
  border: 1px solid rgba(200, 220, 255, 0.8);
  box-shadow: 
    var(--shadow-sm),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.community-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.5) 0%,
    transparent 100%);
  pointer-events: none;
}

.community-card:hover {
  transform: translateY(-5px);
  box-shadow: 
    var(--shadow-md),
    0 0 20px rgba(33, 150, 243, 0.2);
}

.community-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.community-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.community-members {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ==================== CHAT/FORO EN VIVO ==================== */
.chat-section {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(245, 248, 255, 0.9) 100%);
  border-radius: var(--radius-lg);
  padding: 25px;
  
  border: 1px solid rgba(200, 220, 255, 0.8);
  box-shadow: 
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  
  position: relative;
  overflow: hidden;
}

.chat-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.5) 0%,
    transparent 100%);
  pointer-events: none;
}

.btn-chat-expand {
  background: linear-gradient(180deg, #FFD54F 0%, #FFC107 100%);
  border: 1px solid rgba(255, 193, 7, 0.8);
  color: #5D4037;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  
  box-shadow: 
    var(--shadow-sm),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  
  transition: var(--transition);
}

.btn-chat-expand:hover {
  background: linear-gradient(180deg, #FFECB3 0%, #FFD54F 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.mensajes-container {
  max-height: 400px;
  overflow-y: auto;
  margin: 20px 0;
  padding: 15px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  border: 1px solid rgba(200, 220, 255, 0.5);
}

.formulario-chat {
  position: relative;
  z-index: 1;
}

.chat-input-container {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chat-nombre-input,
.chat-mensaje-input {
  flex: 1;
  min-width: 150px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(150, 180, 220, 0.6);
  
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(248, 250, 255, 0.95) 100%);
  
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.8);
  
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-primary);
  transition: var(--transition-fast);
}

.chat-nombre-input {
  max-width: 200px;
}

.chat-mensaje-input {
  resize: vertical;
  min-height: 48px;
}

.chat-nombre-input:focus,
.chat-mensaje-input:focus {
  outline: none;
  border-color: var(--tatin-blue);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.1),
    0 0 0 3px rgba(33, 150, 243, 0.2);
}

.btn-chat-enviar {
  background: linear-gradient(180deg, #FFD54F 0%, #FFC107 100%);
  border: 1px solid rgba(255, 193, 7, 0.8);
  color: #5D4037;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  
  box-shadow: 
    var(--shadow-sm),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  
  transition: var(--transition);
}

.btn-chat-enviar:hover {
  background: linear-gradient(180deg, #FFECB3 0%, #FFD54F 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==================== FOOTER ==================== */
.site-footer {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(245, 248, 255, 0.9) 50%,
    rgba(235, 242, 255, 0.95) 100%);
  
  padding: 40px 20px 20px;
  margin-top: 60px;
  border-top: 1px solid rgba(200, 220, 255, 0.8);
  
  box-shadow: 
    0 -4px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  
  position: relative;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.5) 0%,
    transparent 100%);
  pointer-events: none;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto 30px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  position: relative;
  z-index: 1;
}

.footer-section h3,
.footer-section h4 {
  color: var(--tatin-blue-dark);
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.footer-section p,
.footer-section a {
  color: var(--text-secondary);
  text-decoration: none;
  display: block;
  margin-bottom: 8px;
  transition: var(--transition-fast);
}

.footer-section a:hover {
  color: var(--tatin-blue);
  transform: translateX(3px);
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid rgba(200, 220, 255, 0.5);
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
}

/* ==================== ESTADOS ==================== */
.loading,
.loading-posts {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.loading::after,
.loading-posts::after {
  content: '...';
  animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .tatin-container {
    padding: 15px;
  }
  
  .hero-section {
    padding: 30px 20px;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
  }
  
  .hero-stats {
    gap: 20px;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .posts-grid,
  .categories-grid,
  .communities-grid {
    grid-template-columns: 1fr;
  }
  
  .chat-input-container {
    flex-direction: column;
    align-items: stretch;
  }
  
  .chat-nombre-input {
    max-width: 100%;
  }
  
  .btn-chat-enviar {
    width: 100%;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.8rem;
  }
  
  .section-title {
    font-size: 1.3rem;
  }
  
  .top-card {
    flex-direction: column;
    text-align: center;
  }
}

/* ==================== UTILIDADES ==================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

/* ==================== FIN ==================== */