/* Voice Library Page Styles */

.page-header {
  margin-bottom: 2rem;
}

.header-content {
  max-width: 800px;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1rem;
  color: hsl(var(--muted-foreground));
}

/* Library Content */

.library-content {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  overflow: hidden;
}

.library-controls {
  padding: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Search */

.voice-search-container {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.voice-search-container svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--muted-foreground));
  pointer-events: none;
}

.voice-search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 3rem;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  transition: all 0.2s ease;
}

.voice-search-input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  background: hsl(var(--background));
}

.voice-search-input::placeholder {
  color: hsl(var(--muted-foreground));
}

/* Model Tabs */

.model-tabs {
  display: flex;
  gap: 0.5rem;
  background: hsl(var(--secondary));
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.model-tab-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.model-tab-btn:hover {
  color: hsl(var(--foreground));
}

.model-tab-btn.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Voice Card Grid */

.voice-grid-container {
  padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

/* Voice Card */

.voice-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: row;
  align-items: center;
  position: relative;
  overflow: visible;
  min-height: 130px;
  padding-left: 75px;
  margin-left: 55px;
  cursor: pointer;
}

.voice-card:hover {
  transform: translateY(-2px);
}

/* Premium Voice Card - Diagonal Ribbon */
.voice-card.premium-voice .voice-card-content::after {
  content: '';
  position: absolute;
  top: 10px;
  right: -28px;
  width: 100px;
  height: 20px;
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  transform: rotate(45deg);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
  z-index: 10;
  pointer-events: none;
}

/* Avatar Wrapper - Large circle extending left */
.voice-card-avatar-wrapper {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12;
}

.voice-card-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid hsl(var(--border));
  transition: all 0.25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  background: hsl(var(--card));
}

.voice-card:hover .voice-card-avatar {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 4px hsl(var(--primary) / 0.15), 0 12px 32px rgba(0, 0, 0, 0.2);
  transform: scale(1.03);
}

/* Play button overlay on avatar */
.voice-play-btn {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid hsl(var(--background));
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.voice-play-btn:hover {
  transform: scale(1.1);
  background: hsl(var(--primary));
}

.voice-play-btn.playing {
  background: hsl(var(--primary));
  animation: pulse-ring 1.5s ease-out infinite;
}

/* Content - Right side card */
.voice-card-content {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 1rem 4.5rem;
  min-width: 0;
  height: 130px;
  box-sizing: border-box;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  position: relative;
  overflow: hidden;
}

.voice-card:hover .voice-card-content {
  border-color: hsl(var(--primary) / 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Voice Card Info Section */
.voice-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.voice-card-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Voice Tags */
.voice-card-tags {
  display: flex;
  gap: 0.5rem;
}

.voice-tag {
  padding: 0.25rem 0.625rem;
  background: hsl(var(--secondary));
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

/* Voice Card ID - Inline */
.voice-card-id {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.voice-id-label {
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}

.voice-card-id code {
  font-family: 'Monaco', 'Menlo', monospace;
  color: hsl(var(--foreground));
  background: none;
  padding: 0;
  font-size: 0.75rem;
}

.voice-id-copy-btn {
  width: 24px;
  height: 24px;
  border-radius: 0.25rem;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.voice-id-copy-btn:hover {
  color: hsl(var(--primary));
  background: hsl(var(--secondary));
}

/* Check icon after copy - same styling as copy icon */
.voice-id-copy-btn .check-icon {
  color: hsl(142, 71%, 45%); /* Green success color */
}

.voice-id-copy-btn svg {
  background: transparent;
}

/* Chevron Arrow */
.voice-card-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--muted-foreground));
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.voice-card:hover .voice-card-chevron {
  color: hsl(var(--foreground));
  transform: translateX(4px);
}

/* Voice Play Button SVG */
.voice-play-btn svg {
  margin: auto;
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 hsl(var(--primary) / 0.4);
  }
  70% {
    box-shadow: 0 0 0 12px hsl(var(--primary) / 0);
  }
  100% {
    box-shadow: 0 0 0 0 hsl(var(--primary) / 0);
  }
}

/* Header Link */
.header-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: hsl(var(--secondary));
  border-radius: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.25s ease;
}

.header-link:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--foreground) / 0.08);
}

.voice-id-copy-btn:active {
  transform: scale(0.95);
}

/* Voice Card Actions */

.voice-card-actions {
  margin-top: auto;
}

.use-voice-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: 1.5px solid hsl(var(--border));
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Light mode - black text */
:root:not(.dark) .use-voice-btn {
  color: #000000;
}

