/* Enforce fixed dimensions and prevent shifting */
.player-card {
  background: var(--bs-body-bg);
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    padding: 20px;
    box-sizing: border-box;
    width: 500px;
    /* fixed width */
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    /* clip overflowing content */
    transition: none;
    /* remove transition effects that may shift layout */
}

.player-card:hover {
    transform: translateY(-3px);
}

.player-header {
    text-align: left;
    line-height: 1.2;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bs-border-color);
    min-height: 50px;
    overflow: hidden;
}

.player-title,
.player-truncate {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-wrapper {
    margin-top: 15px;
}

.nav-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* Navbar styling */
    .navbar-nav .nav-item {
      margin-right: 0.5rem;
    }
    .navbar-nav .dropdown-menu {
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    .navbar-brand {
      font-weight: 600;
      color: var(--bs-link-color) !important;
    }
    .navbar-nav .nav-link {
      transition: all 0.2s ease;
      border-radius: 0.375rem;
      margin: 0 0.1rem;
    }
    .navbar-nav .nav-link:hover {
      background-color: rgba(13, 110, 253, 0.1);
    }
    .navbar-nav .nav-link.active {
      background-color: rgba(13, 110, 253, 0.15);
      font-weight: 500;
    }

    .mw-navbar .navbar-nav {
      align-items: center;
    }

    .mw-navbar .nav-link {
      white-space: nowrap;
      font-size: 0.95rem;
    }

    .mw-navbar .navbar-brand {
      white-space: nowrap;
      flex-shrink: 0;
    }

    .mw-navbar .navbar-collapse {
      align-items: center;
    }

    .mw-navbar {
      z-index: 1030;
    }

    .mw-navbar .dropdown-menu {
      z-index: 1031;
    }

    .mw-navbar .dropdown-toggle::after {
      margin-left: 0.35rem;
    }

    @media (min-width: 992px) and (max-width: 1399.98px) {
      .mw-navbar .nav-link {
        font-size: 0.875rem;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
      }

      .mw-navbar .navbar-nav .nav-item {
        margin-right: 0.2rem;
      }
    }
    
    /* Role indicator badge styling */
    .role-indicator-badge {
      position: relative;
      top: -2px;
      font-size: 0.6rem;
      padding: 0.15rem 0.3rem;
    }
    
    /* Role switching form styling */
    .dropdown-item-form {
      margin: 0;
      padding: 0;
    }
    
    .dropdown-item-form button {
      width: 100%;
      text-align: left;
      border: none;
      background: none;
      padding: 0.5rem 1rem;
      transition: background-color 0.15s ease-in-out;
    }
    
    .dropdown-item-form button:hover {
      background-color: var(--bs-dropdown-link-hover-bg);
      color: var(--bs-dropdown-link-hover-color);
    }
    
    .dropdown-item-form button.active {
      background-color: var(--bs-primary);
      color: white;
    }
    
    .dropdown-item-form button.active:hover {
      background-color: var(--bs-primary);
      color: white;
    }
    
    /* Role switching section styling */
    .dropdown-header {
      padding: 0.5rem 1rem 0.25rem;
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    /* Dashboard specific styling */
    .hero-section {
      background: linear-gradient(135deg, rgba(13, 110, 253, 0.05) 0%, rgba(108, 117, 125, 0.05) 100%);
      border-radius: 1rem;
      margin-bottom: 2rem;
    }

    /* Enhanced home page styling */
    .player-card .card {
      border-radius: 1rem;
      overflow: hidden;
    }

    .player-card .card-header {
      background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-link-hover-color) 100%) !important;
      border: none;
    }

    .player-card audio {
      border-radius: 0.5rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .btn-lg {
      border-radius: 0.75rem;
      font-weight: 500;
      transition: all 0.2s ease;
    }

    .btn-lg:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .display-4 .bi-soundwave {
      animation: pulse 2s infinite;
    }

    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.7; }
    }

    /* Article card enhancements for discover page */
    .article-card {
      border-radius: 1rem !important;
      transition: all 0.3s ease;
      overflow: hidden;
    }

    .article-card:hover {
      transform: translateY(-5px);
      box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15) !important;
    }

    .article-card .card-header {
      border-radius: 1rem 1rem 0 0 !important;
      background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-link-hover-color) 100%) !important;
    }

    .article-card audio {
      border-radius: 0.5rem;
      background: var(--bs-tertiary-bg);
    }

    /* Compact article cards for discover page */
    .article-card-compact {
      border-radius: 0.75rem !important;
      transition: all 0.2s ease;
      border: 1px solid var(--bs-border-color) !important;
      height: auto;
    }

    .article-card-compact:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1) !important;
      border-color: var(--bs-secondary-color) !important;
    }

    .article-card-compact .card-body {
      padding: 1rem !important;
    }

    .article-card-compact .card-title {
      font-size: 0.95rem;
      line-height: 1.3;
      margin-bottom: 0.75rem !important;
    }

    .audio-compact audio {
      height: 32px !important;
      border-radius: 0.375rem;
      background: var(--bs-tertiary-bg);
    }

    .text-truncate-3 {
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      overflow: hidden;
      line-height: 1.4;
      max-height: 4.2em;
    }

    .stats-container {
      background: color-mix(in srgb, var(--bs-tertiary-bg) 80%, transparent);
      border-radius: 1rem;
      padding: 2rem;
    }

    .stat-card {
      background: var(--bs-body-bg);
      padding: 1.5rem;
      border-radius: 0.75rem;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .stat-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .engine-card {
      background: var(--bs-body-bg);
      border: 1px solid rgba(0, 0, 0, 0.08);
      border-radius: 1rem;
      transition: all 0.2s ease;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }

    .engine-card:hover {
      transform: translateY(-3px);
      box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
      border-color: rgba(13, 110, 253, 0.2);
    }

    .engine-icon {
      background: rgba(13, 110, 253, 0.08);
      width: 80px;
      height: 80px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto;
    }

    .stat-mini {
      padding: 0.5rem;
      background: rgba(248, 249, 250, 0.8);
      border-radius: 0.5rem;
    }

    .stat-mini-value {
      font-size: 1.25rem;
      line-height: 1;
    }

    .stat-mini-label {
      font-size: 0.75rem;
      opacity: 0.7;
    }

    .activity-card {
      border: none;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
      border-radius: 1rem;
    }

    .activity-item {
      padding: 1rem 0;
      transition: background-color 0.2s ease;
    }

    .activity-item:hover {
      background-color: rgba(248, 249, 250, 0.5);
      border-radius: 0.5rem;
      margin: 0 -1rem;
      padding: 1rem;
    }

    .activity-icon {
      width: 40px;
      height: 40px;
      background: rgba(13, 110, 253, 0.1);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.1rem;
    }

    .activity-content {
      min-height: 40px;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .activity-message {
      font-weight: 500;
      color: var(--bs-body-color);
      margin-bottom: 0.25rem;
    }

    /* Audio dashboard specific styles */
    .action-section {
      background: rgba(248, 249, 250, 0.5);
      border-radius: 1rem;
      padding: 2rem;
    }

    .content-card {
      background: white;
      border: 1px solid rgba(0, 0, 0, 0.08);
      border-radius: 1rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }

    .content-card .card-header {
      background: rgba(13, 110, 253, 0.05);
      border-bottom: 1px solid rgba(0, 0, 0, 0.08);
      border-radius: 1rem 1rem 0 0 !important;
      padding: 1.25rem 1.5rem;
    }

    .audio-list {
      max-height: 400px;
      overflow-y: auto;
    }

    .audio-item {
      padding: 1rem 0;
      border-bottom: 1px solid rgba(0, 0, 0, 0.08);
      transition: background-color 0.2s ease;
    }

    .audio-item:last-child {
      border-bottom: none;
    }

    .audio-item:hover {
      background-color: rgba(248, 249, 250, 0.5);
      border-radius: 0.5rem;
      margin: 0 -1rem;
      padding: 1rem;
    }

    .audio-icon {
      width: 40px;
      height: 40px;
      background: rgba(13, 110, 253, 0.1);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.2rem;
    }

    .audio-content h6 a {
      color: var(--bs-body-color);
      transition: color 0.2s ease;
    }

    .audio-content h6 a:hover {
      color: var(--bs-link-color);
    }

    .empty-state {
      padding: 3rem 1rem;
    }

    /* Badge styling improvements */
    .badge.bg-completed { background-color: var(--bs-success) !important; }
    .badge.bg-processing { background-color: var(--bs-info) !important; }
    .badge.bg-failed { background-color: var(--bs-danger) !important; }
    .badge.bg-pending { background-color: var(--bs-warning) !important; color: var(--bs-body-color) !important; }

    /* Responsive adjustments */
    @media (max-width: 768px) {
      .stats-container {
        padding: 1rem;
      }
      
      .hero-section {
        padding: 2rem 1rem !important;
      }
      
      .engine-icon {
        width: 60px;
        height: 60px;
      }
      
      .display-4 {
        font-size: 1.5rem !important;
      }

      .action-section {
        padding: 1.5rem;
      }
      
      .audio-actions {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
      }
    }

    /* Homepage Playlist Styling */
    #playlist-container .card {
      transition: transform 0.2s ease, box-shadow 0.3s ease;
    }
    
    #playlist-container .card:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    }
    
    .list-group-item {
      transition: background-color 0.2s ease;
    }
    
    .list-group-item:hover {
      background-color: rgba(var(--bs-primary-rgb), 0.05);
    }
    
    /* Enhanced play button styling */
    .btn.rounded-circle {
      transition: all 0.2s ease;
    }
    
    .btn.rounded-circle:hover {
      transform: scale(1.05);
    }
    
    /* Track number badge styling */
    .track-number-badge {
      font-size: 0.7rem;
      font-weight: 600;
      opacity: 0.7;
    }

    /* Keep long metadata blocks readable without stretching the page. */
    .mw-details-scroll {
      max-height: 70vh;
      overflow: auto;
    }