/* ============================================
   COMMUNITY SYSTEM - Estilos para feed, watchlist, listas
   Sistema de usuarios/comentarios/watchlist compartido
   Theme: dooplay (azul #408bea)
   ============================================ */

/* ============ VARIABLES DEL THEME ============ */
:root {
  --primary: #408bea;
  --primary-hover: #5a9fef;
  --text: #e5e5e5;
  --tertiary: #999;
  --gray: #111111;
  --gray-light: #222222;
  --border-c: #222222;
  --danger: #f87171;
  --warning: #fbbf24;
  --body: #000000;
}

/* ============ WATCHLIST / CUSTOM LIST DROPDOWNS ============ */
.watchlist-dropdown {
  position: fixed;
  z-index: 9999;
  background: var(--gray);
  border: 1px solid var(--border-c);
  border-radius: 0.5rem;
  min-width: 180px;
  overflow: visible;
  box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}
.watchlist-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.15s;
}
.watchlist-dropdown button:hover {
  background: rgba(64,139,234,0.15);
  color: var(--primary);
}
.watchlist-dropdown .watchlist-remove {
  border-top: 1px solid var(--border-c);
  color: #f87171;
}
.watchlist-dropdown .watchlist-remove:hover {
  background: rgba(220,53,69,0.15);
  color: #f87171;
}
.customlist-options {
  display: flex;
  flex-direction: column;
  max-height: 260px;
  overflow-y: auto;
}
.customlist-option {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.15s;
}
.customlist-option:hover { background: rgba(64,139,234,0.15); color: var(--primary); }
.customlist-option:disabled { color: #4ade80; cursor: default; }
.customlist-option span { color: var(--tertiary); font-size: 0.72rem; }
.customlist-loading, .customlist-empty { padding: 0.75rem 1rem; color: var(--tertiary); font-size: 0.78rem; margin: 0; }

/* ============ FEED (comentarios/opiniones) ============ */
.feed-post {
  background: var(--gray);
  border: 1px solid var(--border-c);
  border-radius: 0.75rem;
  padding: 1rem;
}
.feed-post-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  color: var(--tertiary);
}
.feed-post-author {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.feed-post-author:hover { color: var(--primary); }
.feed-post-avatar, .feed-reply-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}
.feed-post-rating { color: #fbbf24; font-size: 0.75rem; }
.feed-post-date { color: var(--tertiary); font-size: 0.72rem; margin-left: auto; }
.feed-post-body { color: var(--text); font-size: 0.85rem; line-height: 1.5; margin: 0.4rem 0; }
.feed-post-footer { display: flex; gap: 0.5rem; align-items: center; }
.feed-action-btn {
  background: none;
  border: none;
  color: var(--tertiary);
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: 0.2s;
  padding: 0.2rem 0.5rem;
  border-radius: 0.3rem;
}
.feed-action-btn:hover { color: var(--primary); background: rgba(64,139,234,0.1); }
.feed-action-btn.liked { color: #f87171; }
.feed-post-target { color: var(--primary); text-decoration: none; }
.feed-post-target:hover { text-decoration: underline; }

.feed-replies { margin-top: 0.75rem; padding-left: 1rem; border-left: 2px solid var(--border-c); }
.feed-reply {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text);
  padding: 0.35rem 0;
  flex-wrap: wrap;
}
.feed-reply-author { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; color: var(--text); text-decoration: none; }
.feed-reply-author:hover { color: var(--primary); }
.feed-reply-date { color: var(--tertiary); font-size: 0.68rem; }
.feed-reply-actions { display: flex; align-items: center; gap: 0.2rem; margin-left: auto; }
.feed-reply-actions .feed-action-btn { font-size: 0.68rem; padding: 0.1rem 0.3rem; }
.feed-reply-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.feed-reply-input {
  flex: 1;
  background: var(--gray);
  border: 1px solid var(--border-c);
  color: var(--text);
  padding: 0.4rem 0.75rem;
  border-radius: 1.5rem;
  font-size: 0.78rem;
}
.feed-reply-input:focus { outline: none; border-color: var(--primary); }
.feed-reply-submit {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: 1.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.feed-reply-submit:hover { background: var(--primary-hover); }
.feed-error, .feed-empty, .feed-loading { color: var(--tertiary); font-size: 0.85rem; }

/* ============ PERFIL: tabs y layout ============ */
.wtab-btn { opacity: 0.6; cursor: pointer; border: none; transition: 0.2s; }
.wtab-btn.active { opacity: 1; box-shadow: 0 0 0 2px var(--primary) inset; }

.d-none { display: none !important; }

/* ============ FORMULARIOS DE AUTH ============ */
.auth-input,
.auth-select {
  display: block;
  box-sizing: border-box;
  width: 100% !important;
  max-width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.4rem;
  background-color: #333;
  border: 1px solid var(--border-c);
  color: #fff !important;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: border-color 0.2s;
}
.auth-input::placeholder { color: var(--tertiary); }
.auth-input:focus,
.auth-select:focus {
  outline: none;
  border-color: var(--primary);
}
.auth-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}
.auth-select option {
  background-color: #333;
  color: #fff;
}
.auth-select option:checked,
.auth-select option:hover {
  background-color: var(--primary);
  color: #ffffff;
}

/* ============ COMUNIDAD: rankings ============ */
.community-rankings-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px) {
  .community-rankings-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .community-rankings-grid { grid-template-columns: 1fr; }
}
.rank-card {
  background: var(--gray);
  border: 1px solid var(--border-c);
  border-radius: 0.5rem;
  padding: 1rem;
}
.rank-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.8rem;
}
.rank-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.8rem;
}
.rank-num { color: var(--primary); font-weight: 700; min-width: 18px; }
.rank-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.rank-name {
  color: var(--text);
  text-decoration: none;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-name:hover { color: var(--primary); }
.rank-val { color: var(--primary); font-weight: 600; }
.rank-empty { color: var(--tertiary); font-size: 0.8rem; }

/* ============ COMUNIDAD: sort y feed ============ */
.community-sort {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.sort-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--gray);
  color: var(--tertiary);
  border: 1px solid var(--border-c);
  transition: 0.2s;
  cursor: pointer;
}
.sort-link:hover { background: rgba(64,139,234,0.15); color: var(--primary); }
.sort-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.feed-box {
  background: var(--gray);
  border: 1px solid var(--border-c);
  border-radius: 0.5rem;
  padding: 1.5rem;
  width: 100%;
  box-sizing: border-box;
}
.feed-box h2, .feed-box h3 {
  color: var(--text);
  font-size: 1.25rem;
  margin: 0 0 1rem;
  font-weight: 700;
}
.feed-box .feed-item {
  border-bottom: 1px solid var(--border-c);
  padding: 1rem 0;
}
.feed-box .feed-item:last-child { border-bottom: none; }


