/* My Library page styles (match Create page spacing, avoid new theme primitives) */

.library-content {
  width: 100%;
}

.library-status {
  margin: 10px 0 18px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: #eee;
  font-weight: 600;
}

/* Tabs (Create-style buttons) */
.library-tabs {
  display: flex;
  gap: 10px;
  margin: 8px 0 18px 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(233, 30, 99, 0.2);
}

.library-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: transparent;
  border: 1px solid rgba(233, 30, 99, 0.2);
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  font-weight: 800;
}

.library-tab-btn:hover {
  background: rgba(233, 30, 99, 0.1);
}

.library-tab-btn.active {
  background: #e91e63;
  border-color: #e91e63;
}

/* Panels (smooth switch, no reload) */
.library-tab-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease, max-height 220ms ease;
}

.library-tab-panel.is-active {
  max-height: 4000px;
  opacity: 1;
  overflow: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.library-subsection {
  margin-top: 14px;
}

.library-subsection-title {
  margin: 0 0 10px 0;
  color: rgba(255,255,255,0.9);
  font-weight: 900;
}

.library-status.error {
  background: rgba(255, 0, 0, 0.08);
}

.library-section {
  margin: 18px 0 24px 0;
}

.library-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 10px 0;
}

.library-section-title h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  display: flex;
  gap: 10px;
  align-items: center;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 900px) {
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 430px) {
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

.library-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  min-height: 150px;
  transition: all 0.2s ease;
}

.library-card.selected {
  border: 2px solid var(--primary-color, #e91e63);
  box-shadow: 0 0 12px rgba(255, 0, 128, 0.6);
  transform: scale(1.02);
}

.library-thumb {
  height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-thumb--bg {
  background-size: cover;
  background-position: center;
}

.library-thumb--circle {
  height: 104px;
}

.library-thumb-avatar {
  position: relative;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  overflow: visible;
}

.library-thumb-avatar-img {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.library-thumb-frame-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 78px;
  height: 78px;
  pointer-events: none;
}

.library-thumb-badge-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.library-thumb--null {
  color: rgba(255,255,255,0.6);
  font-size: 26px;
}

.library-thumb-achievement {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.library-thumb-achievement-icon {
  font-size: 26px;
  line-height: 1;
}

.library-meta {
  padding: 10px 10px 12px 10px;
}

.library-name {
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.1;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-tag {
  color: rgba(255,255,255,0.75);
  font-size: 0.82rem;
  font-weight: 700;
}

.library-pro {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: linear-gradient(90deg,#ffd54f,#ffac2f);
  color: #121212;
  font-weight: 900;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 999px;
}

.library-lock {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  color: #fff;
  font-size: 22px;
}

.library-card.locked .library-lock {
  display: flex;
}

.animated-background-card {
  animation: subtleFloat 6s ease-in-out infinite alternate;
}

@keyframes subtleFloat {
  0% { transform: scale(1); }
  100% { transform: scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
  .animated-background-card {
    animation: none;
  }
}

/* Modal */
.library-modal.hidden {
  display: none;
}

.library-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.library-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.library-modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100% - 24px));
  margin: 60px auto;
  border-radius: 16px;
  background: #121212;
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}

.library-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.library-modal-title {
  color: #fff;
  font-weight: 900;
}

.library-modal-x {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 18px;
}

/* Library modal close button: remove any background/pseudo artifacts (keep icon only) */
.library-modal .library-modal-x,
.library-modal .library-modal-x::before,
.library-modal .library-modal-x::after {
  background: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  border: none !important;
}

.library-modal .library-modal-x:focus,
.library-modal .library-modal-x:focus-visible,
.library-modal .library-modal-x:active {
  background: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

.library-modal .library-modal-x,
.library-modal .library-modal-x * {
  -webkit-tap-highlight-color: transparent;
}

.library-modal .library-modal-x i,
.library-modal .library-modal-x i::before,
.library-modal .library-modal-x i::after {
  background: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
}

.library-modal-body {
  padding: 14px;
}

.library-preview {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  min-height: 260px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
}

.library-preview-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(1.05);
}

.library-preview-center {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-preview-avatar {
  width: 110px;
  height: 110px;
  margin-bottom: 20px;
}

/* Preview modal: center initials inside the avatar circle (scoped to library preview only) */
.library-preview .library-preview-avatar > .avatar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-preview .library-preview-avatar .avatar-initial {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: calc(var(--avatar-size) * 0.45);
  line-height: 1;
  border-radius: 50%;
  position: static;
  top: auto;
  left: auto;
  transform: none;
}

.library-preview-badges {
  position: relative;
  z-index: 2;
  width: calc(100% - 24px);
  margin: 24px 12px 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.library-preview-badges img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.library-preview-badges-empty {
  flex: 1 1 100%;
  color: rgba(255,255,255,0.7);
  font-weight: 700;
  text-align: center;
}

.library-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.library-btn {
  flex: 1;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-weight: 900;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
}

.library-btn.primary {
  background: #e91e63;
  border-color: rgba(255,255,255,0.12);
}

.library-btn.ghost {
  background: transparent;
}

.library-btn.disabled,
.library-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
