/* ========================================
   FEED STYLES
   Estilos específicos para posts, compose box y user cards
   ======================================== */

/* ========================================
   COMPOSE BOX (Crear Post)
   ======================================== */

.compose-box {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-sm);
}

.compose-box textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.compose-box textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.compose-box-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.char-counter {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.char-counter.warning {
  color: var(--warning);
}

.char-counter.error {
  color: var(--error);
  font-weight: 700;
}

.compose-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.compose-url {
  width: 100%;
  margin-top: var(--space-md);
}

/* ========================================
   POST CARD
   ======================================== */

.post-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.post-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.post-author {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.post-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.post-author-info {
  display: flex;
  flex-direction: column;
}

.post-author-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.2;
}

.post-author-nick {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.2;
}

.post-time {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.2;
}

.post-content {
  margin-bottom: var(--space-sm);
  transition: background-color var(--transition-fast);
  padding: var(--space-sm);
  margin: calc(var(--space-sm) * -1);
  margin-bottom: var(--space-sm);
  border-radius: var(--radius-sm);
}

.post-content:hover {
  background-color: var(--bg-secondary);
}

.post-text {
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-primary);
  word-wrap: break-word;
  white-space: pre-wrap; /* Preserva saltos de línea y espacios */
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  margin-top: var(--space-sm);
}

.post-link {
  display: block;
  padding: var(--space-sm);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: var(--space-sm);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
  color: inherit;
}

.post-link:hover {
  background-color: #E8F5FE;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(29, 161, 242, 0.1);
}

.post-link-preview {
  display: flex;
  gap: var(--space-md);
}

.post-link-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background-color: var(--border);
  flex-shrink: 0;
}

.post-link-content {
  flex: 1;
  min-width: 0;
}

.post-link-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.post-link-description {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.post-link-domain {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-xs);
  color: var(--primary);
  font-weight: 500;
}

.post-link-icon {
  font-size: 14px;
}

.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-sm);
  margin-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

.post-actions {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.post-action {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.post-action:hover {
  background-color: var(--bg-secondary);
  color: var(--primary);
}

.post-action.share {
  color: var(--text-secondary);
  padding: var(--space-xs);
  min-width: auto;
}

.post-action.share:hover {
  background-color: #E8F5FE;
  color: var(--primary);
}

.post-header-right .post-action.share {
  padding: 4px 8px;
  font-size: 16px;
}

.post-action.edit {
  color: var(--primary);
}

.post-action.edit:hover {
  background-color: #E8F5FE;
  color: var(--primary);
}

.post-action.delete {
  color: var(--error);
}

.post-action.delete:hover {
  background-color: #FEE;
  color: var(--error);
}

/* ========================================
   USER CARD (Feed)
   ======================================== */

.user-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-fast);
}

.user-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.user-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.user-card-info {
  flex: 1;
}

.user-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.2;
}

.user-card-nick {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  line-height: 1.2;
}

.user-card-description {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 0;
  line-height: 1.3;
}

.user-card-location {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.user-card-stats {
  display: flex;
  gap: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.user-card-stat {
  display: flex;
  flex-direction: column;
}

.user-card-stat-value {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.user-card-stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* ========================================
   FEED LAYOUT
   ======================================== */

.feed-container {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

.feed-header {
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.feed-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.feed-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.feed-filter {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-sm);
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.feed-filter:hover {
  background-color: var(--primary);
  color: white;
}

.feed-filter.active {
  background-color: var(--primary);
  color: white;
  font-weight: 600;
}

.feed-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
}

.feed-empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.feed-empty-text {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-sm);
}

/* ========================================
   FLOATING ACTION BUTTON
   ======================================== */

.fab {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all var(--transition-base);
  z-index: 50;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 24px rgba(29, 161, 242, 0.4);
}

.fab:active {
  transform: scale(0.95);
}

/* ========================================
   MODAL PARA COMPOSE
   ======================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
}

.modal {
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
}

/* ========================================
   TABS
   ======================================== */

.tabs {
  display: flex;
  gap: var(--space-md);
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-xl);
}

.tab {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: -2px;
}

.tab:hover {
  color: var(--primary);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* ========================================
   BOTÓN CARGAR MÁS
   ======================================== */

.load-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md);
  margin-top: var(--space-lg);
  background-color: var(--bg-primary);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: var(--radius-full);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.load-more-btn:hover:not(:disabled) {
  background-color: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.load-more-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.load-more-btn span:first-child {
  font-size: 20px;
  line-height: 1;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .feed-container {
    padding: var(--space-md) var(--space-sm);
  }

  .post-card,
  .user-card,
  .compose-box {
    padding: var(--space-md);
  }

  .post-actions {
    gap: var(--space-sm);
  }

  .fab {
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 56px;
    height: 56px;
  }

  .modal {
    margin: 0;
    border-radius: 0;
    max-height: 100vh;
  }
}

@media (max-width: 480px) {
  .post-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .user-card-stats {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .post-time {
    font-size: var(--font-size-xs);
  }
}
