/* Voz / XenForo Style Sheet for News Aggregator */
:root {
  --font-sans: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  
  /* Light Theme variables (Voz Light Style) */
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f2f5;
  --text-primary: #141414;
  --text-secondary: #5e6b77;
  --text-muted: #8c96a0;
  --border-color: #dcdcdc;
  
  /* Link and Brand Colors */
  --link-color: #1858ad; /* XenForo classic blue */
  --link-hover: #e06000; /* Voz orange hover */
  
  --primary: #1858ad;
  --primary-hover: #14498f;
  --primary-glow: rgba(24, 88, 173, 0.1);
  
  --accent-voz: #e67e22; /* Signature Voz Orange */
  --accent-genk: #dc2626; /* Red */
  --accent-tinhte: #0088cc; /* Cyan/Blue */
  
  --block-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  --modal-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  --border-radius: 4px; /* XenForo uses small radius */
  --transition-fast: all 0.15s ease-in-out;
}

/* Dark Theme overrides (Voz Dark Style) */
body.dark-theme {
  --bg-primary: #121212;
  --bg-secondary: #1d1d22;
  --bg-tertiary: #2a2a30;
  --text-primary: #e3e3e7;
  --text-secondary: #a5b1c2;
  --text-muted: #6b778d;
  --border-color: #2c2c35;
  
  --link-color: rgb(100, 148, 211); /* Voz Dark Link color */
  --link-hover: #f97316; /* Orange hover */
  
  --primary: rgb(100, 148, 211);
  --primary-hover: #4f87cf;
  --primary-glow: rgba(100, 148, 211, 0.15);
  
  --block-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  --modal-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color 0.2s, color 0.2s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* App Header (Voz Style Navbar) */
.app-header {
  background-color: #141414; /* Dark navbar for both modes */
  color: #f5f5f5;
  border-top: 3px solid var(--accent-voz); /* Signature Voz Top Line */
  border-bottom: 1px solid #000;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 50px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-voz);
}

.logo-area h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.actions-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Navigation & Filter Tabs (XenForo TabBar Style) */
.filter-section {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-bottom: 2px solid var(--primary); /* XenForo tab base line */
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  margin-top: 1.5rem;
  box-shadow: var(--block-shadow);
}

.source-filters {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}

.source-filters::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.source-filters .filter-chip {
  background: none;
  border: none;
  border-radius: 0;
  color: var(--text-secondary);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: var(--transition-fast);
}

.source-filters .filter-chip:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.source-filters .filter-chip.active {
  background-color: var(--bg-secondary);
  color: var(--primary);
  box-shadow: none;
}

/* Active tab top/side borders like XenForo */
.source-filters .filter-chip.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--bg-secondary); /* Cover the bottom primary border */
  z-index: 2;
}

/* Sub filter bar (XenForo sub-navigation) */
.sub-filters {
  display: flex;
  gap: 0.5rem;
  background-color: var(--bg-tertiary);
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border-color);
  animation: fadeIn 0.15s ease-out;
  overflow-x: auto;
}

.filter-chip.sub-chip {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 3px;
  cursor: pointer;
}

.filter-chip.sub-chip:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.filter-chip.sub-chip.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Main Container */
.app-main {
  flex: 1;
  padding-bottom: 3rem;
}

/* XenForo StructItem Container (List Block) */
.structItemContainer {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: var(--block-shadow);
}

/* XenForo Row Item (`.structItem`) */
.structItem {
  display: flex;
  align-items: center;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-fast);
  cursor: pointer;
}

.structItem:last-child {
  border-bottom: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.structItem:hover {
  background-color: var(--bg-tertiary);
}

/* StructItem Cells */
.structItem-cell {
  display: flex;
  align-items: center;
}

/* Left Icon/Avatar Column */
.structItem-cell--icon {
  width: 48px;
  min-width: 48px;
  justify-content: center;
  margin-right: 0.75rem;
}

/* For Genk and Tinhte, make the icon cell wider to hold a larger thumbnail */
.structItem.source-genk .structItem-cell--icon,
.structItem.source-tinhte .structItem-cell--icon {
  width: 170px;
  min-width: 170px;
}

.structItem-icon {
  width: 36px;
  height: 36px;
  border-radius: 4px; /* Forum style uses rounded squares */
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #ffffff;
  overflow: hidden;
  background-color: var(--border-color);
}

/* Make Genk and Tinhte thumbnails larger */
.structItem.source-genk .structItem-icon,
.structItem.source-tinhte .structItem-icon {
  width: 160px;
  height: 100px;
  border-radius: 6px;
}

.structItem-icon--voz { background-color: var(--accent-voz); }
.structItem-icon--genk { background-color: var(--accent-genk); }
.structItem-icon--tinhte { background-color: var(--accent-tinhte); }

.structItem-icon--thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Main content column */
.structItem-cell--main {
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0; /* Enable text truncation */
  gap: 0.15rem;
}

.structItem-title {
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
}

.structItem-title-link {
  color: var(--link-color);
  text-decoration: none;
  cursor: pointer;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.structItem:hover .structItem-title-link {
  color: var(--link-hover);
  text-decoration: underline;
}

/* Minor details row */
.structItem-minor {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--text-secondary);
}

.structItem-minor .badge {
  font-size: 12px;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
  color: #ffffff;
}

.badge-voz { background-color: var(--accent-voz); }
.badge-genk { background-color: var(--accent-genk); }
.badge-tinhte { background-color: var(--accent-tinhte); }

.structItem-category {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0 0.35rem;
  font-size: 0.7rem;
  border-radius: 3px;
  font-weight: 600;
}

.structItem-time {
  color: var(--text-muted);
}

/* Action indicator column (right) */
.structItem-cell--action {
  width: 40px;
  min-width: 40px;
  justify-content: flex-end;
  color: var(--text-muted);
}

.action-icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
  transition: var(--transition-fast);
}

