/* --- Top App Bar --- */
md-top-app-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 56px;
  border-radius: 0;
  box-shadow: none;
  transition: background-color 200ms ease, box-shadow 200ms ease;
  display: flex;
  align-items: center;
  padding-left: 4px;
  padding-right: 4px;
  backdrop-filter: none !important;
}

md-top-app-bar.scrolled {
  background-color: var(--md-sys-color-surface-container, #f5f5f5);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

md-top-app-bar [slot="headline"] {
  color: var(--md-sys-color-on-surface, #000000);
  font-size: 20px;
  font-weight: 500;
}

md-top-app-bar md-icon,
md-top-app-bar [slot="navigationIcon"],
md-top-app-bar [slot="actionIcon"] {
  color: var(--md-sys-color-on-surface, #000000);
}

#menuButton,
#closeDrawerButton {
  --md-focus-ring-width: 0;
  --md-focus-ring-active-width: 0;
  --md-focus-ring-color: transparent;
  outline: none;
}

#appBarHeadline {
  display: inline-flex;
  align-items: center;
  line-height: normal;
  margin: 0;
  padding: 0;
}

/* --- Profile Card --- */
md-filled-card.profile-card {
  width: 100%;
  background-color: var(--app-card-bg-color);
  --md-filled-card-container-color: var(--app-card-bg-color);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 2.5rem;
  transition: background-color 0.3s ease;
}

.card-content {
  padding: 1.5rem;
  color: var(--app-text-color);
}

.profile-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin-right: 1rem;
  object-fit: cover;
  border: 2px solid var(--app-border-color);
  background-color: #eee;
}

.profile-info h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--app-text-color);
}

.profile-info p {
  margin: 0.25rem 0 0 0;
  color: var(--app-secondary-text-color);
}

.section-title {
  font-size: 1.25rem;
  font-weight: 500;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: var(--app-text-color);
}

p.profile-about {
  color: var(--app-text-color);
  margin-bottom: 1rem;
}
.profile-about a {
  color: var(--app-link-color);
  text-decoration: underline;
}

/* --- Chips --- */
md-chip-set {
  margin-bottom: 1rem;
}

md-assist-chip {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  --md-assist-chip-label-text-font: 'Poppins', sans-serif;
}

/* --- General Card Actions --- */
.card-actions {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--app-border-color);
  transition: border-color 0.3s ease;
}

.card-actions a {
  text-decoration: none;
}

/* --- News Section & Cards --- */
.news-section {
  margin-bottom: 2.5rem;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  min-height: 200px;
  position: relative;
}

#news-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--app-secondary-text-color);
  text-align: center;
  width: 80%;
}

#news-status md-circular-progress {
  margin-bottom: 1rem;
}

#news-status span {
  line-height: 1.5;
}

md-outlined-card.news-card {
  --md-outlined-card-container-shape: 16px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-color: var(--app-card-bg-color);
  transition: background-color 0.3s ease;
  --md-outlined-card-outline-color: var(--app-border-color);
}

.news-card-image {
  width: 100%;
  height: 180px;
  background-color: var(--md-sys-color-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--app-secondary-text-color);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--app-border-color);
  transition: border-color 0.3s ease;
  overflow: hidden;
}

.news-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-card-content {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.news-card-content h3 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--app-text-color);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.4em;
}

.news-card-content p {
  font-size: 0.9rem;
  color: var(--app-secondary-text-color);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.5rem;
  min-height: 4.05em;
  flex-grow: 1;
}

.news-card-actions {
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  flex-shrink: 0;
}

.news-card-actions a {
  text-decoration: none;
}

.view-all-posts-container {
  text-align: center;
  margin-top: 1.5rem;
}

.view-all-posts-container a {
  text-decoration: none;
}

/* --- Contribute Card --- */
md-elevated-card.contribute-card {
  --md-elevated-card-container-shape: 16px;
  background-color: var(--app-contribute-card-bg);
  color: var(--app-contribute-card-text);
  border-radius: 16px;
  overflow: hidden;
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  transition: background-color 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contribute-card h3 {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0;
  color: inherit;
}

.contribute-card p {
  font-size: 1rem;
  color: inherit;
  margin: 0;
  line-height: 1.6;
}

.contribute-card .contribute-actions {
  display: flex;
  justify-content: flex-start;
}

.contribute-card .contribute-actions a {
  text-decoration: none;
}

/* --- Social Icons --- */
.social-icons {
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid var(--app-border-color);
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  transition: border-color 0.3s ease;
}

.social-icons md-icon-button {
  --md-icon-button-icon-color: var(--app-social-icon-color);
}

.social-icons md-icon i,
.social-icons md-icon span {
  font-size: 20px;
  vertical-align: middle;
}

.social-icons md-icon-button:hover {
  --md-icon-button-hover-state-layer-color: var(--app-social-icon-hover-color);
  --md-icon-button-icon-color: var(--app-social-icon-hover-color);
}

/* --- Navigation Drawer --- */
.navigation-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 300px;
  background-color: var(--app-drawer-bg-color);
  color: var(--app-text-color);
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out, background-color 0.3s ease;
  z-index: 1002;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-top-right-radius: 16px;
  border-bottom-right-radius: 16px;
}

