/* Add to datatables-block.css */
.region-content,
main[role="main"] .region, 
.block-system-main-block {
  display: flex;
  justify-content: center;
}

.region-content > div,
main[role="main"] .region > div,
.block-system-main-block > div {
  width: 90%;
  max-width: 90%;
}

/* Fix for missing top border */
table#datatables-example {
  border-top: 1px solid #888888 !important;
}


/* Restore spacing between playlist buttons and date selector */
.chart-header {
  margin-bottom: 1.5rem !important; /* Bootstrap mb-4 equivalent */
}

.playlist-buttons {
  margin-bottom: 1rem !important; /* Additional bottom margin */
}

.date-navigation {
  margin-top: 0.5rem !important; /* Add some top breathing room */
  margin-bottom: 1rem !important; /* Bootstrap mb-3 equivalent */
}


/* Chart history section styling */

.accordion-button:not(.collapsed) {
    background-color: #e7f1ff;
    color: #0c63e4;
}

.song-title {
    font-weight: bold;
    color: #333;
}

.chart-stats {
    font-size: 0.9em;
    color: #666;
}

/* Chart graph styling */
.chart-graph {
    min-height: 300px;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    padding: 1rem;
}

/* Center specific table columns */
.text-center {
    text-align: center !important;
}

/* Table styling enhancements */
.table-sm th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.table-sm td {
    vertical-align: middle;
}

/* Ensure proper spacing in date navigation */
.date-select-form {
    margin: 0 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chart-stats {
        display: block;
        margin-top: 5px;
    }
    
    .accordion-button {
        padding: 0.75rem 1rem;
    }

    .accordion-button .ms-auto {
        font-size: 0.85em;
    }
}

/* Accordion arrow styling */
.accordion-button::after {
    margin-left: 1rem;
    transition: transform 0.2s ease-in-out;
}

.accordion-button:not(.collapsed)::after {
    transform: rotate(180deg);
}

/* Card enhancements */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Chart container styling */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Artist history icon hover effect */
.artist-history:hover {
    color: #0d6efd;
    transform: scale(1.1);
    transition: all 0.2s ease-in-out;
}

/* Mobile-specific styling */
@media screen and (max-width: 768px) {
  /* Table styling */
  #datatables-example {
    font-size: 0.9rem;
    width: 100%;
  }
  
  #datatables-example td, 
  #datatables-example th {
    padding: 8px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Ensure play button column stays visible */
  #datatables-example td:last-child,
  #datatables-example th:last-child {
    display: table-cell !important;
    width: auto;
    min-width: 30px;
  }

  /* Adjust specific column widths for mobile */
  #datatables-example td:nth-child(1), /* History icon */
  #datatables-example th:nth-child(1) {
    width: 30px;
    min-width: 30px;
  }

  #datatables-example td:nth-child(3), /* Position */
  #datatables-example th:nth-child(3),
  #datatables-example td:nth-child(4), /* LastWk */
  #datatables-example th:nth-child(4) {
    width: 40px;
    min-width: 40px;
    text-align: center;
  }

  #datatables-example td:nth-child(5), /* Artist */
  #datatables-example th:nth-child(5),
  #datatables-example td:nth-child(6), /* Song */
  #datatables-example th:nth-child(6) {
    max-width: 120px; /* Adjust as needed */
  }

  /* Navigation styling */
  .date-navigation {
    gap: 10px;  /* Add space between flex items */
  }

  .date-select {
    flex: 1;  /* Allow date select to take remaining space */
    margin: 0 10px;  /* Add consistent margins */
  }

  #chart-date {
    width: 100%;  /* Make select fill its container */
    min-width: 120px;  /* Ensure minimum width */
  }

  .nav-button .btn {
    padding: 0.375rem 0.5rem;  /* Reduce button padding */
    font-size: 0.875rem;  /* Slightly smaller font */
    white-space: nowrap;  /* Prevent button text wrapping */
    max-width: 90px;  /* Limit button width */
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Compact buttons */
  .btn-link {
    padding: 0.25rem;
  }

  /* Handle long text */
  .text-truncate {
    max-width: 120px;
  }
}

/* Extra small devices */
@media screen and (max-width: 375px) {
  #datatables-example {
    font-size: 0.8rem;
  }
  
  #datatables-example td, 
  #datatables-example th {
    padding: 6px 2px;
  }
}

/* Spotify player centering */
.spotify-player-placeholder {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

#spotifyPlayerContainer {
  width: 100%;
  max-width: 380px; /* Match the width specified in your JavaScript */
  margin: 0 auto;
}

#spotify-player {
  width: 100%;
  border-radius: 12px;
}

/* For mobile */
@media screen and (max-width: 768px) {
  #spotifyPlayerContainer {
    max-width: 100%; /* Allow full width on mobile */
    padding: 0 10px; /* Add some padding from edges */
  }
}

