/* Estilos base para X Optimizer */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  background: #000;
  color: #e0e0e0;
}

/* Cabecera principal */
.main-header {
  background: linear-gradient(180deg, #10213A 0%, #0a1124 100%);
  padding: 30px 20px;
  text-align: center;
  border-bottom: 1px solid #1DA1F2;
}
.main-header h1 {
  margin: 0;
  font-size: 2.2em;
  color: #1DA1F2;
}
.main-header .subtitle {
  margin-top: 8px;
  font-size: 1.1em;
  color: #9bb4db;
}

/* Menú de pestañas */
.tab-menu {
  display: flex;
  justify-content: center;
  background: #111;
  border-bottom: 1px solid #333;
}
.tab-button {
  flex: 1;
  padding: 12px 0;
  border: none;
  background: #111;
  color: #1DA1F2;
  cursor: pointer;
  font-size: 1.05em;
  border-bottom: 3px solid transparent;
  transition: background 0.2s, color 0.2s, border-bottom 0.2s;
}
.tab-button:hover {
  background: #0a0a0a;
  color: #ffffff;
}
.tab-button.active {
  background: #0a0a0a;
  color: #ffffff;
  border-bottom-color: #1DA1F2;
}

/* Contenedor principal */
.container {
  max-width: 900px;
  margin: 20px auto;
  background: #111;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 30px rgba(29,161,242,0.2);
}
h3, h4 { color: #1DA1F2; }
.url-input, textarea, input[type="text"] {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid #264763;
  border-radius: 6px;
  box-sizing: border-box;
  background: #0f1f33;
  color: #e0e0e0;
}
textarea { height: 120px; }
button { background: #1DA1F2; color: white; padding: 12px 24px; border: none; border-radius: 8px; cursor: pointer; display: block; margin: 10px auto 0; font-weight: bold; }
button:hover { opacity: 0.9; }
.auto-button { background: #0d6efd; }
.grok-button { background: #fd7e14; }
.prominent { background: #ff6b00; font-size: 1.2em; padding: 15px 30px; }
#previewContainer {
  margin: 15px 0;
  padding: 15px;
  border: 2px dashed #1DA1F2;
  border-radius: 8px;
  min-height: 250px;
  background: #0f1f33;
  text-align: center;
}
#tweetEmbed { margin: 10px auto; max-width: 600px; width: 100%; }
#previewStatus { font-style: italic; color: #555; margin-bottom: 10px; }
.fallback-link { margin-top: 10px; font-size: 1.1em; color: #1DA1F2; text-decoration: underline; }
.suggestions-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.suggestions-table th, .suggestions-table td {
  border: 1px solid #264763;
  padding: 12px;
  text-align: left;
}
.suggestions-table th {
  background: #0f1f33;
  color: #4ab3ff;
}
.score { font-weight: bold; font-size: 1.2em; }
.score-high { color: #28a745; background: rgba(40,167,69,0.1); padding: 10px; border-radius: 8px; }
.score-medium { color: #ffc107; background: rgba(255,193,7,0.1); padding: 10px; border-radius: 8px; }
.score-low { color: #dc3545; background: rgba(220,53,69,0.1); padding: 10px; border-radius: 8px; }
#grokPromptContainer { margin-top: 20px; padding: 15px; background: #1a1a1a; border: 1px solid #333; border-radius: 8px; }
#grokPromptContainer pre { background: #0a0a0a; padding: 10px; border: 1px solid #333; border-radius: 4px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; color: #e0e0e0; }
.highlight-message { background: #1a3a5a; color: white; padding: 20px; border-radius: 12px; margin: 20px 0; text-align: center; font-size: 1.1em; border: 1px solid #1DA1F2; }
.api-keys {
  background: #0f1f33;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  border: 1px solid #264763;
}

/* Paneles para agrupar secciones */
.panel {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}
.panel h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.25em;
  color: #1DA1F2;
  border-bottom: 1px solid #333;
  padding-bottom: 8px;
}

/* Acciones agrupadas horizontalmente */
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}


@media (max-width: 600px) { #tweetEmbed { max-width: 100%; } }

/* ────────────────────────────── Anuncios ────────────────────────────── */
/* Popup de publicidad que cubre toda la pantalla */
.ad-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

/* Contenedor interno del popup */
.ad-content {
  position: relative;
  background: #111;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 20px;
  max-width: 500px;
  max-height: 80vh;
  overflow: auto;
  text-align: center;
}

/* Imagen dentro del anuncio */
.ad-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 15px;
}

/* Botón de cierre del anuncio */
.ad-close {
  /* El botón X del popup se posiciona de forma fija para garantizar visibilidad */
  /* Posicionamos el botón X en la esquina superior derecha del contenedor del popup */
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 28px;
  color: #ffffff;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1;
}
.ad-close:hover {
  color: #aaa;
}

/* ────────────────────────────── Login y tagline ────────────────────────────── */
/* Se eliminó la clase .tagline porque el subtítulo ahora está en la cabecera */

.login-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 15px 0;
}

.google-login-button {
  background: #4285f4;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.google-login-button:hover {
  opacity: 0.9;
}

/* Información de usuario oculta por defecto; se muestra tras iniciar sesión */
.user-info {
  display: none;
  color: #e0e0e0;
}
.user-info button {
  background: #dc3545;
  color: white;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  margin-left: 10px;
}
.user-info button:hover {
  opacity: 0.9;
}

/* ────────────────────────────── Anuncio de pie de página ────────────────────────────── */
.footer-ad {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #111;
  border-top: 1px solid #333;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  padding: 8px 16px;
  z-index: 9999;
}

/* En la versión final, el anuncio de pie de página es un bloque AdSense; no definimos estilos específicos para imágenes */

.footer-ad-close {
  background: transparent;
  border: none;
  color: #eee;
  font-size: 28px;
  cursor: pointer;
  color: #ffffff;
}
.footer-ad-close:hover {
  color: #aaa;
}
/* Botón para suscribirse y eliminar anuncios */
.sub-button {
  background: #28a745;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}
.sub-button:hover { opacity: 0.9; }
.hidden { display: none !important; }

/* Botón para cerrar el popup sin suscribirse */
.close-button {
  background: #dc3545;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  margin: 10px 0;
}
.close-button:hover {
  opacity: 0.9;
}

/* Contenedor del bloque del anuncio dentro del popup */
.ad-body {
  margin: 10px 0;
}

/* Acciones dentro del popup de anuncio */
.ad-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

/* Contenedor para gráfico de donut */
.chart-container {
  max-width: 400px;
  margin: 20px auto;
}