/* Custom styles for BridgeBeats main site using DocFX theming */

/* Fix header layout */
.navbar .container-xxl {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
}

.navbar-brand img,
#brandLogo {
  height: 50px;
  width: auto;
  object-fit: contain;
  vertical-align: middle;
}

/* Ensure centered brand doesn't break on small screens */
@media (max-width:768px) {
  .navbar-brand.position-absolute {
    position: static !important;
    transform: none !important;
  }
}

/* Make footer sticky at bottom */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

html {
  overflow-y: auto;
  height: 100%;
}

main {
  flex: 1 0 auto;
  width: 100%;
  overflow: visible;
}

/* Ensure footer is always visible */
footer {
  flex-shrink: 0;
  width: 100%;
  margin-top: auto;
}

/* Footer layout */
footer .footer-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-start;
}

footer .footer-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
}
footer .footer-separator {
  color: var(--bs-secondary-color);
  margin: 0 0.25rem;
}

footer .footer-right {
  max-width: 100%;
  line-height: 1.25;
  font-size: 0.8125rem;
  white-space: normal;
}

@media (min-width: 768px) {
  footer .footer-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
  }

  footer .footer-right {
    text-align: right;
    flex-shrink: 0;
    white-space: normal;
  }

  footer .footer-left {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

/* Fix badge display for login required tooltips */
.badge.bg-secondary {
  font-size: 0.75rem;
  padding: 0.25em 0.5em;
  vertical-align: middle;
}

/* Disabled form label styling */
.form-check-label.disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

/* Show "Login required" hint only on hover when label is disabled */
.form-check-label .login-required {
  display: none;
}

.form-check-label.disabled:hover .login-required,
.form-check-label.disabled:focus-within .login-required {
  display: inline-block;
}

/* Ensure Razor/MVC content renders with DocFX styles applied.
 DocFX hides non-<article> children under main.content by default. */
body>main>.content> :not(article),
body[data-layout=""]>main>.content> :not(article),
body[data-layout=conceptual]>main>.content> :not(article),
body:not([data-search])[data-layout=""]>main>.content> :not(article),
body:not([data-search])[data-layout=conceptual]>main>.content> :not(article) {
  display: block;
}

/* Embed card styles for music lookup results */
.embed-card {
  background: var(--bs-body-bg);
  border: 1px solid;
  border-color: #000000;
  border-left: 4px solid;
  border-radius: 0.375rem;
  padding: 0.625rem 0.875rem;
  max-width: 515px;
}

/* Provider-specific border colors */
.embed-card.provider-applemusic {
  border-left-color: #D60017;
}

.embed-card.provider-spotify {
  border-left-color: #1ED760;
}

.embed-card.provider-tidal {
  border-left-color: #000000;
}

/* Fallback for unknown providers */
.embed-card:not(.provider-applemusic):not(.provider-spotify):not(.provider-tidal) {
  border-left-color: #6366F1;
}

.embed-header-top {
  margin-bottom: 0.5rem;
}

.embed-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.embed-header {
  display: flex;
  gap: 0.625rem;
  margin-bottom: 0.25rem;
}

.embed-image {
  width: 120px !important;
  height: 120px !important;
  max-width: 120px !important;
  max-height: 120px !important;
  border-radius: 0.375rem;
  object-fit: cover;
  flex-shrink: 0;
}

.embed-content {
  flex: 1;
  min-width: 0;
}

.embed-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--bs-link-color);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

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

.embed-info {
  font-size: 0.9375rem;
  color: var(--bs-secondary-color);
  margin-bottom: 0;
  white-space: pre-line;
  line-height: 1.25;
}

.embed-providers {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
  width: 100%;
}

.provider-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bs-secondary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  color: var(--bs-body-color);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  min-height: 2.5rem;
  flex: 1 1 0;
  min-width: 0;
}

