/* Jellyfin UI Styles */

#jellyfin-section {
  display: none; /* Hidden by default, shown when authenticated + PIN verified */
  margin: 2rem 0;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.95), rgba(13, 13, 13, 0.95));
  border: 2px solid rgba(229, 9, 20, 0.3);
  border-radius: 12px;
}

.jellyfin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(229, 9, 20, 0.3);
}

.jellyfin-title {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(90deg, #aa5cc3, #00a4dc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.jellyfin-logo {
  width: 40px;
  height: 40px;
}

.jellyfin-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #4caf50;
}

.status-indicator {
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

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

/* Libraries Grid */
.jellyfin-libraries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.jellyfin-library-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
}

.jellyfin-library-card:hover {
  transform: translateY(-5px);
  border-color: rgba(170, 92, 195, 0.5);
  box-shadow: 0 10px 30px rgba(170, 92, 195, 0.3);
}

.library-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.library-info {
  padding: 1rem;
}

.library-info h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.library-info p {
  font-size: 0.85rem;
  color: #aaa;
}

/* Items Grid */
#jellyfin-items-section {
  display: none; /* Hidden until library is selected */
}

.jellyfin-items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.items-back-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.items-back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.jellyfin-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.jellyfin-item-card {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
}

.jellyfin-item-card:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 164, 220, 0.5);
  box-shadow: 0 8px 24px rgba(0, 164, 220, 0.3);
}

.item-image {
  width: 100%;
  height: 225px;
  object-fit: cover;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.item-info {
  padding: 0.75rem;
}

.item-info h4 {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-info p {
  font-size: 0.75rem;
  color: #888;
}

/* Error Messages */
.jellyfin-error {
  background: rgba(244, 67, 54, 0.2);
  border: 2px solid #f44336;
  color: #fff;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
}

/* Loading State */
.jellyfin-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: 1rem;
}

.jellyfin-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #aa5cc3;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.jellyfin-loading-text {
  color: #aaa;
  font-size: 0.9rem;
}

/* Access Denied Message */
.jellyfin-access-denied {
  background: rgba(255, 152, 0, 0.1);
  border: 2px solid rgba(255, 152, 0, 0.3);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
}

.jellyfin-access-denied h3 {
  color: #ff9800;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.jellyfin-access-denied p {
  color: #ccc;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.jellyfin-access-btn {
  background: linear-gradient(90deg, #e50914, #b20710);
  color: #fff;
  border: none;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.jellyfin-access-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 30px rgba(229, 9, 20, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
  #jellyfin-section {
    padding: 1rem;
    margin: 1rem 0;
  }

  .jellyfin-title {
    font-size: 1.5rem;
  }

  .jellyfin-libraries {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }

  .jellyfin-items {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .library-image {
    height: 120px;
  }

  .item-image {
    height: 180px;
  }
}
