/* ============================================================
   DNSE Market Dashboard - news.css
   Style for Vietcap AI News integrated tab
   ============================================================ */

/* News Panel Layout */
.news-panel {
  height: calc(100vh - var(--header-h) - 40px);
  overflow-y: auto;
  background: var(--bg-primary);
  scrollbar-width: thin;
  padding: 24px;
  box-sizing: border-box;
}

/* Custom Scrollbar for news panel */
.news-panel::-webkit-scrollbar {
  width: 8px;
}
.news-panel::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
.news-panel::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
.news-panel::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.news-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.news-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.news-title {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.news-title-indicator {
  width: 5px;
  height: 24px;
  background: var(--clr-up);
  border-radius: 4px;
}

.news-title i {
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  margin-left: 4px;
  transition: color 0.2s;
}
.news-title i:hover {
  color: var(--text-secondary);
}

/* Tab buttons inside panel */
.news-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border-strong);
  margin-bottom: 24px;
}

.news-tab-btn {
  padding-bottom: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}

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

.news-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Analytics Row */
.news-analytics {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  margin-bottom: 32px;
}

@media (max-width: 992px) {
  .news-analytics {
    grid-template-columns: 1fr;
  }
}

.news-card-sentiment,
.news-card-trending {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.news-analytics-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sentiment bars */
.sentiment-percentages {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.sentiment-bar-track {
  width: 100%;
  height: 8px;
  display: flex;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.sentiment-bar-fill {
  height: 100%;
  transition: width 1s ease;
}

.sentiment-bar-fill.positive {
  background: var(--clr-up);
  box-shadow: 0 0 8px var(--clr-up-bg);
}

.sentiment-bar-fill.neutral {
  background: var(--text-muted);
}

.sentiment-bar-fill.negative {
  background: var(--clr-dn);
  box-shadow: 0 0 8px var(--clr-dn-bg);
}

.sentiment-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 8px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Trending tags */
.trending-tickers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trending-ticker-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.trending-ticker-tag:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.trending-ticker-sym {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.trending-ticker-count {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 10px;
  line-height: 1;
}

/* Search and Filters Row */
.news-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  align-items: center;
  position: relative;
  z-index: 10;
}

.news-search-wrapper {
  position: relative;
  width: 260px;
}

@media (max-width: 576px) {
  .news-search-wrapper,
  .news-filter-dropdown {
    width: 100% !important;
  }
}

.news-search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 14px 10px 36px;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.news-search-input:focus {
  border-color: var(--accent);
}

.news-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.news-search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.news-search-clear:hover {
  color: var(--text-primary);
}

/* Dropdown Filters */
.news-filter-dropdown {
  position: relative;
  width: 220px;
}

.news-dropdown-trigger {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.news-dropdown-trigger:hover,
.news-dropdown-trigger:focus {
  border-color: var(--text-muted);
}

.news-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
}

.news-dropdown-menu.hidden {
  display: none;
}

.news-dropdown-list {
  list-style: none;
  padding: 4px 0;
  margin: 0;
}

.news-dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  font-size: 0.9rem;
}

.news-dropdown-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.news-dropdown-item.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 700;
}

/* Grids and Cards */
.news-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .news-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .news-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
}

/* Card */
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  transition: all 0.2s ease;
}

.news-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.news-card-thumb {
  position: relative;
  height: 160px;
  background: var(--bg-secondary);
  overflow: hidden;
}

.news-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.news-card:hover .news-card-img {
  transform: scale(1.05);
}

.news-card-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.news-card-meta {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 10px;
  gap: 8px;
}

.news-card-meta-dot {
  color: var(--text-muted);
}

.news-card-ticker-link {
  color: var(--text-primary);
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s ease;
}

.news-card-ticker-link:hover {
  color: var(--accent);
}

.news-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s ease;
}

.news-card:hover .news-card-title {
  color: var(--accent);
}

.news-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.news-card-source {
  text-transform: uppercase;
  font-weight: 600;
}

/* Pagination load more */
.news-load-more-container {
  margin-top: 32px;
  text-align: center;
}

.news-load-more-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 32px;
  border-radius: 20px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.news-load-more-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Error banner */
.news-error-banner {
  text-align: center;
  padding: 40px 20px;
  background: rgba(229, 23, 58, 0.05);
  border: 1px solid rgba(229, 23, 58, 0.15);
  border-radius: var(--radius-lg);
  color: var(--clr-dn);
  margin-bottom: 24px;
}

.news-error-banner i {
  font-size: 2rem;
  margin-bottom: 12px;
}

/* Skeleton Loading styles */
.news-shimmer {
  animation: news-shimmer-anim 1.5s infinite linear;
  background: linear-gradient(to right, var(--bg-secondary) 4%, var(--bg-card-hover) 25%, var(--bg-secondary) 36%);
  background-size: 1000px 100%;
}

@keyframes news-shimmer-anim {
  0% { background-position: -500px 0; }
  100% { background-position: 500px 0; }
}

.news-skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 320px;
  display: flex;
  flex-direction: column;
}

.news-skeleton-thumb {
  height: 160px;
}

.news-skeleton-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.news-skeleton-meta {
  width: 40%;
  height: 12px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.news-skeleton-title {
  width: 90%;
  height: 16px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.news-skeleton-title.short {
  width: 60%;
  margin-bottom: 20px;
}

.news-skeleton-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.news-skeleton-source {
  width: 30%;
  height: 10px;
  border-radius: 3px;
}

.news-skeleton-date {
  width: 25%;
  height: 10px;
  border-radius: 3px;
}

/* Loading spinner */
.news-spinner-container {
  text-align: center;
  padding: 40px;
}

.news-spinner {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.news-spinner-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
}