.provider-button:hover {
  background: var(--bs-tertiary-bg);
  color: var(--bs-emphasis-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.provider-icon {
  font-size: 1.125rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.5rem;
  width: 100%;
}

/* Share button and dropdown styles */
.share-dropdown {
  position: relative;
  flex-shrink: 0;
}

.share-button {
  background: var(--bs-secondary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-button:hover {
  background: var(--bs-tertiary-bg);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.share-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.share-arrow-icon {
  width: 1rem;
  height: 1rem;
  object-fit: contain;
  display: block;
}

.dropdown-menu {
  min-width: 200px;
  padding: 0.5rem 0;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1050;
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  list-style: none;
  margin-bottom: 0;
  padding-left: 0;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu-end {
  right: 0;
  left: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  width: 100%;
  border: none;
  background: none;
  color: var(--bs-body-color);
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.dropdown-item:hover:not(:disabled) {
  background: var(--bs-secondary-bg);
  color: var(--bs-emphasis-color);
}

.dropdown-item:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.dropdown-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

/* Provider logo styling */
.provider-logo {
  display: block;
  height: 1.25rem;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* Hide dark logos by default (light theme) */
.provider-logo-dark {
  display: none;
}

/* Provider logo styling */
.provider-icon {
  display: block;
  height: 1.25rem;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* Hide dark logos by default (light theme) */
.provider-icon-dark {
  display: none;
}

/* Show dark logos and hide light logos in dark theme */
html[data-bs-theme="dark"] .provider-logo-light {
  display: none;
}

html[data-bs-theme="dark"] .provider-logo-dark {
  display: block;
}

/* Auto theme - follow system preference */
@media (prefers-color-scheme: dark) {

  html[data-bs-theme="auto"] .provider-logo-light,
  html:not([data-bs-theme]) .provider-logo-light {
    display: none;
  }

  html[data-bs-theme="auto"] .provider-logo-dark,
  html:not([data-bs-theme]) .provider-logo-dark {
    display: block;
  }
}

/* Refined provider icon styles */
.provider-icon-light { display:block; height:1.25rem; width:auto; max-width:100%; object-fit:contain; }
.provider-icon-dark { display:none; height:1.25rem; width:auto; max-width:100%; object-fit:contain; }
html[data-bs-theme="dark"] .provider-icon-light { display:none; }
html[data-bs-theme="dark"] .provider-icon-dark { display:block; }
@media (prefers-color-scheme: dark) {
  html[data-bs-theme="auto"] .provider-icon-light,
  html:not([data-bs-theme]) .provider-icon-light { display:none; }
  html[data-bs-theme="auto"] .provider-icon-dark,
  html:not([data-bs-theme]) .provider-icon-dark { display:block; }
}

/* Prevent nested provider-icon class on img from stretching full width */
img.provider-icon { width:auto; height:1.25rem; }

/* Ensure picture elements don't add extra space */
.provider-icon picture {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  width: 100%;
}

/* Explicit sizing for images inside picture tags */
.provider-icon picture img {
  height: 1.25rem;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* Dark mode support for provider logos using data-bs-theme */
@media (prefers-color-scheme: dark) {

  html:not([data-bs-theme="light"]) .provider-logo,
  html[data-bs-theme="dark"] .provider-logo {
    filter: brightness(1);
  }
}

/* Light mode explicit override */
html[data-bs-theme="light"] .provider-logo {
  filter: none;
}

/* Dark mode: lighter borders */
html[data-bs-theme="dark"] .embed-card {
  border-color: var(--bs-border-color, #dee2e6);
}

/* Tidal cards: white left border in dark mode */
html[data-bs-theme="dark"] .embed-card.provider-tidal {
  border-left-color: #FFFFFF !important;
}

/* Auto theme - follow system preference */
@media (prefers-color-scheme: dark) {

  html[data-bs-theme="auto"] .embed-card,
  html:not([data-bs-theme]) .embed-card {
    border-color: var(--bs-border-color, #dee2e6);
  }

  /* Tidal cards: white left border in dark mode */
  html[data-bs-theme="auto"] .embed-card.provider-tidal,
  html:not([data-bs-theme]) .embed-card.provider-tidal {
    border-left-color: #FFFFFF !important;
  }
}

/* Protected mode overlay - covers entire form inputs section */
#inputs {
  position: relative;
  min-height: 300px;
}

.btn-help-icon {
  width: 32px;
  height: 32px;
}

.collapse-with-transition {
  transition: height 0.35s ease;
}

.protected-mode-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex !important;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: auto;
  border-radius: 0.375rem;
  backdrop-filter: blur(2px);
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.3s, opacity 0.3s;
}

.protected-mode-overlay:not(.d-none) {
  visibility: visible;
  opacity: 1;
}

html[data-bs-theme="dark"] .protected-mode-overlay {
  background: rgba(33, 37, 41, 0.85);
}

@media (prefers-color-scheme: dark) {
  html[data-bs-theme="auto"] .protected-mode-overlay,
  html:not([data-bs-theme]) .protected-mode-overlay {
    background: rgba(33, 37, 41, 0.85);
  }
}

.overlay-content {
  text-align: center;
  padding: 1rem;
}

.overlay-content p {
  color: var(--bs-body-color);
  font-size: 1rem;
  font-weight: 500;
}

.overlay-content a {
  color: var(--bs-link-color);
  text-decoration: underline;
  font-weight: 600;
}

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

.modal-hidden {
  display: none;
}

.nav-link-hidden {
  display: none;
}

/* Playlist Manager Styles */
.playlist-toolbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 0.375rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.playlist-toolbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.playlist-selection-info {
  font-size: 1rem;
  font-weight: 600;
  color: var(--bs-body-color);
  min-width: 120px;
}

.playlist-inputs {
  flex: 1;
  min-width: 200px;
}

.playlist-inputs input,
.playlist-inputs textarea {
  width: 100%;
}

.playlist-actions {
  display: flex;
  gap: 0.5rem;
}

.card-selection-checkbox {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
}

.card-selection-checkbox input[type="checkbox"] {
  appearance: none;
  width: 24px;
  height: 24px;
  border: 2px solid var(--bs-primary);
  border-radius: 4px;
  background: var(--bs-body-bg);
  cursor: pointer;
  position: relative;
}

.card-selection-checkbox input[type="checkbox"]:checked {
  background: var(--bs-primary);
}

.card-selection-checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 16px;
  font-weight: bold;
}

.card-selection-checkbox label {
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.playlist-selection-mode .embed-card {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.playlist-selection-mode .embed-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.3);
}

.playlist-selection-mode .embed-card.selected {
  border: 2px solid var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.2);
}

/* Adjust share button position when in selection mode */
.playlist-selection-mode .embed-header-top {
  padding-left: 40px;
}

#startPlaylistBtn {
  margin-top: 0.5rem;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.shake-animation {
  animation: shake 0.3s ease-in-out;
}

@media (max-width: 768px) {
  .playlist-toolbar-content {
    flex-direction: column;
    align-items: stretch;
  }

  .playlist-inputs {
    order: 1;
    min-width: 100%;
  }

  .playlist-selection-info {
    order: 2;
  }

  .playlist-actions {
    order: 3;
    justify-content: space-between;
  }
}