@media screen and (max-width: 768px) {
  /* Existing mobile styles remain... */

  /* Allow song titles to wrap */
  #datatables-example td:nth-child(6) { /* Song column */
    white-space: normal;  /* Allow text to wrap */
    max-width: 120px;    /* Keep max-width */
    min-width: 100px;    /* Ensure minimum width */
    word-wrap: break-word;
    overflow: visible;
  }

  /* Keep other columns from wrapping */
  #datatables-example td:not(:nth-child(6)) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Adjust cell height for wrapped content */
  #datatables-example tr {
    height: auto;
    min-height: 40px;
  }
}

/* Block visibility management */
#block-flexi-style-subtheme-spotifyplayer,
.block-flexi-style-subtheme-spotifyplayer,
#block-artist-bio-block,
.block-artist-bio-block {
  transition: opacity 0.3s ease-in-out, height 0.3s ease-in-out;
  overflow: hidden;
}

/* Initial visibility settings (these will be overridden by JS, but provide a fallback) */
#block-flexi-style-subtheme-spotifyplayer,
.block-flexi-style-subtheme-spotifyplayer,
#block-artist-bio-block,
.block-artist-bio-block {
  display: none;
}

/* Artist bio styling */
.artist-bio-container {
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 20px;
}

.artist-bio-container .bio-title {
  color: #333;
  font-size: 1.5rem;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dee2e6;
}

.artist-bio-container .bio-text {
  line-height: 1.6;
}

/* Consistent height for sidebar blocks to prevent layout shifts */
.sidebar .block {
  min-height: 150px;
}

/* Duet section styling in artist history */
#songAccordion h4 {
  font-size: 1.25rem;
  color: #495057;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.5rem;
  margin-top: 1.5rem;
}

/* Make duet partner headings stand out */
#songAccordion h4:not(:first-child) {
  margin-top: 2rem;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .artist-bio-container {
    padding: 10px;
  }
  
  .artist-bio-container .bio-title {
    font-size: 1.2rem;
  }
  
  .sidebar .block {
    min-height: 100px;
  }
}

/* Player styles */
#block-flexi-style-subtheme-spotifyplayer.active,
.block-flexi-style-subtheme-spotifyplayer.active {
  display: block;
  opacity: 1;
  min-height: 352px;
}

/* Block debug outlines - comment these out in production */
/*
#block-flexi-style-subtheme-spotifyplayer,
.block-flexi-style-subtheme-spotifyplayer {
  border: 2px solid blue;
}

#block-flexi-style-subtheme-theukcharts,
.block-flexi-style-subtheme-theukcharts {
  border: 2px solid green;
}

#block-artist-bio-block,
.block-artist-bio-block {
  border: 2px solid red;
}

/* Block visibility management for stacked layout */
#block-flexi-style-subtheme-spotifyplayer, 
.block-flexi-style-subtheme-spotifyplayer,
#block-flexi-style-subtheme-artistbiography, 
.block-flexi-style-subtheme-artistbiography,
#block-flexi-style-subtheme-theukcharts,
.block-flexi-style-subtheme-theukcharts {
  transition: opacity 0.3s ease-in-out, height 0.3s ease-in-out;
  margin-bottom: 20px; /* Add space between blocks when both visible */
}

/* Ensure region is a flex container for stacking */
.region-sidebar-first,
.sidebar .block-region {
  display: flex;
  flex-direction: column;
}

/* Consistent styling for blocks */
.artist-bio-container {
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
}

/* Add a border to visually separate blocks when both are visible */
#block-flexi-style-subtheme-spotifyplayer,
.block-flexi-style-subtheme-spotifyplayer {
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 20px;
}

/* Apply consistent styling to all sidebar blocks */
.artist-bio-container,
#block-flexi-style-subtheme-theukcharts,
.block-flexi-style-subtheme-theukcharts {
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 20px;
}

/* Add consistent heading styles */
.artist-bio-container .bio-title,
#block-flexi-style-subtheme-theukcharts h2,
.block-flexi-style-subtheme-theukcharts h2 {
  color: #333;
  font-size: 1.5rem;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dee2e6;
}

/* Add consistent body text styles */
.artist-bio-container .bio-text,
#block-flexi-style-subtheme-theukcharts .content,
.block-flexi-style-subtheme-theukcharts .content {
  line-height: 1.6;
}

/* Artist bio header with close button */
.bio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dee2e6;
}

/* Move margin/padding from bio-title to bio-header */
.artist-bio-container .bio-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* Style the close button */
.bio-close-btn {
  background: none;
  border: none;
  color: #6c757d;
  padding: 0.25rem 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease-in-out;
}

.bio-close-btn:hover {
  opacity: 1;
  color: #343a40;
}

*/