.structItem:hover .action-icon {
  opacity: 1;
  color: var(--primary);
  transform: scale(1.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

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

.btn-secondary {
  background-color: #222;
  border-color: #333;
  color: #e3e3e7;
}

.btn-secondary:hover {
  background-color: #333;
}

/* Theme Toggle */
.theme-toggle-btn {
  background: none;
  border: 1px solid #333;
  color: #e3e3e7;
  padding: 0.35rem;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.theme-toggle-btn:hover {
  background-color: #222;
}

.icon {
  width: 14px;
  height: 14px;
}

body.dark-theme .sun-icon { display: block; }
body.dark-theme .moon-icon { display: none; }
body.light-theme .sun-icon { display: none; }
body.light-theme .moon-icon { display: block; }

/* Loading & Spinner */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
  gap: 0.75rem;
  color: var(--text-secondary);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Error Container */
.error-container {
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.error-icon {
  width: 40px;
  height: 40px;
  color: var(--accent-genk);
}

/* Load More */
.load-more-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

/* Modal Overlay (Voz Style Overlay) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease-out;
}

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--accent-voz); /* Orange top border for Modal */
  border-radius: var(--border-radius);
  box-shadow: var(--modal-shadow);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
}

.modal-source-badge {
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 3px;
  transition: var(--transition-fast);
}

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

.modal-close-btn svg {
  width: 18px;
  height: 18px;
}

.modal-body-wrapper {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

#modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.modal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.origin-link {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.origin-link:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

.modal-divider {
  border: 0;
  height: 1px;
  background-color: var(--border-color);
  margin-bottom: 1.25rem;
}

/* XenForo bbWrapper Styling (Voz Article Content) */
.bbWrapper {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.bbWrapper p {
  margin-bottom: 1rem;
}

.bbWrapper a {
  color: var(--link-color);
  text-decoration: none;
}

.bbWrapper a:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

/* Blockquotes inside Voz articles */
.bbWrapper blockquote {
  background-color: var(--bg-tertiary);
  border-left: 3px solid var(--accent-voz);
  padding: 0.5rem 0.75rem;
  margin: 1rem 0;
  border-radius: 0 4px 4px 0;
  font-style: italic;
  font-size: 0.9rem;
}

.bbWrapper blockquote .bbCodeBlock-title {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
  text-transform: uppercase;
}

.bbWrapper img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0.75rem 0;
}

/* Footer */
.app-footer {
  background-color: #141414;
  border-top: 1px solid #000;
  padding: 1rem 0;
  text-align: center;
  font-size: 0.8rem;
  color: #8c96a0;
  margin-top: auto;
}

/* Hidden Class */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(15px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Responsive queries */
@media (max-width: 768px) {
  .structItem {
    padding: 0.6rem 0.75rem;
  }
  
  .structItem-cell--icon {
    width: 40px;
    min-width: 40px;
    margin-right: 0.5rem;
  }
  
  .structItem-icon {
    width: 32px;
    height: 32px;
  }

  /* Keep Genk and Tinhte thumbnails larger on mobile */
  .structItem.source-genk .structItem-cell--icon,
  .structItem.source-tinhte .structItem-cell--icon {
    width: 120px;
    min-width: 120px;
  }

  .structItem.source-genk .structItem-icon,
  .structItem.source-tinhte .structItem-icon {
    width: 110px;
    height: 70px;
    border-radius: 4px;
  }
  
  .structItem-cell--action {
    display: none; /* Hide action icon on mobile to save space */
  }

  .header-container {
    height: auto;
    padding: 0.5rem 0;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  
  .actions-area {
    align-self: stretch;
    justify-content: space-between;
  }
}