/* Dark mode - white text */
.dark .use-voice-btn {
  color: #ffffff;
}

.use-voice-btn:hover {
  transform: translateY(-2px);
}

.use-voice-btn:active {
  transform: translateY(0);
}

.use-voice-btn svg {
  flex-shrink: 0;
}

/* Loading State */

.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
}

.loading-state .spinner {
  width: 48px;
  height: 48px;
  border: 3px solid hsl(var(--border));
  border-top-color: hsl(var(--primary));
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-state p {
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;
}

/* Empty State */

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
}

.empty-state p {
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;
}

/* Responsive */

@media (max-width: 768px) {
  .library-content {
    border-radius: 0.5rem;
    overflow: visible;
  }

  .library-controls {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.75rem;
  }

  .voice-search-container {
    min-width: 100%;
  }

  .voice-search-input {
    padding: 0.625rem 0.75rem 0.625rem 2.5rem;
    font-size: 0.8rem;
  }

  .voice-search-container svg {
    left: 0.75rem;
    width: 16px;
    height: 16px;
  }

  .model-tabs {
    width: 100%;
    justify-content: stretch;
  }

  .model-tab-btn {
    flex: 1;
    padding: 0.5rem 0.5rem;
    font-size: 0.75rem;
  }

  .voice-grid-container {
    grid-template-columns: 1fr;
    padding: 0.75rem;
    gap: 1.5rem;
    max-height: calc(100vh - 260px);
  }
  
  /* Much smaller avatar on mobile */
  .voice-card {
    margin-left: 30px;
    padding-left: 40px;
    min-height: 90px;
  }
  
  .voice-card-avatar {
    width: 70px;
    height: 70px;
    border-width: 3px;
  }
  
  .voice-card-content {
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    height: 90px;
    gap: 0.5rem;
    border-radius: 0.75rem;
  }

  .voice-card-name {
    font-size: 0.9rem;
  }

  .voice-card-tags {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .voice-tag {
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
  }

  .voice-card-id {
    font-size: 0.65rem;
  }

  .voice-card-id code {
    font-size: 0.65rem;
  }

  .voice-id-copy-btn {
    width: 20px;
    height: 20px;
  }

  .voice-id-copy-btn svg {
    width: 12px;
    height: 12px;
  }
  
  .voice-play-btn {
    width: 28px;
    height: 28px;
    border-width: 2px;
    bottom: 2px;
    right: 2px;
  }

  .voice-play-btn svg {
    width: 12px;
    height: 12px;
  }

  .voice-card-chevron {
    display: none;
  }
}

/* Extra small screens */
@media (max-width: 400px) {
  .voice-grid-container {
    padding: 0.5rem;
    gap: 1.25rem;
  }

  .voice-card {
    margin-left: 25px;
    padding-left: 35px;
    min-height: 80px;
  }

  .voice-card-avatar {
    width: 60px;
    height: 60px;
  }

  .voice-card-content {
    padding: 0.5rem 0.5rem 0.5rem 2rem;
    height: 80px;
  }

  .voice-card-name {
    font-size: 0.85rem;
  }

  .voice-card-id {
    display: none;
  }

  .voice-play-btn {
    width: 24px;
    height: 24px;
  }
}

@media (min-width: 769px) and (max-width: 1200px) {
  .voice-grid-container {
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 1.5rem 1.25rem;
  }
}

@media (min-width: 1201px) {
  .voice-grid-container {
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    gap: 1.5rem 1.25rem;
  }
}

/* ========================================
   Premium Upgrade Modal
   ======================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: hsl(0 0% 0% / 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.premium-upgrade-modal {
  background: hsl(var(--background));
  border-radius: 1.25rem;
  padding: 2rem;
  max-width: 380px;
  width: 90vw;
  text-align: center;
  box-shadow: 0 25px 60px -12px hsl(0 0% 0% / 0.25);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.active .premium-upgrade-modal {
  transform: scale(1);
}

.premium-upgrade-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, hsl(45, 100%, 50%) 0%, hsl(35, 100%, 55%) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 24px hsl(45 100% 50% / 0.3);
}

.premium-upgrade-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.premium-upgrade-text {
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.premium-upgrade-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.premium-upgrade-actions .btn-primary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  border: none;
  border-radius: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.premium-upgrade-actions .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.2);
}

.premium-upgrade-actions .btn-secondary {
  padding: 0.75rem 1.25rem;
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
  border: none;
  border-radius: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.premium-upgrade-actions .btn-secondary:hover {
  background: hsl(var(--foreground) / 0.1);
}