/* ============ PERFIL: header y secciones ============ */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  background: var(--gray);
  border: 1px solid var(--border-c);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-sizing: border-box;
}
@media (min-width: 640px) {
  .profile-header { flex-direction: row; text-align: left; }
}
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar-img {
  width: 80px !important;
  height: 80px !important;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  display: block;
}
.profile-info { flex: 1; }
.profile-info h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); margin: 0 0 0.3rem; }
.profile-meta { font-size: 0.85rem; color: var(--tertiary); margin-top: 0.3rem; }
.profile-stats { text-align: center; flex-shrink: 0; }
.profile-stats .stat-num { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.profile-stats .stat-label { font-size: 0.7rem; color: var(--tertiary); }

.section-card {
  background: var(--gray);
  border: 1px solid var(--border-c);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-sizing: border-box;
  width: 100%;
}
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1rem;
}
.wtab-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.wtab-btn {
  background: var(--gray-light);
  color: var(--tertiary);
  border: none;
  border-radius: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.wtab-btn.active { background: var(--primary); color: #fff; }
.empty-msg { color: var(--tertiary); font-size: 0.85rem; }

/* Avatar de listas */
.list-owner-img {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  display: block;
}

/* ============ LISTA (list-detail) ============ */
.list-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  background: var(--gray);
  border: 1px solid var(--border-c);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.list-owner { display: flex; align-items: center; gap: 0.6rem; }
.list-owner-name { color: var(--text); font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.list-owner-name:hover { color: var(--primary); }
.list-title { font-size: 1.5rem; font-weight: 700; color: var(--text); margin: 0.3rem 0 0; }
.list-desc { font-size: 0.85rem; color: var(--tertiary); margin: 0 0 0.3rem; }
.list-meta {
  font-size: 0.8rem;
  color: var(--tertiary);
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}
.list-badge {
  font-size: 0.7rem;
  background: var(--gray-light);
  color: var(--tertiary);
  padding: 0.2rem 0.6rem;
  border-radius: 0.3rem;
}
.list-item-remove { z-index: 5; }


/* Grids del perfil y listas */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
@media (min-width: 640px) { .profile-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) { .profile-grid { grid-template-columns: repeat(6, 1fr); } }
.profile-grid .wl-item { text-align: center; }
.profile-grid .wl-item img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  object-position: center top;
  border-radius: 0.4rem;
  display: block;
}
@media (min-width: 640px) { .profile-grid .wl-item img { height: 180px; } }
@media (min-width: 768px) { .profile-grid .wl-item img { height: 200px; } }
.profile-grid .wl-item span {
  display: block;
  font-size: 0.75rem;
  margin-top: 0.3rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lists-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 640px) { .lists-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px) { .lists-grid { grid-template-columns: repeat(3, 1fr); } }
.list-card { background: var(--gray-light); border-radius: 0.4rem; padding: 1rem; box-sizing: border-box; }
.list-card h3 { margin: 0 0 0.3rem; font-size: 0.9rem; }
.list-card h3 a { color: var(--text); text-decoration: none; }
.list-card h3 a:hover { color: var(--primary); }
.list-card .list-meta { font-size: 0.75rem; color: var(--tertiary); }

.items-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
@media (min-width: 640px) { .items-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) { .items-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1024px) { .items-grid { grid-template-columns: repeat(6, 1fr); } }
.items-grid .list-item {
  background: var(--gray);
  border: 1px solid var(--border-c);
  border-radius: 0.4rem;
  overflow: hidden;
  position: relative;
}
.items-grid .list-item img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  object-position: center top;
  display: block;
}
@media (min-width: 640px) { .items-grid .list-item img { height: 180px; } }
@media (min-width: 768px) { .items-grid .list-item img { height: 200px; } }
.items-grid .list-item .item-title {
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge "NUEVO" */
.new-feature-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--danger);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 10px;
  line-height: 1.2;
  box-shadow: 0 0 0 2px var(--body);
  animation: new-badge-pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes new-badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.feed-empty-small, .feed-loading-small { color: var(--tertiary); font-size: 0.72rem; margin: 0; }