.navigation-drawer::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--app-drawer-tint-color);
  opacity: 0.04;
  pointer-events: none;
  border-radius: inherit;
}

.navigation-drawer.open {
  transform: translateX(0);
}

.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--app-overlay-bg-color);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px 12px 16px;
  border-bottom: 1px solid var(--app-border-color);
  flex-shrink: 0;
}

.drawer-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--app-text-color);
}

.drawer-content {
  flex-grow: 1;
  padding: 0;
  overflow-y: auto;
}

.drawer-footer {
  padding: 8px 0;
  border-top: 1px solid var(--app-border-color);
  flex-shrink: 0;
}

.drawer-footer .theme-toggle-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--app-secondary-text-color);
  padding: 8px 16px;
  margin-bottom: 4px;
}

.theme-button-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
}

.theme-button-container md-icon-button {
  --md-icon-button-icon-color: var(--app-text-color);
  border-radius: 50%; /* Ensure it's round */
  background-color: transparent;
  transition: background-color 0.2s ease;
}

.theme-button-container md-icon-button.selected {
  background-color: var(--app-theme-button-selected-bg);
  --md-icon-button-icon-color: var(--md-sys-color-primary);
}

/* --- Lists (md-list) --- */
md-list {
  --md-list-container-color: transparent;
  padding: 8px 0;
}

md-list-item {
  --md-list-item-label-text-color: var(--app-text-color);
  --md-list-item-supporting-text-color: var(--app-secondary-text-color);
  --md-list-item-leading-icon-color: var(--app-text-color);
  --md-list-item-trailing-icon-color: var(--app-text-color);
  --md-list-item-label-text-font: 'Poppins', sans-serif;
}

.navigation-drawer md-list-item {
  /* These might be redundant if the general md-list-item above covers them */
  /* --md-list-item-label-text-color: var(--app-text-color); */
  /* --md-list-item-supporting-text-color: var(--app-secondary-text-color); */
  /* --md-list-item-leading-icon-color: var(--app-text-color); */
  /* --md-list-item-trailing-icon-color: var(--app-text-color); */
  /* --md-list-item-label-text-font: 'Poppins', sans-serif; */
  --md-list-item-state-layer-shape: var(--md-sys-shape-corner-full);
}

md-list-item a[slot="headline"] {
  color: inherit;
  text-decoration: none;
  display: block;
  font-family: inherit;
}

.nested-list {
  padding-left: 32px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease-in-out;
  background-color: var(--app-nested-list-bg);
  border-radius: 8px;
  margin: 4px 8px;
}

.nested-list.open {
  max-height: 500px;
}

md-list-item[type="button"] md-icon[slot="end"] {
  transition: transform 0.3s ease;
}

md-list-item[type="button"].expanded md-icon[slot="end"] {
  transform: rotate(180deg);
}

/* --- Buttons --- */
md-filled-button md-icon {
  margin-inline-end: 8px;
  display: inline-flex;
  align-items: center;
}

md-filled-button {
  display: inline-flex;
  align-items: center;
}

/* --- Footer --- */
.app-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  margin-top: 2rem;
  color: var(--app-footer-text-color);
  font-size: 0.9rem;
  border-top: 1px solid var(--app-border-color);
  width: 100%;
  background-color: var(--app-bg-color);
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

md-filled-card.profile-card {
  display: flex;
  flex-direction: column;
}

.profile-card .card-content {
  flex-grow: 1;
}

.profile-card-actions {
  padding: 0.75rem 1.5rem 1.5rem 1.5rem; 
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-top: 1px solid var(--app-border-color); 
  margin-top: auto;
}

.profile-card-actions a {
  text-decoration: none;
}

/* Optional: To make buttons in actions take more width on smaller screens if they wrap */
@media (max-width: 480px) {
  .profile-card-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .profile-card-actions a md-outlined-button,
  .profile-card-actions a md-filled-button {
    width: 100%;
    justify-content: center;
  }
}

/* --- Podcast Embed Section --- */
.podcast-embed {
  margin: 2.5rem 0;
  text-align: center;
}

.podcast-embed p {
  margin-bottom: 1rem;
  color: var(--app-text-color);
}
/* --- Songs Page --- */
#songsPageContainer {
  padding: 1.5rem;
  background-color: var(--app-card-bg-color);
  border-radius: 16px;
  margin-top: 1rem;
  color: var(--app-text-color);
}

.songs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  position: relative;
}

#songs-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--app-secondary-text-color);
}

#songs-status md-circular-progress {
  margin-bottom: 1rem;
}

.song-card {
  background-color: var(--app-card-bg-color);
  border: 1px solid var(--app-border-color);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.song-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background-color: var(--md-sys-color-surface-variant);
}

.song-card-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.song-card-content h3 {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  color: var(--app-text-color);
}

.song-card-links {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.song-card-links a {
  text-decoration: none;
  font-size: 1.3rem;
  color: var(--md-sys-color-primary);
}
